]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Convert channel::name to std::string, this was a beastie!
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 19 May 2008 21:16:42 +0000 (21:16 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 19 May 2008 21:16:42 +0000 (21:16 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9770 e03df62e-2008-0410-955e-edbf42e46eb7

53 files changed:
include/channels.h
include/u_listmode.h
src/channels.cpp
src/commands/cmd_invite.cpp
src/commands/cmd_list.cpp
src/commands/cmd_names.cpp
src/commands/cmd_notice.cpp
src/commands/cmd_privmsg.cpp
src/commands/cmd_topic.cpp
src/commands/cmd_who.cpp
src/mode.cpp
src/modes/cmode_b.cpp
src/modes/cmode_h.cpp
src/modes/cmode_k.cpp
src/modes/cmode_o.cpp
src/modes/cmode_v.cpp
src/modules/extra/m_sqlutils.cpp
src/modules/m_auditorium.cpp
src/modules/m_banredirect.cpp
src/modules/m_blockcaps.cpp
src/modules/m_blockcolor.cpp
src/modules/m_censor.cpp
src/modules/m_chancreate.cpp
src/modules/m_chanfilter.cpp
src/modules/m_chanlog.cpp
src/modules/m_chanprotect.cpp
src/modules/m_cycle.cpp
src/modules/m_delayjoin.cpp
src/modules/m_invisible.cpp
src/modules/m_joinflood.cpp
src/modules/m_kicknorejoin.cpp
src/modules/m_knock.cpp
src/modules/m_messageflood.cpp
src/modules/m_nickflood.cpp
src/modules/m_noctcp.cpp
src/modules/m_noinvite.cpp
src/modules/m_nokicks.cpp
src/modules/m_nonicks.cpp
src/modules/m_nonotice.cpp
src/modules/m_operchans.cpp
src/modules/m_override.cpp
src/modules/m_redirect.cpp
src/modules/m_remove.cpp
src/modules/m_safelist.cpp
src/modules/m_services.cpp
src/modules/m_spanningtree/fjoin.cpp
src/modules/m_spanningtree/ftopic.cpp
src/modules/m_spanningtree/netburst.cpp
src/modules/m_spanningtree/privmsg.cpp
src/modules/m_sslmodes.cpp
src/modules/m_timedbans.cpp
src/modules/m_uninvite.cpp
src/users.cpp

index b404e26cdef2735b215f9a60cd1d7c9f784d997d..7f1be6c5a1ca4e4d52621b7b353e88504285b588 100644 (file)
@@ -134,7 +134,7 @@ class CoreExport Channel : public Extensible
 
        /** The channel's name.
         */
-       char name[CHANMAX];
+       std::string name; /* CHANMAX */
 
        /** Modes for the channel.
         * This is not a null terminated string! It is a hash where
@@ -180,7 +180,7 @@ class CoreExport Channel : public Extensible
        /** Channel topic.
         * If this is an empty string, no channel topic is set.
         */
-       char topic[MAXTOPIC];
+       std::string topic; /* MAXTOPIC */
 
        /** Creation time.
         * This is a timestamp (TS) value.
@@ -195,7 +195,7 @@ class CoreExport Channel : public Extensible
        /** The last user to set the topic.
         * If this member is an empty string, no topic was ever set.
         */
-       char setby[128];
+       std::string setby; /* 128 */
 
        /** Contains the channel user limit.
         * If this value is zero, there is no limit in place.
@@ -205,7 +205,7 @@ class CoreExport Channel : public Extensible
        /** Contains the channel key.
         * If this value is an empty string, there is no channel key in place.
         */
-       char key[32];
+       std::string key; /* 32 */
 
        /** The list of all bans set on the channel.
         */
index a7df014ed539811fa55fd9e75abfab0697ec62b9..5d1607b5c8dc741ef9ec4c1714e14e1d19246501 100644 (file)
@@ -153,15 +153,15 @@ class ListModeBase : public ModeHandler
                {
                        for (modelist::reverse_iterator it = el->rbegin(); it != el->rend(); ++it)
                        {
-                               user->WriteNumeric(listnumeric, "%s %s %s %s %s", user->nick.c_str(), channel->name, it->mask.c_str(), it->nick.c_str(), it->time.c_str());
+                               user->WriteNumeric(listnumeric, "%s %s %s %s %s", user->nick.c_str(), channel->name.c_str(), it->mask.c_str(), it->nick.c_str(), it->time.c_str());
                        }
                }
-               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name, endofliststring.c_str());
+               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str());
        }
 
        virtual void DisplayEmptyList(User* user, Channel* channel)
        {
-               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name, endofliststring.c_str());
+               user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str());
        }
 
        /** Remove all instances of the mode from a channel.
@@ -323,7 +323,7 @@ class ListModeBase : public ModeHandler
                        /* List is full, give subclass a chance to send a custom message */
                        if (!TellListTooLong(source, channel, parameter))
                        {
-                               source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name, parameter.c_str());
+                               source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str());
                        }
                        
                        parameter = "";
index 83a3a59869b63a8fbfd0c7cee0e09ceb29aa24ea..f0cd66dbf29af66d53ec09facde8dd2c2c1c48ab 100644 (file)
@@ -25,16 +25,13 @@ Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : Serv
                throw CoreException("Cannot create duplicate channel " + cname);
 
        (*(ServerInstance->chanlist))[cname.c_str()] = this;
-       strlcpy(this->name, cname.c_str(), CHANMAX);
+       this->name.assign(cname, 0, CHANMAX);
        this->created = ts ? ts : ServerInstance->Time();
        this->age = this->created;
 
 
-
-
-       *topic = *setby = *key = 0;
        maxbans = topicset = limit = 0;
-       memset(&modes,0,64);
+       memset(&modes, 0, 64);
 }
 
 void Channel::SetMode(char mode,bool mode_on)
@@ -305,15 +302,15 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                        }
                        else if (MOD_RESULT == 0)
                        {
-                               if (*Ptr->key)
+                               if (!Ptr->key.empty())
                                {
                                        MOD_RESULT = 0;
                                        FOREACH_RESULT_I(Instance,I_OnCheckKey,OnCheckKey(user, Ptr, key ? key : ""));
                                        if (!MOD_RESULT)
                                        {
-                                               if ((!key) || strcmp(key,Ptr->key))
+                                               if ((!key) || Ptr->key == key)
                                                {
-                                                       user->WriteNumeric(475, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name);
+                                                       user->WriteNumeric(475, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name.c_str());
                                                        return NULL;
                                                }
                                        }
@@ -324,13 +321,13 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                                        FOREACH_RESULT_I(Instance,I_OnCheckInvite,OnCheckInvite(user, Ptr));
                                        if (!MOD_RESULT)
                                        {
-                                               if (!user->IsInvited(Ptr->name))
+                                               if (!user->IsInvited(Ptr->name.c_str()))
                                                {
-                                                       user->WriteNumeric(473, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name);
+                                                       user->WriteNumeric(473, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), Ptr->name.c_str());
                                                        return NULL;
                                                }
                                        }
-                                       user->RemoveInvite(Ptr->name);
+                                       user->RemoveInvite(Ptr->name.c_str());
                                }
                                if (Ptr->limit)
                                {
@@ -340,7 +337,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                                        {
                                                if (Ptr->GetUserCounter() >= Ptr->limit)
                                                {
-                                                       user->WriteNumeric(471, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name);
+                                                       user->WriteNumeric(471, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), Ptr->name.c_str());
                                                        return NULL;
                                                }
                                        }
@@ -349,7 +346,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                                {
                                        if (Ptr->IsBanned(user))
                                        {
-                                               user->WriteNumeric(474, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), Ptr->name);
+                                               user->WriteNumeric(474, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), Ptr->name.c_str());
                                                return NULL;
                                        }
                                }
@@ -407,20 +404,20 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const
        FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user, Ptr, bursting, silent));
 
        if (!silent)
-               Ptr->WriteChannel(user,"JOIN :%s",Ptr->name);
+               Ptr->WriteChannel(user,"JOIN :%s",Ptr->name.c_str());
 
        /* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
        std::string ms = Instance->Modes->ModeString(user, Ptr);
        if ((Ptr->GetUserCounter() > 1) && (ms.length()))
-               Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name, ms.c_str());
+               Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name.c_str(), ms.c_str());
 
        /* Major improvement by Brain - we dont need to be calculating all this pointlessly for remote users */
        if (IS_LOCAL(user))
        {
                if (Ptr->topicset)
                {
-                       user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), Ptr->name, Ptr->topic);
-                       user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
+                       user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), Ptr->name.c_str(), Ptr->topic.c_str());
+                       user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), Ptr->name.c_str(), Ptr->setby.c_str(), (unsigned long)Ptr->topicset);
                }
                Ptr->UserList(user);
        }
@@ -499,7 +496,7 @@ long Channel::PartUser(User *user, const char* reason)
                FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : "", silent));
 
                if (!silent)
-                       this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : "");
+                       this->WriteChannel(user, "PART %s%s%s", this->name.c_str(), reason ? " :" : "", reason ? reason : "");
 
                user->chans.erase(i);
                this->RemoveAllPrefixes(user);
