summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h4
-rw-r--r--src/channels.cpp5
-rw-r--r--src/modes/cmode_b.cpp14
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/modules/m_timedbans.cpp4
5 files changed, 13 insertions, 16 deletions
diff --git a/include/channels.h b/include/channels.h
index 940b9b555..b404e26cd 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -41,10 +41,10 @@ class HostItem : public classbase
time_t set_time;
/** Who added the item
*/
- char set_by[64];
+ std::string set_by;
/** The actual item data
*/
- char data[MAXBUF];
+ std::string data;
HostItem() { /* stub */ }
virtual ~HostItem() { /* stub */ }
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)
{