mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Convert channel::name to std::string, this was a beastie!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9770 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
869bd02318
commit
31f1e7ad09
@ -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.
|
||||
*/
|
||||
|
@ -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 = "";
|
||||
|
@ -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()
|
||||
|
@ -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 */
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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) + " " +
|
||||
|
14
src/mode.cpp
14
src/mode.cpp
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
@ -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 ¶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;
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 ¶meter, 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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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]);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user