@@ -552,7 +549,7 @@ long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents,
        if (i != user->chans.end())
        {
                if (!silent)
-                       this->WriteChannelWithServ(servername, "KICK %s %s :%s", this->name, user->nick.c_str(), reason);
+                       this->WriteChannelWithServ(servername, "KICK %s %s :%s", this->name.c_str(), user->nick.c_str(), reason);
 
                user->chans.erase(i);
                this->RemoveAllPrefixes(user);
@@ -588,12 +585,12 @@ long Channel::KickUser(User *src, User *user, const char* reason)
        {
                if (!this->HasUser(user))
                {
-                       src->WriteNumeric(441, "%s %s %s :They are not on that channel",src->nick.c_str(), user->nick.c_str(), this->name);
+                       src->WriteNumeric(441, "%s %s %s :They are not on that channel",src->nick.c_str(), user->nick.c_str(), this->name.c_str());
                        return this->GetUserCounter();
                }
                if ((ServerInstance->ULine(user->server)) && (!ServerInstance->ULine(src->server)))
                {
-                       src->WriteNumeric(482, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick.c_str(), this->name);
+                       src->WriteNumeric(482, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick.c_str(), this->name.c_str());
                        return this->GetUserCounter();
                }
                int MOD_RESULT = 0;
@@ -618,7 +615,7 @@ long Channel::KickUser(User *src, User *user, const char* reason)
                                int us = this->GetStatus(user);
                                if ((them < STATUS_HOP) || (them < us))
                                {
-                                       src->WriteNumeric(482, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name, them == STATUS_HOP ? "" : "half-");
+                                       src->WriteNumeric(482, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them == STATUS_HOP ? "" : "half-");
                                        return this->GetUserCounter();
                                }
                        }
@@ -632,7 +629,7 @@ long Channel::KickUser(User *src, User *user, const char* reason)
        {
                /* zap it from the channel list of the user */
                if (!silent)
-                       this->WriteChannel(src, "KICK %s %s :%s", this->name, user->nick.c_str(), reason);
+                       this->WriteChannel(src, "KICK %s %s :%s", this->name.c_str(), user->nick.c_str(), reason);
 
                user->chans.erase(i);
                this->RemoveAllPrefixes(user);
@@ -641,7 +638,7 @@ long Channel::KickUser(User *src, User *user, const char* reason)
        if (!this->DelUser(user))
        /* if there are no users left on the channel */
        {
-               chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
+               chan_hash::iterator iter = ServerInstance->chanlist->find(this->name.c_str());
 
                /* kill the record */
                if (iter != ServerInstance->chanlist->end())
@@ -682,7 +679,7 @@ void Channel::WriteChannel(User* user, const std::string &text)
        if (!user)
                return;
 
-       snprintf(tb,MAXBUF,":%s %s",user->GetFullHost().c_str(),text.c_str());
+       snprintf(tb,MAXBUF,":%s %s", user->GetFullHost().c_str(), text.c_str());
        std::string out = tb;
 
        for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
@@ -712,7 +709,7 @@ void Channel::WriteChannelWithServ(const char* ServName, const std::string &text
        CUList *ulist = this->GetUsers();
        char tb[MAXBUF];
 
-       snprintf(tb,MAXBUF,":%s %s",ServName ? ServName : ServerInstance->Config->ServerName, text.c_str());
+       snprintf(tb,MAXBUF,":%s %s", ServName ? ServName : ServerInstance->Config->ServerName, text.c_str());
        std::string out = tb;
 
        for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
@@ -759,7 +756,7 @@ void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList
        CUList *ulist = this->GetUsers();
        char tb[MAXBUF];
 
-       snprintf(tb,MAXBUF,":%s %s",user->GetFullHost().c_str(),text.c_str());
+       snprintf(tb,MAXBUF,":%s %s", user->GetFullHost().c_str(), text.c_str());
        std::string out = tb;
 
        for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
@@ -874,12 +871,12 @@ void Channel::UserList(User *user, CUList *ulist)
        {
                if ((this->IsModeSet('s')) && (!this->HasUser(user)))
                {
-                       user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), this->name);
+                       user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), this->name.c_str());
                        return;
                }
        }
 
-       dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=',  this->name);
+       dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=',  this->name.c_str());
 
        int numusers = 0;
        char* ptr = list + dlen;
@@ -926,7 +923,7 @@ void Channel::UserList(User *user, CUList *ulist)
                        user->WriteServ(std::string(list));
 
                        /* reset our lengths */
-                       dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name);
+                       dlen = curlen = snprintf(list,MAXBUF,"%s %c %s :", user->nick.c_str(), this->IsModeSet('s') ? '@' : this->IsModeSet('p') ? '*' : '=', this->name.c_str());
                        ptr = list + dlen;
 
                        ptrlen = 0;
@@ -947,7 +944,7 @@ void Channel::UserList(User *user, CUList *ulist)
                user->WriteNumeric(353,std::string(list));
        }
 
-       user->WriteNumeric(366, "%s %s :End of /NAMES list.", user->nick.c_str(), this->name);
+       user->WriteNumeric(366, "%s %s :End of /NAMES list.", user->nick.c_str(), this->name.c_str());
 }
 
 long Channel::GetMaxBans()
index 1455e94e786a07879b1fcb31a83258703f422f76..116198d735e073546f5ab6e6e9d9c22f73233da4 100644 (file)
@@ -45,20 +45,20 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                {
                        if (c->GetStatus(user) < STATUS_HOP)
                        {
-                               user->WriteNumeric(482, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name, c->GetStatus(u) == STATUS_HOP ? "" : "half-");
+                               user->WriteNumeric(482, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetStatus(u) == STATUS_HOP ? "" : "half-");
                                return CMD_FAILURE;
                        }
                }
 
                if (c->HasUser(u))
                {
-                       user->WriteNumeric(443, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name);
+                       user->WriteNumeric(443, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str());
                        return CMD_FAILURE;
                }
 
                if ((IS_LOCAL(user)) && (!c->HasUser(user)))
                {
-                       user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick.c_str(), c->name);
+                       user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
 
@@ -69,22 +69,22 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                        return CMD_FAILURE;
                }
 
-               u->InviteTo(c->name, timeout);
-               u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name);
-               user->WriteNumeric(341, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name);
+               u->InviteTo(c->name.c_str(), timeout);
+               u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str());
+               user->WriteNumeric(341, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str());
                switch (ServerInstance->Config->AnnounceInvites)
                {
                        case ServerConfig::INVITE_ANNOUNCE_ALL:
-                               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick.c_str(), u->nick.c_str());
+                               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
                        break;
                        case ServerConfig::INVITE_ANNOUNCE_OPS:
-                               c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick.c_str(), u->nick.c_str());
+                               c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
                        break;
                        case ServerConfig::INVITE_ANNOUNCE_DYNAMIC:
                                if (c->IsModeSet('i'))
-                                       c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick.c_str(), u->nick.c_str());
+                                       c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
                                else
-                                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick.c_str(), u->nick.c_str());
+                                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
                        break;
                        default:
                                /* Nobody */
index 62bf8d628db99ae301d6fe541141d28da89b75a4..b2ec1941bed766da04e4c0f6845c2a54148f0b51 100644 (file)
@@ -68,7 +68,7 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
                {
                        if (IS_OPER(user) || (((!(i->second->IsModeSet('p'))) && (!(i->second->IsModeSet('s')))) || (n)))
                        {
-                               user->WriteNumeric(322, "%s %s %ld :[+%s] %s",user->nick.c_str(),i->second->name,users,i->second->ChanModes(n),i->second->topic);
+                               user->WriteNumeric(322, "%s %s %ld :[+%s] %s",user->nick.c_str(),i->second->name.c_str(),users,i->second->ChanModes(n),i->second->topic.c_str());
                        }
                }
        }
index acf516e86391dfd1068db9a0eb4ca0a8a130fb1c..a48cd256025dd86483c31bac6ee958a966ee5e3a 100644 (file)
@@ -39,7 +39,7 @@ CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User
        {
                if ((c->IsModeSet('s')) && (!c->HasUser(user)))
                {
-                     user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name);
+                     user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str());
                      return CMD_FAILURE;
                }
                c->UserList(user);
index 6c8762a30e81e07944ceb59f82ff00931f657791..5086f3f4fb8b866bfe63c8764777506e70ce479c 100644 (file)
@@ -69,12 +69,12 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
                        {
                                if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
                                {
-                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name);
+                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
                                if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
                                {
-                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name);
+                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
                        }
@@ -99,16 +99,16 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
                        {
                                if (ServerInstance->Config->UndernetMsgPrefix)
                                {
-                                       chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%c %s", status, chan->name, status, text);
+                                       chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%c %s", status, chan->name.c_str(), status, text);
                                }
                                else
                                {
-                                       chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%s", status, chan->name, text);
+                                       chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%s", status, chan->name.c_str(), text);
                                }
                        }
                        else
                        {
-                               chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name, text);
+                               chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name.c_str(), text);
                        }
 
                        FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,text,status,exempt_list));
index c4d6049593dc8b97c368b91fd8c3208905d5f11c..842635ae27bbfe8cad5aed1a97b2ed8c0c7718ab 100644 (file)
@@ -70,12 +70,12 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                        {
                                if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
                                {
-                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name);
+                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
                                if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
                                {
-                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name);
+                                       user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
                        }
@@ -101,16 +101,16 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                        {
                                if (ServerInstance->Config->UndernetMsgPrefix)
                                {
-                                       chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%c %s", status, chan->name, status, text);
+                                       chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%c %s", status, chan->name.c_str(), status, text);
                                }
                                else
                                {
-                                       chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name, text);
+                                       chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name.c_str(), text);
                                }
                        }
                        else 
                        {
-                               chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, text);
+                               chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name.c_str(), text);
                        }
 
                        FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,text,status,except_list));
@@ -118,7 +118,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                else
                {
                        /* no such nick/channel */
-                       user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), target);
+                       user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), target);
                        return CMD_FAILURE;
                }
                return CMD_SUCCESS;
