diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-19 19:53:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-19 19:53:03 +0000 |
commit | 869bd02318d94a38369a125726b8edeb54ba0706 (patch) | |
tree | f56397934a1077011633291e6d73d75086781ec9 /src | |
parent | 12427e75fe175fe7a62f388281dd7ab5100c9dda (diff) |
Convert channel banlist members to std::string
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9769 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 5 | ||||
-rw-r--r-- | src/modes/cmode_b.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_timedbans.cpp | 4 |
4 files changed, 11 insertions, 14 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 84fa61b5a..83a3a5986 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -458,7 +458,6 @@ bool Channel::IsExtBanned(User *user, char type) { // XXX. do we need events? char mask[MAXBUF]; - char *maskptr; snprintf(mask, MAXBUF, "%s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->GetIPString()); @@ -468,9 +467,7 @@ bool Channel::IsExtBanned(User *user, char type) continue; // Iterate past char and : to get to the mask without doing a data copy(!) - maskptr = i->data; - maskptr++; // past the char - maskptr++; // past the : + std::string maskptr = i->data.substr(2); /* This allows CIDR ban matching * diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 92001b7fd..0811538f1 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -81,7 +81,7 @@ void ModeChannelBan::DisplayList(User* user, Channel* channel) /* Display the channel banlist */ for (BanList::reverse_iterator i = channel->bans.rbegin(); i != channel->bans.rend(); ++i) { - user->WriteServ("367 %s %s %s %s %lu",user->nick.c_str(), channel->name, i->data, i->set_by, (unsigned long)i->set_time); + user->WriteServ("367 %s %s %s %s %lu",user->nick.c_str(), channel->name, i->data.c_str(), i->set_by.c_str(), (unsigned long)i->set_time); } user->WriteServ("368 %s %s :End of channel ban list",user->nick.c_str(), channel->name); return; @@ -125,7 +125,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++) { - if (!strcasecmp(i->data, dest.c_str())) + if (!strcasecmp(i->data.c_str(), dest.c_str())) { /* dont allow a user to set the same ban twice */ dest = ""; @@ -134,8 +134,8 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan } b.set_time = ServerInstance->Time(); - strlcpy(b.data, dest.c_str(), MAXBUF); - strlcpy(b.set_by, servermode ? ServerInstance->Config->ServerName : user->nick.c_str(), 63); + b.data.assign(dest, 0, MAXBUF); + b.set_by.assign(servermode ? ServerInstance->Config->ServerName : user->nick, 0, 64); chan->bans.push_back(b); return dest; } @@ -144,7 +144,7 @@ ModePair ModeChannelBan::ModeSet(User*, User*, Channel* channel, const std::stri { for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) { - if (!strcasecmp(i->data,parameter.c_str())) + if (!strcasecmp(i->data.c_str(), parameter.c_str())) { return std::make_pair(true, i->data); } @@ -166,10 +166,10 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++) { - if (!strcasecmp(i->data,dest.c_str())) + if (!strcasecmp(i->data.c_str(), dest.c_str())) { int MOD_RESULT = 0; - FOREACH_RESULT(I_OnDelBan,OnDelBan(user,chan,dest)); + FOREACH_RESULT(I_OnDelBan,OnDelBan(user, chan, dest)); if (MOD_RESULT) { dest = ""; diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 3a28ca8a9..40718cedb 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -124,7 +124,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c) int linesize = 1; for (BanList::iterator b = c->bans.begin(); b != c->bans.end(); b++) { - int size = strlen(b->data) + 2; + int size = b->data.length() + 2; int currsize = linesize + size; if (currsize <= 350) { diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index d69533846..13f9301d2 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -55,7 +55,7 @@ class CommandTban : public Command } for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) { - if (!strcasecmp(i->data,parameters[2].c_str())) + if (!strcasecmp(i->data.c_str(), parameters[2].c_str())) { user->WriteServ("NOTICE "+std::string(user->nick)+" :The ban "+parameters[2]+" is already on the banlist of "+parameters[0]); return CMD_FAILURE; @@ -81,7 +81,7 @@ class CommandTban : public Command /* Check if the ban was actually added (e.g. banlist was NOT full) */ bool was_added = false; for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) - if (!strcasecmp(i->data,mask.c_str())) + if (!strcasecmp(i->data.c_str(), mask.c_str())) was_added = true; if (was_added) { |