summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-04 05:45:58 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-01-04 05:45:58 +0000
commit2708eea5d13c249143b83fbaa8b552992f0ac8b6 (patch)
tree5afffad5f83ca6daa89784c27f4d4e9c5f4eb8fc /src/protocol
parentf58026749b0c0770a322893b27c013168be5cdbc (diff)
Removed NICKMAX and CHANMAX, replaced user->nick, c->name, and ci->name with std::string
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2732 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bahamut.c20
-rw-r--r--src/protocol/inspircd11.c26
-rw-r--r--src/protocol/inspircd12.cpp30
-rw-r--r--src/protocol/ratbox.c32
-rw-r--r--src/protocol/unreal32.c22
5 files changed, 63 insertions, 67 deletions
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index f00982d6b..5ac0fe006 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -144,14 +144,14 @@ class BahamutIRCdProto : public IRCDProto
void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest->name, buf);
- else send_cmd(source->nick, "MODE %s %s", dest->name, buf);
+ if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest->name.c_str(), buf);
+ else send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(bi ? bi->nick : Config.ServerName, "SVSMODE %s %ld %s", u->nick, static_cast<long>(u->timestamp), buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "SVSMODE %s %ld %s", u->nick.c_str(), static_cast<long>(u->timestamp), buf);
}
/* SVSHOLD - set */
@@ -175,8 +175,8 @@ class BahamutIRCdProto : public IRCDProto
/* SVSMODE channel modes */
void SendSVSModeChan(Channel *c, const char *mode, const char *nick)
{
- if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name, mode, nick);
- else send_cmd(Config.ServerName, "SVSMODE %s %s", c->name, mode);
+ if (nick) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name.c_str(), mode, nick);
+ else send_cmd(Config.ServerName, "SVSMODE %s %s", c->name.c_str(), mode);
}
/* SQLINE */
@@ -232,7 +232,7 @@ class BahamutIRCdProto : public IRCDProto
/* TOPIC */
void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic)
{
- send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic);
+ send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name.c_str(), whosetit, static_cast<unsigned long>(c->topic_time), topic);
}
/* UNSQLINE */
@@ -260,7 +260,7 @@ class BahamutIRCdProto : public IRCDProto
*/
void SendSVSKillInternal(BotInfo *source, User *user, const char *buf)
{
- send_cmd(source ? source->nick : NULL, "SVSKILL %s :%s", user->nick, buf);
+ send_cmd(source ? source->nick : NULL, "SVSKILL %s :%s", user->nick.c_str(), buf);
}
/* SVSMODE */
@@ -283,13 +283,13 @@ class BahamutIRCdProto : public IRCDProto
void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf);
+ send_cmd(NULL, "NOTICE @%s :%s", dest->name.c_str(), buf);
}
void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf)
{
- if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf);
- else send_cmd(source->nick, "KICK %s %s", chan->name, user->nick);
+ if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf);
+ else send_cmd(source->nick, "KICK %s %s", chan->name.c_str(), user->nick.c_str());
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index eb2718a7a..659d1aaa9 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -165,19 +165,19 @@ class InspIRCdProto : public IRCDProto
void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic)
{
- send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic);
+ send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit, topic);
}
void SendVhostDel(User *u)
{
if (u->HasMode(UMODE_CLOAK))
- inspircd_cmd_chghost(u->nick, u->chost.c_str());
+ inspircd_cmd_chghost(u->nick.c_str(), u->chost.c_str());
else
- inspircd_cmd_chghost(u->nick, u->host);
+ inspircd_cmd_chghost(u->nick.c_str(), u->host);
if (has_chgidentmod && u->GetIdent() != u->GetVIdent())
{
- inspircd_cmd_chgident(u->nick, u->GetIdent().c_str());
+ inspircd_cmd_chgident(u->nick.c_str(), u->GetIdent().c_str());
}
}
@@ -192,7 +192,7 @@ class InspIRCdProto : public IRCDProto
void SendSVSKillInternal(BotInfo *source, User *user, const char *buf)
{
- send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick, buf);
+ send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick.c_str(), buf);
}
void SendSVSMode(User *u, int ac, const char **av)
@@ -213,13 +213,13 @@ class InspIRCdProto : public IRCDProto
void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf);
+ send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(bi ? bi->nick : Config.ServerName, "MODE %s %s", u->nick, buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "MODE %s %s", u->nick.c_str(), buf);
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
@@ -230,14 +230,14 @@ class InspIRCdProto : public IRCDProto
void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf)
{
- if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, buf);
- else send_cmd(source->nick, "KICK %s %s :%s", chan->name, user->nick, user->nick);
+ if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf);
+ else send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), user->nick.c_str());
}
void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(Config.ServerName, "NOTICE @%s :%s", dest->name, buf);
+ send_cmd(Config.ServerName, "NOTICE @%s :%s", dest->name.c_str(), buf);
}
/* SERVER services-dev.chatspike.net password 0 :Description here */
@@ -278,8 +278,8 @@ class InspIRCdProto : public IRCDProto
void SendVhost(User *u, const char *vIdent, const char *vhost)
{
- if (vIdent) inspircd_cmd_chgident(u->nick, vIdent);
- inspircd_cmd_chghost(u->nick, vhost);
+ if (vIdent) inspircd_cmd_chgident(u->nick.c_str(), vIdent);
+ inspircd_cmd_chghost(u->nick.c_str(), vhost);
}
void SendConnect()
@@ -568,7 +568,7 @@ int anope_event_topic(const char *source, int ac, const char **av)
if (ac > 1 && *av[1])
c->topic = sstrdup(av[1]);
- strscpy(c->topic_setter, source, sizeof(c->topic_setter));
+ c->topic_setter = source;
c->topic_time = topic_time;
record_topic(av[0]);
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index 0af116070..b791ca71f 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -171,19 +171,19 @@ class InspIRCdProto : public IRCDProto
void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic)
{
- send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", c->name, static_cast<unsigned long>(c->topic_time), whosetit, topic);
+ send_cmd(whosets->uid, "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit, topic);
}
void SendVhostDel(User *u)
{
if (u->HasMode(UMODE_CLOAK))
- inspircd_cmd_chghost(u->nick, u->chost.c_str());
+ inspircd_cmd_chghost(u->nick.c_str(), u->chost.c_str());
else
- inspircd_cmd_chghost(u->nick, u->host);
+ inspircd_cmd_chghost(u->nick.c_str(), u->host);
if (has_chgidentmod && u->GetIdent() != u->GetVIdent())
{
- inspircd_cmd_chgident(u->nick, u->GetIdent().c_str());
+ inspircd_cmd_chgident(u->nick.c_str(), u->GetIdent().c_str());
}
}
@@ -219,7 +219,7 @@ class InspIRCdProto : public IRCDProto
void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
- send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest->name, static_cast<unsigned>(dest->creation_time), buf);
+ send_cmd(source ? source->uid : TS6SID, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
@@ -236,14 +236,14 @@ class InspIRCdProto : public IRCDProto
void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf)
{
if (buf)
- send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf);
+ send_cmd(source->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf);
else
- send_cmd(source->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), user->nick);
+ send_cmd(source->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), user->nick.c_str());
}
void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf)
{
- send_cmd(TS6SID, "NOTICE @%s :%s", dest->name, buf);
+ send_cmd(TS6SID, "NOTICE @%s :%s", dest->name.c_str(), buf);
}
/* SERVER services-dev.chatspike.net password 0 :Description here */
@@ -283,8 +283,8 @@ class InspIRCdProto : public IRCDProto
void SendVhost(User *u, const char *vIdent, const char *vhost)
{
if (vIdent)
- inspircd_cmd_chgident(u->nick, vIdent);
- inspircd_cmd_chghost(u->nick, vhost);
+ inspircd_cmd_chgident(u->nick.c_str(), vIdent);
+ inspircd_cmd_chghost(u->nick.c_str(), vhost);
}
void SendConnect()
@@ -446,8 +446,8 @@ int anope_event_mode(const char *source, int ac, const char **av)
if (u == NULL)
return MOD_CONT;
- av[0] = u2->nick;
- do_umode(u->nick, ac, av);
+ av[0] = u2->nick.c_str();
+ do_umode(u->nick.c_str(), ac, av);
}
return MOD_CONT;
}
@@ -660,7 +660,7 @@ int anope_event_topic(const char *source, int ac, const char **av)
if (ac > 1 && *av[1])
c->topic = sstrdup(av[1]);
- strscpy(c->topic_setter, u ? u->nick : source, sizeof(c->topic_setter));
+ c->topic_setter = u ? u->nick : source;
c->topic_time = topic_time;
record_topic(av[0]);
@@ -698,7 +698,7 @@ int anope_event_kill(const char *source, int ac, const char **av)
{
User *u = find_byuid(av[0]);
BotInfo *bi = findbot(av[0]);
- m_kill(u ? u->nick : (bi ? bi->nick : av[0]), av[1]);
+ m_kill(u ? u->nick.c_str() : (bi ? bi->nick : av[0]), av[1]);
return MOD_CONT;
}
@@ -908,7 +908,7 @@ int anope_event_privmsg(const char *source, int ac, const char **av)
if (!u)
return MOD_CONT; // likely a message from a server, which can happen.
- m_privmsg(u->nick, bi ? bi->nick: av[0], av[1]);
+ m_privmsg(u->nick.c_str(), bi ? bi->nick: av[0], av[1]);
return MOD_CONT;
}
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 78be63723..a9e2c9027 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -265,26 +265,26 @@ class RatboxProto : public IRCDTS6Proto
{
if (bi)
{
- send_cmd(bi->uid, "MODE %s %s", dest->name, buf);
+ send_cmd(bi->uid, "MODE %s %s", dest->name.c_str(), buf);
}
- else send_cmd(TS6SID, "MODE %s %s", dest->name, buf);
+ else send_cmd(TS6SID, "MODE %s %s", dest->name.c_str(), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(bi ? bi->uid : TS6SID, "SVSMODE %s %s", u->nick, buf);
+ send_cmd(bi ? bi->uid : TS6SID, "SVSMODE %s %s", u->nick.c_str(), buf);
}
void SendKickInternal(BotInfo *bi, Channel *chan, User *user, const char *buf)
{
- if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan->name, user->GetUID().c_str(), buf);
- else send_cmd(bi->uid, "KICK %s %s", chan->name, user->GetUID().c_str());
+ if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf);
+ else send_cmd(bi->uid, "KICK %s %s", chan->name.c_str(), user->GetUID().c_str());
}
void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf)
{
- send_cmd(NULL, "NOTICE @%s :%s", dest->name, buf);
+ send_cmd(NULL, "NOTICE @%s :%s", dest->name.c_str(), buf);
}
/* QUIT */
@@ -320,7 +320,7 @@ class RatboxProto : public IRCDTS6Proto
void SendTopic(BotInfo *bi, Channel *c, const char *whosetit, const char *topic)
{
- send_cmd(bi->uid, "TOPIC %s :%s", c->name, topic);
+ send_cmd(bi->uid, "TOPIC %s :%s", c->name.c_str(), topic);
}
void SetAutoIdentificationToken(User *u)
@@ -430,11 +430,7 @@ int anope_event_topic(const char *source, int ac, const char **av)
c->topic = sstrdup(av[1]);
u = find_byuid(source);
- if (u) {
- strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter));
- } else {
- strscpy(c->topic_setter, source, sizeof(c->topic_setter));
- }
+ c->topic_setter = u ? u->nick : source;
c->topic_time = topic_time;
record_topic(av[0]);
@@ -487,7 +483,7 @@ int anope_event_tburst(const char *source, int ac, const char **av)
if (ac > 1 && *av[3])
c->topic = sstrdup(av[3]);
- strscpy(c->topic_setter, setter, sizeof(c->topic_setter));
+ c->topic_setter = setter;
c->topic_time = topic_time;
record_topic(av[0]);
@@ -519,7 +515,7 @@ int anope_event_away(const char *source, int ac, const char **av)
User *u = NULL;
u = find_byuid(source);
- m_away(u ? u->nick : source, (ac ? av[0] : NULL));
+ m_away(u ? u->nick.c_str() : source, (ac ? av[0] : NULL));
return MOD_CONT;
}
@@ -586,7 +582,7 @@ int anope_event_part(const char *source, int ac, const char **av)
}
u = find_byuid(source);
- do_part(u ? u->nick : source, ac, av);
+ do_part(u ? u->nick.c_str() : source, ac, av);
return MOD_CONT;
}
@@ -648,7 +644,7 @@ int anope_event_quit(const char *source, int ac, const char **av)
u = find_byuid(source);
- do_quit(u ? u->nick : source, ac, av);
+ do_quit(u ? u->nick.c_str() : source, ac, av);
return MOD_CONT;
}
@@ -665,8 +661,8 @@ int anope_event_mode(const char *source, int ac, const char **av)
} else {
u = find_byuid(source);
u2 = find_byuid(av[0]);
- av[0] = u2->nick;
- do_umode(u->nick, ac, av);
+ av[0] = u2->nick.c_str();
+ do_umode(u->nick.c_str(), ac, av);
}
return MOD_CONT;
}
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 7e8d0985b..81229930c 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -181,7 +181,7 @@ class UnrealIRCdProto : public IRCDProto
void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic)
{
- send_cmd(whosets->nick, ") %s %s %lu :%s", c->name, whosetit, static_cast<unsigned long>(c->topic_time), topic);
+ send_cmd(whosets->nick, ") %s %s %lu :%s", c->name.c_str(), whosetit, static_cast<unsigned long>(c->topic_time), topic);
}
void SendVhostDel(User *u)
@@ -204,7 +204,7 @@ class UnrealIRCdProto : public IRCDProto
void SendSVSKillInternal(BotInfo *source, User *user, const char *buf)
{
- send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick, buf);
+ send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick.c_str(), buf);
}
/*
@@ -225,13 +225,13 @@ class UnrealIRCdProto : public IRCDProto
void SendModeInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(source->nick, "G %s %s", dest->name, buf);
+ send_cmd(source->nick, "G %s %s", dest->name.c_str(), buf);
}
void SendModeInternal(BotInfo *bi, User *u, const char *buf)
{
if (!buf) return;
- send_cmd(bi ? bi->nick : Config.ServerName, "v %s %s", u->nick, buf);
+ send_cmd(bi ? bi->nick : Config.ServerName, "v %s %s", u->nick.c_str(), buf);
}
void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid)
@@ -244,14 +244,14 @@ class UnrealIRCdProto : public IRCDProto
void SendKickInternal(BotInfo *source, Channel *chan, User *user, const char *buf)
{
- if (buf) send_cmd(source->nick, "H %s %s :%s", chan->name, user->nick, buf);
- else send_cmd(source->nick, "H %s %s", chan->name, user->nick);
+ if (buf) send_cmd(source->nick, "H %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf);
+ else send_cmd(source->nick, "H %s %s", chan->name.c_str(), user->nick.c_str());
}
void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const char *buf)
{
if (!buf) return;
- send_cmd(source->nick, "B @%s :%s", dest->name, buf);
+ send_cmd(source->nick, "B @%s :%s", dest->name.c_str(), buf);
}
/* SERVER name hop descript */
@@ -320,8 +320,8 @@ class UnrealIRCdProto : public IRCDProto
void SendVhost(User *u, const char *vIdent, const char *vhost)
{
- if (vIdent) unreal_cmd_chgident(u->nick, vIdent);
- unreal_cmd_chghost(u->nick, vhost);
+ if (vIdent) unreal_cmd_chgident(u->nick.c_str(), vIdent);
+ unreal_cmd_chghost(u->nick.c_str(), vhost);
}
void SendConnect()
@@ -392,8 +392,8 @@ class UnrealIRCdProto : public IRCDProto
void SendSVSModeChan(Channel *c, const char *mode, const char *nick)
{
- if (nick) send_cmd(Config.ServerName, "n %s %s %s", c->name, mode, nick);
- else send_cmd(Config.ServerName, "n %s %s", c->name, mode);
+ if (nick) send_cmd(Config.ServerName, "n %s %s %s", c->name.c_str(), mode, nick);
+ else send_cmd(Config.ServerName, "n %s %s", c->name.c_str(), mode);
}
/* svsjoin