@@ -159,7 +159,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
                if (IS_AWAY(dest))
                {
                        /* auto respond with aweh msg */
-                       user->WriteNumeric(301, "%s %s :%s",user->nick.c_str(),dest->nick.c_str(),dest->awaymsg.c_str());
+                       user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
                }
 
                int MOD_RESULT = 0;
index f228243bdbd77849934ed3a1f5f7ed68df09746f..e723a50c9948d2f022375836accb9f454c2b6966 100644 (file)
@@ -31,17 +31,17 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
                {
                        if ((Ptr->IsModeSet('s')) && (!Ptr->HasUser(user)))
                        {
-                               user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), Ptr->name);
+                               user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), Ptr->name.c_str());
                                return CMD_FAILURE;
                        }
                        if (Ptr->topicset)
                        {
-                               user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), Ptr->name, Ptr->topic);
-                               user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
+                               user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), Ptr->name.c_str(), Ptr->topic.c_str());
+                               user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), Ptr->name.c_str(), Ptr->setby.c_str(), (unsigned long)Ptr->topicset);
                        }
                        else
                        {
-                               user->WriteNumeric(331, "%s %s :No topic is set.", user->nick.c_str(), Ptr->name);
+                               user->WriteNumeric(331, "%s %s :No topic is set.", user->nick.c_str(), Ptr->name.c_str());
                        }
                }
                else
@@ -60,12 +60,12 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
                        {
                                if (!Ptr->HasUser(user))
                                {
-                                       user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick.c_str(), Ptr->name);
+                                       user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick.c_str(), Ptr->name.c_str());
                                        return CMD_FAILURE;
                                }
                                if ((Ptr->IsModeSet('t')) && (Ptr->GetStatus(user) < STATUS_HOP))
                                {
-                                       user->WriteNumeric(482, "%s %s :You must be at least a half-operator to change the topic on this channel", user->nick.c_str(), Ptr->name);
+                                       user->WriteNumeric(482, "%s %s :You must be at least a half-operator to change the topic on this channel", user->nick.c_str(), Ptr->name.c_str());
                                        return CMD_FAILURE;
                                }
                        }
@@ -79,26 +79,25 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
                                 */
                                int MOD_RESULT = 0;
 
-                               strlcpy(topic, parameters[1].c_str(), MAXTOPIC-1);
+                               strlcpy(topic, parameters[1].c_str(), MAXTOPIC);
                                FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
                                if (MOD_RESULT)
                                        return CMD_FAILURE;
 
-                               strlcpy(Ptr->topic, topic, MAXTOPIC-1);
+                               Ptr->topic.assign(topic, 0, MAXTOPIC);
                        }
                        else
                        {
                                /* Sneaky shortcut, one string copy for a remote topic */
-                               strlcpy(Ptr->topic, parameters[1].c_str(), MAXTOPIC-1);
+                               Ptr->topic.assign(parameters[1], 0, MAXTOPIC);
                        }
 
-                       if (ServerInstance->Config->FullHostInTopic)
-                               strlcpy(Ptr->setby,user->GetFullHost().c_str(),127);
-                       else
-                               strlcpy(Ptr->setby,user->nick.c_str(),127);
+                       Ptr->setby.assign(ServerInstance->Config->FullHostInTopic ?
+                                       user->GetFullHost() : user->nick,
+                                       0, 128);
 
                        Ptr->topicset = ServerInstance->Time();
-                       Ptr->WriteChannel(user, "TOPIC %s :%s", Ptr->name, Ptr->topic);
+                       Ptr->WriteChannel(user, "TOPIC %s :%s", Ptr->name.c_str(), Ptr->topic.c_str());
 
                        if (IS_LOCAL(user))
                                /* We know 'topic' will contain valid data here */
index 7f4365204a85f91163363dcbe3d6413e26af4ad5..a9f27de83c7cb725644ec74cf0d241859652de10 100644 (file)
@@ -15,7 +15,9 @@
 #include "wildcard.h"
 #include "commands/cmd_who.h"
 
-static const char *get_first_visible_channel(User *u)
+static const std::string star = "*";
+
+static const std::string& get_first_visible_channel(User *u)
 {
        UCListIter i = u->chans.begin();
        if (i != u->chans.end())
@@ -24,7 +26,7 @@ static const char *get_first_visible_channel(User *u)
                        return i->first->name;
        }
 
-       return "*";
+       return star;
 }
 
 bool CommandWho::whomatch(User* user, const char* matchtext)
@@ -138,7 +140,7 @@ void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch
        if (u->Visibility && !u->Visibility->VisibleTo(user))
                return;
 
-       std::string lcn = get_first_visible_channel(u);
+       const std::string& lcn = get_first_visible_channel(u);
        Channel* chlast = ServerInstance->FindChan(lcn);
 
        std::string wholine =   initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " +
index 2fb001037565df2c207ba5de8d0b6fdfbf425491..ed4b4b6b618e36f90b6f6d0bfb523724fc53b9b8 100644 (file)
@@ -322,8 +322,8 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ
        if (targetchannel)
        {
                /* Display channel's current mode string */
-               user->WriteNumeric(324, "%s %s +%s",user->nick.c_str(), targetchannel->name, targetchannel->ChanModes(targetchannel->HasUser(user)));
-               user->WriteNumeric(329, "%s %s %lu", user->nick.c_str(), targetchannel->name, (unsigned long)targetchannel->age);
+               user->WriteNumeric(324, "%s %s +%s",user->nick.c_str(), targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user)));
+               user->WriteNumeric(329, "%s %s %lu", user->nick.c_str(), targetchannel->name.c_str(), (unsigned long)targetchannel->age);
                return;
        }
        else if (targetuser)
@@ -414,7 +414,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
 
                                if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
                                {
-                                       user->WriteNumeric(482, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name, *mode++);
+                                       user->WriteNumeric(482, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name.c_str(), *mode++);
                                        mh->DisplayEmptyList(user, targetchannel);
                                        continue;
                                }
@@ -612,7 +612,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
                                                                        {
                                                                                /* Bog off */
                                                                                user->WriteNumeric(482, "%s %s :You must have channel privilege %c or above to %sset channel mode %c",
-                                                                                               user->nick.c_str(), targetchannel->name, needed, adding ? "" : "un", modechar);
+                                                                                               user->nick.c_str(), targetchannel->name.c_str(), needed, adding ? "" : "un", modechar);
                                                                                continue;
                                                                        }
                                                                }
@@ -736,7 +736,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
                        {
                                if (type == MODETYPE_CHANNEL)
                                {
-                                       targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name, output_sequence.c_str(), parameter_list.str().c_str());
+                                       targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
                                        this->LastParse = targetchannel->name;
                                }
                                else
@@ -749,13 +749,13 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user,
                        {
                                if (type == MODETYPE_CHANNEL)
                                {
-                                       targetchannel->WriteChannel(user,"MODE %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str());
+                                       targetchannel->WriteChannel(user, "MODE %s %s%s", targetchannel->name.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
                                        FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, output_sequence + parameter_list.str()));
                                        this->LastParse = targetchannel->name;
                                }
                                else
                                {
-                                       user->WriteTo(targetuser,"MODE %s %s%s",targetuser->nick.c_str(),output_sequence.c_str(), parameter_list.str().c_str());
+                                       user->WriteTo(targetuser, "MODE %s %s%s", targetuser->nick.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
                                        FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence + parameter_list.str()));
                                        this->LastParse = targetuser->nick;
                                }
index 0811538f1ca60bf50d24ef6d4f7d84160638476b..157b3b35c5a08a5747f31eae9b5f953cebf98e0d 100644 (file)
@@ -81,15 +81,15 @@ 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.c_str(), i->set_by.c_str(), (unsigned long)i->set_time);
+               user->WriteServ("367 %s %s %s %s %lu",user->nick.c_str(), channel->name.c_str(), 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);
+       user->WriteServ("368 %s %s :End of channel ban list",user->nick.c_str(), channel->name.c_str());
        return;
 }
 
 void ModeChannelBan::DisplayEmptyList(User* user, Channel* channel)
 {
-       user->WriteServ("368 %s %s :End of channel ban list",user->nick.c_str(), channel->name);
+       user->WriteServ("368 %s %s :End of channel ban list",user->nick.c_str(), channel->name.c_str());
 }
 
 std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan, int, bool servermode)
@@ -110,7 +110,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan
        long maxbans = chan->GetMaxBans();
        if ((unsigned)chan->bans.size() > (unsigned)maxbans)
        {
-               user->WriteServ("478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)",user->nick.c_str(), chan->name,chan->name,maxbans);
+               user->WriteServ("478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)",user->nick.c_str(), chan->name.c_str(), chan->name.c_str(), maxbans);
                dest = "";
                return dest;
        }
