/** 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
/** 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.
/** 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.
/** 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.
*/
{
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.
/* 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 = "";
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)
}
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;
}
}
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)
{
{
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;
}
}
{
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;
}
}
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);
}
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);
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);
{
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;
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();
}
}
{
/* 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);
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())
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++)
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++)
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++)
{
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;
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;
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()
{
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;
}
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 */
{
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());
}
}
}
{
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);
{
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;
}
}
{
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));
{
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;
}
}
{
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));
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;
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;
{
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
{
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;
}
}
*/
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 */
#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())
return i->first->name;
}
- return "*";
+ return star;
}
bool CommandWho::whomatch(User* user, const char* matchtext)
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) + " " +
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)
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;
}
{
/* 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;
}
}
{
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
{
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;
}
/* 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)
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;
}
{
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 "";
}
}
{
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 "";
}
}
ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, 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;
{
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 "";
}
}
{
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 "";
}
}
{
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 "";
}
}
{
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 "";
}
}
{
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());
}
}
{
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
{
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());
}
}
{
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());
}
}
{
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());
}
}
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;
}
{
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
}
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;
}
}
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());
}
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;
}
}
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;
}
{
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;
}
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());
}
};
{
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;
}
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());
}
};
{
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;
}
}
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;
}
{
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 ¶meter, Channel* channel)
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;
}
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;
}
}
// 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)
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)
{
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;
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;
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;
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;
}
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;
{
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
{
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.
{
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());
}
}
}
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());
}
}
}
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
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);
{
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());
}
}
}
{
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());
}
}
{
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());
}
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;
}
}
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;
}
}
{
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;
}
}
{
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);
}
}
}
{
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;
}
}
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;
}
}
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;
}
};
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
{
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;
}
}
{
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;
}
}
{
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;
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;
}
}
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;
}
}
}
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;
}
}
{
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;
}
}
{
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")
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")
{
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;
}
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;
}
{
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;
}
}
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;
}
/* 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;
}
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);
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));
}
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;
}
}
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;
}
}
{
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)
{
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
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;
}
}
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;
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;
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));
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
{
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;
}
}
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;
}
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();
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]);
{
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;
}
{
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());
}
}
{
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());
}
}