index df27c3f506eb9c6dade8206bb3d1273fba11c762..580eee4432fcb42fb7ca238c7283db356a93a3cc 100644 (file)
@@ -125,7 +125,7 @@ std::string ModeChannelHalfOp::AddHalfOp(User *user,const char* dest,Channel *ch
                        {
                                if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
@@ -153,7 +153,7 @@ std::string ModeChannelHalfOp::DelHalfOp(User *user,const char *dest,Channel *ch
                        {
                                if ((user != d) && ((status < STATUS_OP) && (!ServerInstance->ULine(user->server))))
                                {
-                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
index 0ab35b954bcd2fb4ebc34159048fd61422b0fbc5..4d4453d4497b79161dec6aeaa04dce9269eb9c62 100644 (file)
@@ -63,31 +63,31 @@ bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_par
 
 ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
 {
-       if ((channel->modes[CM_KEY] != adding) || (!IS_LOCAL(source)))
+       if ((channel->IsModeSet('k') != adding) || (!IS_LOCAL(source)))
        {
-               if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source)))
+               if (((channel->IsModeSet('k')) && (parameter != channel->key)) && (IS_LOCAL(source)))
                {
                        /* Key is currently set and the correct key wasnt given */
                        return MODEACTION_DENY;
                }
-               else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source))))
+               else if ((!channel->IsModeSet('k')) || ((adding) && (!IS_LOCAL(source))))
                {
                        /* Key isnt currently set */
                        if ((parameter.length()) && (parameter.rfind(' ') == std::string::npos))
                        {
-                               strlcpy(channel->key,parameter.c_str(),32);
-                               channel->modes[CM_KEY] = adding;
+                               channel->key.assign(parameter, 0, 32);
+                               channel->SetMode('k', adding);
                                parameter = channel->key;
                                return MODEACTION_ALLOW;
                        }
                        else
                                return MODEACTION_DENY;
                }
-               else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source))))
+               else if (((channel->IsModeSet('k')) && (parameter == channel->key)) || ((!adding) && (!IS_LOCAL(source))))
                {
                        /* Key is currently set, and correct key was given */
-                       *channel->key = 0;
-                       channel->modes[CM_KEY] = adding;
+                       channel->key.clear();
+                       channel->SetMode('k', adding);
                        return MODEACTION_ALLOW;
                }
                return MODEACTION_DENY;
index fe40adba6af68211f346a5a27fc21b4eda3ee35b..cc555dd3681f94c412a67d1e9655d591a7af3194 100644 (file)
@@ -114,7 +114,7 @@ std::string ModeChannelOp::AddOp(User *user,const char* dest,Channel *chan,int s
                        {
                                if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
@@ -142,7 +142,7 @@ std::string ModeChannelOp::DelOp(User *user,const char *dest,Channel *chan,int s
                        {
                                if ((status < STATUS_OP) && (!ServerInstance->ULine(user->server)) && (IS_LOCAL(user)))
                                {
-                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
index 7feb2efc22dd5520320322c9d2e16014d870db4e..1a04393d9b72461d16d67dc519a8687ee7506e00 100644 (file)
@@ -114,7 +114,7 @@ std::string ModeChannelVoice::AddVoice(User *user,const char* dest,Channel *chan
                        {
                                if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
@@ -142,7 +142,7 @@ std::string ModeChannelVoice::DelVoice(User *user,const char *dest,Channel *chan
                        {
                                if ((status < STATUS_HOP) && (!ServerInstance->ULine(user->server)))
                                {
-                                       user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick.c_str(), chan->name);
+                                       user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick.c_str(), chan->name.c_str());
                                        return "";
                                }
                        }
index 3f7c6371486068d19d3efb12b62c780fb4b8e9d7..eea748db46780cdb0199769f19f7f656661049bb 100644 (file)
@@ -210,13 +210,13 @@ public:
                                {
                                        if(iter->second != chan)
                                        {
-                                               ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name);
+                                               ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name.c_str());
                                        }
                                        idchan.erase(iter);                                     
                                }
                                else
                                {
-                                       ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name);
+                                       ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name.c_str());
                                }
                        }
                        
index 0a1555b29caa702293e4d81b3e754b6edf58a042..28e5a54acb7c5ed893667a81eb2506d88cd32094 100644 (file)
@@ -26,7 +26,7 @@ class AuditoriumMode : public ModeHandler
                {
                        if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP))
                        {
-                               source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +u", source->nick.c_str(), channel->name, adding ? "" : "un");
+                               source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +u", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un");
                                return MODEACTION_DENY;
                        }
                        else
@@ -120,9 +120,9 @@ class ModuleAuditorium : public Module
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
-                       user->WriteFrom(user, "JOIN %s", channel->name);
+                       user->WriteFrom(user, "JOIN %s", channel->name.c_str());
                        if (ShowOps)
-                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "JOIN %s", channel->name);
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "JOIN %s", channel->name.c_str());
                }
        }
 
@@ -132,12 +132,12 @@ class ModuleAuditorium : public Module
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos leaving (but only them of course) */
-                       user->WriteFrom(user, "PART %s%s%s", channel->name,
+                       user->WriteFrom(user, "PART %s%s%s", channel->name.c_str(),
                                        partmessage.empty() ? "" : " :",
                                        partmessage.empty() ? "" : partmessage.c_str());
                        if (ShowOps)
                        {
-                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :",
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "PART %s%s%s", channel->name.c_str(), partmessage.empty() ? "" : " :",
                                                partmessage.empty() ? "" : partmessage.c_str());
                        }
                }
@@ -149,11 +149,11 @@ class ModuleAuditorium : public Module
                {
                        silent = true;
                        /* Send silenced event only to the user being kicked and the user doing the kick */
-                       source->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick.c_str(), reason.c_str());
+                       source->WriteFrom(source, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                        if (ShowOps)
-                               chan->WriteAllExcept(source, false, chan->GetStatus(source) >= STATUS_OP ? 0 : '@', except_list, "KICK %s %s %s", chan->name, user->nick.c_str(), reason.c_str());
+                               chan->WriteAllExcept(source, false, chan->GetStatus(source) >= STATUS_OP ? 0 : '@', except_list, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                        else
-                               user->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick.c_str(), reason.c_str());
+                               user->WriteFrom(source, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                }
        }
 
index 22c7c03b40be5394b39cfe55ff56a944c92bbb56..a8add0c72e78d5f01e4bccd47a79c836d5431ad2 100644 (file)
@@ -64,7 +64,7 @@ class BanRedirect : public ModeWatcher
                
                        if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans)))
                        {
-                               source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name, channel->name, maxbans);
+                               source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans);
                                return false;
                        }
                        
@@ -116,9 +116,9 @@ class BanRedirect : public ModeWatcher
                        {
                                if(Srv->IsChannel(mask[CHAN].c_str()))
                                {
-                                       if(irc::string(channel->name) == irc::string(mask[CHAN].c_str()))
+                                       if (assign(channel->name) == mask[CHAN])
                                        {
-                                               source->WriteNumeric(690, "%s %s :You cannot set a ban redirection to the channel the ban is on", source->nick.c_str(), channel->name);
+                                               source->WriteNumeric(690, "%s %s :You cannot set a ban redirection to the channel the ban is on", source->nick.c_str(), channel->name.c_str());
                                                return false;
                                        }
                                        else
@@ -170,7 +170,7 @@ class BanRedirect : public ModeWatcher
                                }
                                else
                                {
-                                       source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name, mask[CHAN].c_str());
+                                       source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name.c_str(), mask[CHAN].c_str());
                                        return false;
                                }
                        }
@@ -298,12 +298,12 @@ class ModuleBanRedirect : public Module
                                                
                                                if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit))
                                                {
-                                                       user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name);
+                                                       user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
                                                        return 1;
                                                }
                                                else
                                                {
-                                                       user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name);
+                                                       user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
                                                        user->WriteNumeric(470, "%s :You are being automatically redirected to %s", user->nick.c_str(), redir->targetchan.c_str());
                                                        nofollow = true;
                                                        Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time());
index 1fd9717d1aec9f34e548bd6b924fb8854828c980..29e481c1e85777718a4e20fcae07b74effd76d4e 100644 (file)
@@ -86,7 +86,7 @@ public:
                                }
                                if ( ((caps*100)/(int)text.length()) >= percent )
                                {
-                                       user->WriteServ( "404 %s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick.c_str(), c->name, percent, minlen);
+                                       user->WriteServ( "404 %s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick.c_str(), c->name.c_str(), percent, minlen);
                                        return 1;
                                }
                        }
index d48fab5bac10bf74014813fcca365cd5490b4b31..72f41801e00d38ba0e519fc893b8f669cc8293f1 100644 (file)
@@ -63,7 +63,7 @@ class ModuleBlockColour : public Module
                                                case 21:
                                                case 22:
                                                case 31:
-                                                       user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name);
+                                                       user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name.c_str());
                                                        return 1;
                                                break;
                                        }
index 0d73e6bacbc69712c837a7c6ae08b099ecdeb8d5..4ade3e347cd27ec3c3d398d32fbf4f0158a05c26 100644 (file)
@@ -115,7 +115,7 @@ class ModuleCensor : public Module
                        {
                                if (index->second.empty())
                                {
-                                       user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name, index->first.c_str());
+                                       user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str());
                                        return 1;
                                }
                                
index 3ce63567e248465dadcc94bed00a232597da0b38..8633ddc059f5869e337422fee48530751c75e373 100644 (file)
@@ -41,7 +41,7 @@ class ModuleChanCreate : public Module
        virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
        {
                if (channel->GetUserCounter() == 1)
-                       ServerInstance->SNO->WriteToSnoMask('j', "Channel %s created by %s!%s@%s", channel->name, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+                       ServerInstance->SNO->WriteToSnoMask('j', "Channel %s created by %s!%s@%s", channel->name.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str());
        }
 };
 
index ff3e4ca967b0b9b787f2315cf93f126c0b5ae92d..d8066cc278bd69e2f0faab73444ac0a8d7c8e134 100644 (file)
@@ -31,7 +31,7 @@ class ChanFilter : public ListModeBase
        {
                if ((word.length() > 35) || (word.empty()))
                {
-                       user->WriteNumeric(935, "%s %s %s :word is too %s for censor list",user->nick.c_str(), chan->name,word.c_str(), (word.empty() ? "short" : "long"));
+                       user->WriteNumeric(935, "%s %s %s :word is too %s for censor list",user->nick.c_str(), chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long"));
                        return false;
                }
                
@@ -40,18 +40,18 @@ class ChanFilter : public ListModeBase
        
        virtual bool TellListTooLong(User* user, Channel* chan, std::string &word)
        {
-               user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full",user->nick.c_str(), chan->name, word.c_str());
+               user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full", user->nick.c_str(), chan->name.c_str(), word.c_str());
                return true;
        }
        
        virtual void TellAlreadyOnList(User* user, Channel* chan, std::string &word)
        {
-               user->WriteNumeric(937, "%s %s :The word %s is already on the spamfilter list",user->nick.c_str(), chan->name,word.c_str());
+               user->WriteNumeric(937, "%s %s :The word %s is already on the spamfilter list",user->nick.c_str(), chan->name.c_str(), word.c_str());
        }
        
        virtual void TellNotSet(User* user, Channel* chan, std::string &word)
        {
-               user->WriteNumeric(938, "%s %s :No such spamfilter word is set",user->nick.c_str(), chan->name);
+               user->WriteNumeric(938, "%s %s :No such spamfilter word is set",user->nick.c_str(), chan->name.c_str());
        }
 };
 
@@ -101,7 +101,7 @@ class ModuleChanFilter : public Module
                        {
                                if (line.find(i->mask.c_str()) != std::string::npos)
                                {
-                                       user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked",user->nick.c_str(), chan->name, i->mask.c_str());
+                                       user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked",user->nick.c_str(), chan->name.c_str(), i->mask.c_str());
                                        return 1;
                                }
                        }
index 5070f190a7cac59b4b70fc31e57f05891ba07c6c..9e09b7cf34032a3ce009808dd303cf47f881e027 100644 (file)
@@ -40,7 +40,7 @@ class ChannelLogStream : public LogStream
                        char buf[MAXBUF];
                        snprintf(buf, MAXBUF, "\2%s\2: %s", type.c_str(), msg.c_str());
 
-                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name, buf);
+                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name.c_str(), buf);
                        ServerInstance->PI->SendChannelPrivmsg(c, 0, buf);
                        Logging = false;
                }
index 9363bac4be70d12e3f4b4402c0f9d294794170d6..e44e496f8f5bdb0ae326ad319278e913d8b92f34 100644 (file)
@@ -103,10 +103,10 @@ class FounderProtectBase
                {
                        if (i->first->GetExt(item))
                        {
-                               user->WriteServ("%d %s %s %s", list, user->nick.c_str(), channel->name,i->first->nick.c_str());
+                               user->WriteServ("%d %s %s %s", list, user->nick.c_str(), channel->name.c_str(), i->first->nick.c_str());
                        }
                }
-               user->WriteServ("%d %s %s :End of channel %s list", end, user->nick.c_str(), channel->name, type.c_str());
+               user->WriteServ("%d %s %s :End of channel %s list", end, user->nick.c_str(), channel->name.c_str(), type.c_str());
        }
 
        User* FindAndVerify(std::string &parameter, Channel* channel)
@@ -206,7 +206,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
                else
                {
                        // whoops, someones being naughty!
-                       source->WriteNumeric(468, "%s %s :Only servers may set channel mode +q",source->nick.c_str(), channel->name);
+                       source->WriteNumeric(468, "%s %s :Only servers may set channel mode +q", source->nick.c_str(), channel->name.c_str());
                        parameter.clear();
                        return MODEACTION_DENY;
                }
@@ -273,7 +273,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase
                else
                {
                        // bzzzt, wrong answer!
-                       source->WriteNumeric(482, "%s %s :You are not a channel founder",source->nick.c_str(), channel->name);
+                       source->WriteNumeric(482, "%s %s :You are not a channel founder", source->nick.c_str(), channel->name.c_str());
                        return MODEACTION_DENY;
                }
        }
@@ -388,7 +388,7 @@ class ModuleChanProtect : public Module
                // will appear in the names list for the user.. remove if desired -Special
 
                if (FirstInGetsFounder && channel->GetUserCounter() == 1)
-                       user->WriteServ("MODE %s +q %s", channel->name, user->nick.c_str());
+                       user->WriteServ("MODE %s +q %s", channel->name.c_str(), user->nick.c_str());
        }
        
        virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
@@ -408,8 +408,8 @@ class ModuleChanProtect : public Module
                if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
                        return ACR_ALLOW;
 
-               std::string founder = "cm_founder_"+std::string(channel->name);
-               std::string protect = "cm_protect_"+std::string(channel->name);
+               std::string founder("cm_founder_"+channel->name);
+               std::string protect("cm_protect_"+channel->name);
 
                switch (access_type)
                {
@@ -417,12 +417,12 @@ class ModuleChanProtect : public Module
                        case AC_DEOP:
                                if (dest->GetExt(founder))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't deop "+dest->nick+" as they're a channel founder");
                                        return ACR_DENY;
                                }
                                if ((dest->GetExt(protect)) && (!source->GetExt(protect)))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're protected (+a)");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't deop "+dest->nick+" as they're protected (+a)");
                                        return ACR_DENY;
                                }
                        break;
@@ -431,12 +431,12 @@ class ModuleChanProtect : public Module
                        case AC_KICK:
                                if (dest->GetExt(founder))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't kick "+dest->nick+" as they're a channel founder");
                                        return ACR_DENY;
                                }
                                if ((dest->GetExt(protect)) && (!source->GetExt(protect)))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're protected (+a)");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't kick "+dest->nick+" as they're protected (+a)");
                                        return ACR_DENY;
                                }
                        break;
@@ -445,12 +445,12 @@ class ModuleChanProtect : public Module
                        case AC_DEHALFOP:
                                if (dest->GetExt(founder))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're a channel founder");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't de-halfop "+dest->nick+" as they're a channel founder");
                                        return ACR_DENY;
                                }
                                if ((dest->GetExt(protect)) && (!source->GetExt(protect)))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're protected (+a)");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't de-halfop "+dest->nick+" as they're protected (+a)");
                                        return ACR_DENY;
                                }
                        break;
@@ -459,12 +459,12 @@ class ModuleChanProtect : public Module
                        case AC_DEVOICE:
                                if (dest->GetExt(founder))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're a channel founder");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't devoice "+dest->nick+" as they're a channel founder");
                                        return ACR_DENY;
                                }
                                if ((dest->GetExt(protect)) && (!source->GetExt(protect)))
                                {
-                                       source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're protected (+a)");
+                                       source->WriteNumeric(484, source->nick+" "+channel->name+" :Can't devoice "+dest->nick+" as they're protected (+a)");
                                        return ACR_DENY;
                                }
                        break;
index 80be98223b5a703397a9b4b766fca03ae126d1b8..be57f8af1a9b1b30275128109be6ab2c45a6bc6c 100644 (file)
@@ -69,7 +69,7 @@ class CommandCycle : public Command
                }
                else
                {
-                       user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick.c_str(), channel->name);
+                       user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick.c_str(), channel->name.c_str());
                }
 
                return CMD_FAILURE;
index e8c51d79ab1507dfffedee9c9a3aa24070b4ebcb..20255abf63f405360a4595761b39c56001379a61 100644 (file)
@@ -29,7 +29,7 @@ class DelayJoinMode : public ModeHandler
                {
                        if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP))
                        {
-                               source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +D", source->nick.c_str(), channel->name, adding ? "" : "un");
+                               source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +D", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un");
                                return MODEACTION_DENY;
                        }
                        else
@@ -104,10 +104,10 @@ class ModuleDelayJoin : public Module
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
-                       user->WriteFrom(user, "JOIN %s", channel->name);
+                       user->WriteFrom(user, "JOIN %s", channel->name.c_str());
 
                        /* This metadata tells the module the user is delayed join on this specific channel */
-                       user->Extend(std::string("delayjoin_")+channel->name);
+                       user->Extend("delayjoin_"+channel->name);
 
                        /* This metadata tells the module the user is delayed join on at least one (or more) channels.
                         * It is only cleared when the user is no longer on ANY +D channels.
@@ -121,11 +121,11 @@ class ModuleDelayJoin : public Module
        {
                if (channel->IsModeSet('D'))
                {
-                       if (user->GetExt(std::string("delayjoin_")+channel->name))
+                       if (user->GetExt("delayjoin_"+channel->name))
                        {
                                silent = true;
                                /* Because we silenced the event, make sure it reaches the user whos leaving (but only them of course) */
-                               user->WriteFrom(user, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :", partmessage.empty() ? "" : partmessage.c_str());
+                               user->WriteFrom(user, "PART %s%s%s", channel->name.c_str(), partmessage.empty() ? "" : " :", partmessage.empty() ? "" : partmessage.c_str());
                        }
                }
        }
@@ -135,10 +135,10 @@ class ModuleDelayJoin : public Module
                if (chan->IsModeSet('D'))
                {
                        /* Send silenced event only to the user being kicked and the user doing the kick */
-                       if (user->GetExt(std::string("delayjoin_")+chan->name))
+                       if (user->GetExt("delayjoin_"+chan->name))
                        {
                                silent = true;
-                               user->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick.c_str(), reason.c_str());
+                               user->WriteFrom(source, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                        }
                }
        }
@@ -169,18 +169,18 @@ class ModuleDelayJoin : public Module
 
                Channel* channel = (Channel*) dest;
 
-               if (!user->GetExt(std::string("delayjoin_")+channel->name))
+               if (!user->GetExt("delayjoin_"+channel->name))
                        return;
 
                /* Display the join to everyone else (the user who joined got it earlier) */
-               this->WriteCommonFrom(user, channel, "JOIN %s", channel->name);
+               this->WriteCommonFrom(user, channel, "JOIN %s", channel->name.c_str());
 
                std::string n = this->ServerInstance->Modes->ModeString(user, channel);
                if (n.length() > 0)
-                       this->WriteCommonFrom(user, channel, "MODE %s +%s", channel->name, n.c_str());
+                       this->WriteCommonFrom(user, channel, "MODE %s +%s", channel->name.c_str(), n.c_str());
 
                /* Shrink off the neccessary metadata for a specific channel */
-               user->Shrink(std::string("delayjoin_")+channel->name);
+               user->Shrink("delayjoin_"+channel->name);
 
                /* Check if the user is left on any other +D channels, if so don't take away the
                 * metadata that says theyre on one or more channels 
index 59b4c6ff44b21b8e7bc317dba94cb63f6ba376f1..32e09ab57d836a2f09c33b08820606603a65c424 100644 (file)
@@ -100,7 +100,7 @@ class InvisibleMode : public ModeHandler
                                CUList *ulist = f->first->GetUsers();
                                char tb[MAXBUF];
 
-                               snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost().c_str(), adding ? "PART" : "JOIN", f->first->name);
+                               snprintf(tb,MAXBUF,":%s %s %s", dest->GetFullHost().c_str(), adding ? "PART" : "JOIN", f->first->name.c_str());
                                std::string out = tb;
                                std::string n = this->ServerInstance->Modes->ModeString(dest, f->first);
 
@@ -111,7 +111,7 @@ class InvisibleMode : public ModeHandler
                                        {
                                                i->first->Write(out);
                                                if (!n.empty() && !adding)
-                                                       i->first->WriteServ("MODE %s +%s", f->first->name, n.c_str());
+                                                       i->first->WriteServ("MODE %s +%s", f->first->name.c_str(), n.c_str());
                                        }
                                }
                        }
@@ -194,8 +194,8 @@ class ModuleInvisible : public Module
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
-                       this->WriteCommonFrom(user, channel, "JOIN %s", channel->name);
-                       ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost().c_str(), channel->name);
+                       this->WriteCommonFrom(user, channel, "JOIN %s", channel->name.c_str());
+                       ServerInstance->SNO->WriteToSnoMask('A', "\2NOTICE\2: Oper %s has joined %s invisibly (+Q)", user->GetFullHost().c_str(), channel->name.c_str());
                }
        }
 
@@ -211,7 +211,7 @@ class ModuleInvisible : public Module
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos leaving (but only them of course) */
-                       this->WriteCommonFrom(user, channel, "PART %s%s%s", channel->name,
+                       this->WriteCommonFrom(user, channel, "PART %s%s%s", channel->name.c_str(),
                                        partmessage.empty() ? "" : " :",
                                        partmessage.empty() ? "" : partmessage.c_str());
                }
index 4a92c996ec11f547f55209c78c5a282c5575beb7..f6f58f0dc0ba383c44974a175e3ab65a2bec3a8f 100644 (file)
@@ -135,7 +135,7 @@ class JoinFlood : public ModeHandler
                                int nsecs = atoi(secs);
                                if ((njoins<1) || (nsecs<1))
                                {
-                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                        parameter.clear();
                                        return MODEACTION_DENY;
                                }
@@ -184,7 +184,7 @@ class JoinFlood : public ModeHandler
                        }
                        else
                        {
-                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                return MODEACTION_DENY;
                        }
                }
@@ -231,7 +231,7 @@ class ModuleJoinFlood : public Module
                        {
                                if (f->islocked())
                                {
-                                       user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick.c_str(),chan->name);
+                                       user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick.c_str(),chan->name.c_str());
                                        return 1;
                                }
                        }
@@ -255,7 +255,7 @@ class ModuleJoinFlood : public Module
                        {
                                f->clear();
                                f->lock();
-                               channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", channel->name, f->joins, f->secs);
+                               channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", channel->name.c_str(), f->joins, f->secs);
                        }
                }
        }
index 1e7513eb1a2b238a4b164591b04901bbe6981305..fba478d011afba1a1d0ad2c04a6c8e81807a9e41 100644 (file)
@@ -145,7 +145,7 @@ public:
                                        {
                                                if (iter->first == user)                                        
                                                {
-                                                       user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick.c_str(), chan->name);
+                                                       user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick.c_str(), chan->name.c_str());
                                                        return 1;
                                                }
                                        }
index 07b898110e3ab9b59b370527f1f1fcee34a0ebe6..12dc1c79694b8c876eb5ad22ee4dd038cf544ce4 100644 (file)
@@ -40,19 +40,19 @@ class CommandKnock : public Command
 
                if (c->HasUser(user))
                {
-                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick.c_str(), c->name);
+                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
 
                if (c->IsModeSet('K'))
                {
-                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick.c_str(), c->name);
+                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
 
                if (!c->modes[CM_INVITEONLY])
                {
-                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick.c_str(), c->name);
+                       user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
 
@@ -62,8 +62,8 @@ class CommandKnock : public Command
                }
                line = line + parameters[parameters.size()-1];
 
-               c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName,  "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick.c_str(), c->name, line.c_str());
-               user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick.c_str(),c->name);
+               c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName,  "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name.c_str(), user->nick.c_str(), c->name.c_str(), line.c_str());
+               user->WriteServ("NOTICE %s :KNOCKing on %s", user->nick.c_str(), c->name.c_str());
                return CMD_SUCCESS;
        }
 };
index d6820b8ad6b30113170bdfbcce0a58d484dad0c5..b0065f0658bc49ce5161ae640e57c1adc6a033dd 100644 (file)
@@ -131,7 +131,7 @@ class MsgFlood : public ModeHandler
                                int nsecs = atoi(secs);
                                if ((nlines<1) || (nsecs<1))
                                {
-                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                        parameter.clear();
                                        return MODEACTION_DENY;
                                }
@@ -177,7 +177,7 @@ class MsgFlood : public ModeHandler
                        }
                        else
                        {
-                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                parameter.clear();
                                return MODEACTION_DENY;
                        }
index 2eb631fb2aae42731c5f29249a91e49653891d2b..3e811da93fa0f7eff692b897b7000ee4958a1a17 100644 (file)
@@ -135,7 +135,7 @@ class NickFlood : public ModeHandler
                                int nsecs = atoi(secs);
                                if ((nnicks<1) || (nsecs<1))
                                {
-                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                        parameter.clear();
                                        return MODEACTION_DENY;
                                }
@@ -184,7 +184,7 @@ class NickFlood : public ModeHandler
                        }
                        else
                        {
-                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name);
+                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
                                return MODEACTION_DENY;
                        }
                }
@@ -238,7 +238,7 @@ class ModuleNickFlood : public Module
 
                                if (f->islocked())
                                {
-                                       user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick.c_str(), channel->name, f->nicks, f->secs);
+                                       user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick.c_str(), channel->name.c_str(), f->nicks, f->secs);
                                        return 1;
                                }
 
@@ -247,7 +247,7 @@ class ModuleNickFlood : public Module
                                {
                                        f->clear();
                                        f->lock();
-                                       channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name, f->nicks, f->secs);
+                                       channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name.c_str(), f->nicks, f->secs);
                                        return 1;
                                }
                        }
index 3a9b1c9c2ac07fa62d16d41a63be6260c0748e7d..55777169714a858defa98bc05c7f3afba4630454 100644 (file)
@@ -84,7 +84,7 @@ class ModuleNoCTCP : public Module
                                {
                                        if (strncmp(text.c_str(),"\1ACTION ",8))
                                        {
-                                               user->WriteNumeric(492, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name);
+                                               user->WriteNumeric(492, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str());
                                                return 1;
                                        }
                                }
index dde96383f4e76114c677fdfae62ca732a8034cec..0d6c56d99f70305f37a73f328673cb24ce553e17 100644 (file)
@@ -40,7 +40,7 @@ class ModuleNoInvite : public Module
        {
                if (channel->IsModeSet('V'))
                {
-                       user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name, dest->nick.c_str());
+                       user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
                        return 1;
                }
                return 0;
index dbfa0c2eab71fcd1af25835fb3dbff40b8d3fc3a..74701795ba6043cb7a29424beba5c06af5669e3f 100644 (file)
@@ -54,7 +54,7 @@ class ModuleNoKicks : public Module
                                else
                                {
                                        // nobody else can (not even opers with override, and founders)
-                                       source->WriteNumeric(484, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name,dest->nick.c_str());
+                                       source->WriteNumeric(484, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str());
                                        return ACR_DENY;
                                }
                        }
index c6301d19debceb355c54e102d29220b991689d6f..0e5e967bd6d398e4f9239721011958f464bfe9fa 100644 (file)
@@ -85,7 +85,7 @@ class ModuleNoNickChange : public Module
                                        if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetStatus(user) == STATUS_OP)
                                                continue;
 
-                                       user->WriteNumeric(447, "%s :Can't change nickname while on %s (+N is set)", user->nick.c_str(), curr->name);
+                                       user->WriteNumeric(447, "%s :Can't change nickname while on %s (+N is set)", user->nick.c_str(), curr->name.c_str());
                                        return 1;
                                }
                        }
index 920a0d134b0ba42fabffbe10346982936d68d78a..bb5e6222922667535a1d2b46c60e546c7895bb0d 100644 (file)
@@ -58,7 +58,7 @@ class ModuleNoNotice : public Module
                                }
                                else
                                {
-                                       user->WriteNumeric(404, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name);
+                                       user->WriteNumeric(404, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
                                        return 1;
                                }
                        }
index 148528174b1bf472bd237e26e4e2200e1895953a..4600760f2c35cf62e8d1d144208bece8ea874836 100644 (file)
@@ -69,7 +69,7 @@ class ModuleOperChans : public Module
                        {
                                if (chan->IsModeSet('O'))
                                {
-                                       user->WriteNumeric(520, "%s %s :Only IRC operators may join the channel %s (+O is set)",user->nick.c_str(), chan->name,chan->name);
+                                       user->WriteNumeric(520, "%s %s :Only IRC operators may join the channel %s (+O is set)",user->nick.c_str(), chan->name.c_str(), chan->name.c_str());
                                        return 1;
                                }
                        }
index 8cbc1836ddb49963b4edc178f5197db376fae858..1cdf398279b534c374f38368fe58d8f07e783c91 100644 (file)
@@ -236,7 +236,7 @@ class ModuleOverride : public Module
                        {
                                if ((chan->modes[CM_INVITEONLY]) && (CanOverride(user,"INVITE")))
                                {
-                                       irc::string x = chan->name;
+                                       irc::string x(chan->name.c_str());
                                        if (!user->IsInvited(x))
                                        {
                                                if (RequireKey && keygiven != "override")
@@ -248,12 +248,12 @@ class ModuleOverride : public Module
 
                                                if (NoisyOverride)
                                                        chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass invite-only", cname, user->nick.c_str());
-                                               ServerInstance->SNO->WriteToSnoMask('O',std::string(user->nick)+" used oper override to bypass +i on "+std::string(cname));
+                                               ServerInstance->SNO->WriteToSnoMask('O', user->nick+" used oper override to bypass +i on "+std::string(cname));
                                        }
                                        return -1;
                                }
                                
-                               if ((*chan->key) && (CanOverride(user,"KEY")) && strcasecmp(keygiven.c_str(), chan->key))
+                               if ((chan->key.empty()) && (CanOverride(user,"KEY")) && keygiven != chan->key)
                                {
                                        if (RequireKey && keygiven != "override")
                                        {
@@ -264,7 +264,7 @@ class ModuleOverride : public Module
 
                                        if (NoisyOverride)
                                                chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel key", cname, user->nick.c_str());
-                                       ServerInstance->SNO->WriteToSnoMask('O',std::string(user->nick)+" used oper override to bypass +k on "+std::string(cname));
+                                       ServerInstance->SNO->WriteToSnoMask('O', user->nick+" used oper override to bypass +k on "+std::string(cname));
                                        return -1;
                                }
                                        
@@ -279,7 +279,7 @@ class ModuleOverride : public Module
 
                                        if (NoisyOverride)
                                                chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel limit", cname, user->nick.c_str());
-                                       ServerInstance->SNO->WriteToSnoMask('O',std::string(user->nick)+" used oper override to bypass +l on "+std::string(cname));
+                                       ServerInstance->SNO->WriteToSnoMask('O', user->nick+" used oper override to bypass +l on "+std::string(cname));
                                        return -1;
                                }
 
index 2a7ef4b549d58e5116ee966c4178a6d1aade174d..289a73dcacb2723707e3338cfc2a9889b37ef6da 100644 (file)
@@ -65,9 +65,9 @@ class Redirect : public ModeHandler
                                        {
                                                for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++)
                                                {
-                                                       if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name)))
+                                                       if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == channel->name))
                                                        {
-                                                               source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick.c_str(),parameter.c_str(),i->second->name);
+                                                               source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick.c_str(), parameter.c_str(), i->second->name.c_str());
                                                                return MODEACTION_DENY;
                                                        }
                                                }
index 9450899ed73ad9bf10b1ff2c0ae61396685069af..f0eff03cab0dd9bf08a2bfb7eb65a93dd493ba4e 100644 (file)
@@ -105,7 +105,7 @@ class RemoveBase
 
                if (!channel->HasUser(target))
                {
-                       user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick.c_str(), target->nick.c_str(), channel->name);
+                       user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick.c_str(), target->nick.c_str(), channel->name.c_str());
                        return CMD_FAILURE;
                }       
                
@@ -177,22 +177,22 @@ class RemoveBase
                                /* Build up the part reason string. */
                                reason = std::string("Removed by ") + user->nick + ": " + reasonparam;
 
-                               channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name, user->nick.c_str(), target->nick.c_str());
-                               target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick.c_str(), user->nick.c_str(), channel->name, reasonparam.c_str());
+                               channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name.c_str(), user->nick.c_str(), target->nick.c_str());
+                               target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick.c_str(), user->nick.c_str(), channel->name.c_str(), reasonparam.c_str());
 
                                if (!channel->PartUser(target, reason.c_str()))
                                        delete channel;
                        }
                        else
                        {
-                               user->WriteServ( "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick.c_str(), target->nick.c_str(), channel->name);
+                               user->WriteServ( "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick.c_str(), target->nick.c_str(), channel->name.c_str());
                                return CMD_FAILURE;
                        }
                }
                else
                {
                        /* m_nokicks.so was loaded and +Q was set, block! */
-                       user->WriteServ( "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick.c_str(), channel->name, target->nick.c_str());
+                       user->WriteServ( "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick.c_str(), channel->name.c_str(), target->nick.c_str());
                        return CMD_FAILURE;
                }
 
index 007e6f8900c0d2070ce5ba64f0f3901eb8f3edf0..e6bb24442de3620b61ae21d4159b63cda19041cd 100644 (file)
@@ -185,7 +185,7 @@ class ModuleSafeList : public Module
 
                                if ((chan) && (chan->modes[CM_PRIVATE]) && (!IS_OPER(user)))
                                {
-                                       bool display = (match(chan->name, ld->glob) || (*chan->topic && match(chan->topic, ld->glob)));
+                                       bool display = (match(chan->name, ld->glob) || (!chan->topic.empty() && match(chan->topic, ld->glob)));
                                        if ((users) && (display))
                                        {
                                                int counter = snprintf(buffer, MAXBUF, "322 %s * %ld :", user->nick.c_str(), users);
@@ -193,12 +193,12 @@ class ModuleSafeList : public Module
                                                user->WriteServ(std::string(buffer));
                                        }
                                }
-                               else if ((chan) && ((((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET])))) || (has_user) || IS_OPER(user)))
+                               else if ((chan) && ((((!(chan->IsModeSet('p'))) && (!(chan->IsModeSet('s'))))) || (has_user) || IS_OPER(user)))
                                {
-                                       bool display = (match(chan->name, ld->glob) || (*chan->topic && match(chan->topic, ld->glob)));
+                                       bool display = (match(chan->name, ld->glob) || (!chan->topic.empty() && match(chan->topic, ld->glob)));
                                        if ((users) && (display))
                                        {
-                                               int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s",user->nick.c_str(), chan->name, users, chan->ChanModes(has_user || IS_OPER(user)), chan->topic);
+                                               int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s", user->nick.c_str(), chan->name.c_str(), users, chan->ChanModes(has_user || IS_OPER(user)), chan->topic.c_str());
                                                amount_sent += counter + ServerNameSize;
                                                user->WriteServ(std::string(buffer));
                                        }
index 92c9c6d3ad376d775797e2adfb17aa1e8f9dc52d..2ea856db2afeab2cb55f67a216b256eb323ec840 100644 (file)
@@ -165,7 +165,7 @@ class ModuleServices : public Module
                                        return 0;
                                }
                                // user messaging a +M channel and is not registered
-                               user->WriteNumeric(477, "%s %s :You need a registered nickname to speak on this channel", user->nick.c_str(), c->name);
+                               user->WriteNumeric(477, "%s %s :You need a registered nickname to speak on this channel", user->nick.c_str(), c->name.c_str());
                                return 1;
                        }
                }
@@ -206,7 +206,7 @@ class ModuleServices : public Module
                                                return 0;
                                        }
                                        // joining a +R channel and not identified
-                                       user->WriteNumeric(477, "%s %s :You need a registered nickname to join this channel", user->nick.c_str(), chan->name);
+                                       user->WriteNumeric(477, "%s %s :You need a registered nickname to join this channel", user->nick.c_str(), chan->name.c_str());
                                        return 1;
                                }
                        }
index 630aab946727e7a01e739c7b145361b80c1c42f3..985c86143272bcfbaff6546096eaa2b49216b7c1 100644 (file)
@@ -95,7 +95,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
        {
                std::deque<std::string> param_list;
                if (Utils->AnnounceTSChange && chan)
-                       chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name, chan->name, (unsigned long) ourTS, (unsigned long) TS);
+                       chan->WriteChannelWithServ(Instance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), chan->name.c_str(), (unsigned long) ourTS, (unsigned long) TS);
                ourTS = TS;
                if (!created)
                {
index 80854f3b12bbe685182001a3a155573fd7f16d15..3ea77511242a7dc9376c138849c01c13e1607a40 100644 (file)
@@ -31,11 +31,11 @@ bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> &
        Channel* c = this->Instance->FindChan(params[0]);
        if (c)
        {
-               if ((ts >= c->topicset) || (!*c->topic))
+               if ((ts >= c->topicset) || (c->topic.empty()))
                {
                        std::string oldtopic = c->topic;
-                       strlcpy(c->topic,params[3].c_str(),MAXTOPIC);
-                       strlcpy(c->setby,params[2].c_str(),127);
+                       c->topic.assign(params[3], 0, MAXTOPIC);
+                       c->setby.assign(params[2], 0, 127);
                        c->topicset = ts;
                        /* if the topic text is the same as the current topic,
                         * dont bother to send the TOPIC command out, just silently
@@ -46,11 +46,11 @@ bool TreeSocket::ForceTopic(const std::string &source, std::deque<std::string> &
                                User* user = this->Instance->FindNick(source);
                                if (!user)
                                {
-                                       c->WriteChannelWithServ(Instance->Config->ServerName, "TOPIC %s :%s", c->name, c->topic);
+                                       c->WriteChannelWithServ(Instance->Config->ServerName, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
                                }
                                else
                                {
-                                       c->WriteChannel(user, "TOPIC %s :%s", c->name, c->topic);
+                                       c->WriteChannel(user, "TOPIC %s :%s", c->name.c_str(), c->topic.c_str());
                                        nsource = user->server;
                                }
                        }
index 40718cedb34deaf2d72aa2817af8b5fe65fcdde9..8444bbec64a8b67201b4f1400b64415c1ea73389 100644 (file)
@@ -85,7 +85,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
        char list[MAXBUF];
 
        size_t dlen, curlen;
-       dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s",this->Instance->Config->GetSID().c_str(),c->name,(unsigned long)c->age, c->ChanModes(true));
+       dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(),(unsigned long)c->age, c->ChanModes(true));
        int numusers = 0;
        char* ptr = list + dlen;
        bool looped_once = false;
@@ -109,7 +109,7 @@ void TreeSocket::SendFJoins(TreeServer* Current, Channel* c)
                if (curlen > (480-NICKMAX))
                {
                        buffer.append(list).append("\r\n");
-                       dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s",this->Instance->Config->GetSID().c_str(),c->name,(unsigned long)c->age, c->ChanModes(true));
+                       dlen = curlen = snprintf(list,MAXBUF,":%s FJOIN %s %lu +%s", this->Instance->Config->GetSID().c_str(), c->name.c_str(), (unsigned long)c->age, c->ChanModes(true));
                        ptr = list + dlen;
                        ptrlen = 0;
                        numusers = 0;
@@ -193,9 +193,9 @@ void TreeSocket::SendChannelModes(TreeServer* Current)
        for (chan_hash::iterator c = this->Instance->chanlist->begin(); c != this->Instance->chanlist->end(); c++)
        {
                SendFJoins(Current, c->second);
-               if (*c->second->topic)
+               if (!c->second->topic.empty())
                {
-                       snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s",sn,c->second->name,(unsigned long)c->second->topicset,c->second->setby,c->second->topic);
+                       snprintf(data,MAXBUF,":%s FTOPIC %s %lu %s :%s", sn, c->second->name.c_str(), (unsigned long)c->second->topicset, c->second->setby.c_str(), c->second->topic.c_str());
                        this->WriteLine(data);
                }
                FOREACH_MOD_I(this->Instance,I_OnSyncChannel,OnSyncChannel(c->second,(Module*)Utils->Creator,(void*)this));
index 5b2ea865a17bfb858e5db5d22ee427c18d483dbe..cd49001a5a8a911ba1c5e2c1d713d1d6a68a7027 100644 (file)
@@ -54,7 +54,7 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string
                        if (s)
                        {
                                FOREACH_MOD_I(Instance, I_OnText, OnText(NULL, channel, TYPE_CHANNEL, text, status, except_list));
-                               channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name, text.c_str());
+                               channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str());
                        }
                }
                else
index e8a40e844fa1f73f081cb9e007c27b48dd828a31..5a0298b41e2e086e9b894b53506ddbe201d37aff 100644 (file)
@@ -37,7 +37,7 @@ class SSLMode : public ModeHandler
                                        {
                                                if(!i->first->GetExt("ssl", dummy))
                                                {
-                                                       source->WriteNumeric(490, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name);
+                                                       source->WriteNumeric(490, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str());
                                                        return MODEACTION_DENY;
                                                }
                                        }
index 13f9301d2048c5a140ad6df97e5ee67f42bf96b1..a2eda3112a46a5e900b814874195b06a3fe06272 100644 (file)
@@ -90,14 +90,14 @@ class CommandTban : public Command
                                        T.mask = mask;
                                        T.expire = expire;
                                        TimedBanList.push_back(T);
-                                       channel->WriteAllExcept(user, true, '@', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name, user->nick.c_str(), mask.c_str(), duration);
+                                       channel->WriteAllExcept(user, true, '@', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration);
                                        if (ServerInstance->Config->AllowHalfop)
-                                               channel->WriteAllExcept(user, true, '%', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name, user->nick.c_str(), mask.c_str(), duration);
+                                               channel->WriteAllExcept(user, true, '%', tmp, "NOTICE %s :%s added a timed ban on %s lasting for %ld seconds.", channel->name.c_str(), user->nick.c_str(), mask.c_str(), duration);
                                        return CMD_SUCCESS;
                                }
                                return CMD_FAILURE;
                        }
-                       else user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick.c_str(), channel->name,
+                       else user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick.c_str(), channel->name.c_str(),
                                        ServerInstance->Config->AllowHalfop ? " half-" : " channel ");
                        return CMD_FAILURE;
                }
@@ -129,7 +129,7 @@ class ModuleTimedBans : public Module
        virtual int OnDelBan(User* source, Channel* chan, const std::string &banmask)
        {
                irc::string listitem = banmask.c_str();
-               irc::string thischan = chan->name;
+               irc::string thischan = chan->name.c_str();
                for (timedbans::iterator i = TimedBanList.begin(); i < TimedBanList.end(); i++)
                {
                        irc::string target = i->mask.c_str();
@@ -164,9 +164,9 @@ class ModuleTimedBans : public Module
                                        setban.push_back(mask);
 
                                        CUList empty;
-                                       cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, safei->mask.c_str());
+                                       cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.c_str());
                                        if (ServerInstance->Config->AllowHalfop)
-                                               cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, safei->mask.c_str());
+                                               cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name.c_str(), safei->mask.c_str());
 
                                        /* Removes the ban item for us, no ::erase() needed */
                                        ServerInstance->PI->SendModeStr(safei->channel, std::string("-b ") + setban[2]);
index ed65ce96477f4624150b3ae3a9f6a03ea200847f..d87caea9d7ac3bf7488f4b6cdbf87287fdd1709d 100644 (file)
@@ -50,29 +50,29 @@ class CommandUninvite : public Command
                {
                        if (c->GetStatus(user) < STATUS_HOP)
                        {
-                               user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick.c_str(), c->name,
+                               user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick.c_str(), c->name.c_str(),
                                                ServerInstance->Config->AllowHalfop ? " half-" : " channel ");
                                return CMD_FAILURE;
                        }
                }
 
-               irc::string xname(c->name);
+               irc::string xname(c->name.c_str());
 
                if (!u->IsInvited(xname))
                {
-                       user->WriteNumeric(491, "%s %s %s :Is not invited to channel %s",user->nick.c_str(),u->nick.c_str(),c->name,c->name);
+                       user->WriteNumeric(491, "%s %s %s :Is not invited to channel %s", user->nick.c_str(), u->nick.c_str(), c->name.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
                if (!c->HasUser(user))
                {
-                       user->WriteNumeric(492, "%s %s :You're not on that channel!",user->nick.c_str(), c->name);
+                       user->WriteNumeric(492, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str());
                        return CMD_FAILURE;
                }
 
                u->RemoveInvite(xname);
-               user->WriteNumeric(494, "%s %s %s :Uninvited",user->nick.c_str(),c->name,u->nick.c_str());
-               u->WriteNumeric(493, "%s :You were uninvited from %s by %s",u->nick.c_str(),c->name,user->nick.c_str());
-               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick.c_str(), u->nick.c_str());
+               user->WriteNumeric(494, "%s %s %s :Uninvited", user->nick.c_str(), c->name.c_str(), u->nick.c_str());
+               u->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str());
+               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
 
                return CMD_SUCCESS;
        }
index 45052e8cb60ca28302339b59f534f14a1c734a18..5ec1417185f9f1225cbe4d3114aaa01192918437 100644 (file)
@@ -1552,10 +1552,10 @@ bool User::ChangeDisplayedHost(const char* shost)
        {
                for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++)
                {
-                       i->first->WriteAllExceptSender(this, false, 0, "JOIN %s", i->first->name);
+                       i->first->WriteAllExceptSender(this, false, 0, "JOIN %s", i->first->name.c_str());
                        std::string n = this->ServerInstance->Modes->ModeString(this, i->first);
                        if (n.length() > 0)
-                               i->first->WriteAllExceptSender(this, true, 0, "MODE %s +%s", i->first->name, n.c_str());
+                               i->first->WriteAllExceptSender(this, true, 0, "MODE %s +%s", i->first->name.c_str(), n.c_str());
                }
        }
 
@@ -1581,10 +1581,10 @@ bool User::ChangeIdent(const char* newident)
        {
                for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++)
                {
-                       i->first->WriteAllExceptSender(this, false, 0, "JOIN %s", i->first->name);
+                       i->first->WriteAllExceptSender(this, false, 0, "JOIN %s", i->first->name.c_str());
                        std::string n = this->ServerInstance->Modes->ModeString(this, i->first);
                        if (n.length() > 0)
-                               i->first->WriteAllExceptSender(this, true, 0, "MODE %s +%s", i->first->name, n.c_str());
+                               i->first->WriteAllExceptSender(this, true, 0, "MODE %s +%s", i->first->name.c_str(), n.c_str());
                }
        }