summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-04-01 02:13:43 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-01 02:13:43 +0200
commit1cb05553e286227e6bbd463d0b4b8cae40ff3940 (patch)
treed8c211e91ce29fcaf94dc3a4bf1814200804509c
parent9b9140d5f8a94ba160120ab91821338f08fba6e1 (diff)
Change channel name parameter of Module::OnUserPreJoin() and Channel::JoinUser() to std::string from char*
-rw-r--r--include/channels.h4
-rw-r--r--include/modules.h2
-rw-r--r--src/channels.cpp23
-rw-r--r--src/commands/cmd_join.cpp4
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_banredirect.cpp4
-rw-r--r--src/modules/m_cban.cpp6
-rw-r--r--src/modules/m_chanprotect.cpp4
-rw-r--r--src/modules/m_conn_join.cpp2
-rw-r--r--src/modules/m_cycle.cpp2
-rw-r--r--src/modules/m_denychans.cpp8
-rw-r--r--src/modules/m_joinflood.cpp2
-rw-r--r--src/modules/m_kicknorejoin.cpp2
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_operchans.cpp2
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_override.cpp18
-rw-r--r--src/modules/m_redirect.cpp11
-rw-r--r--src/modules/m_regonlycreate.cpp4
-rw-r--r--src/modules/m_restrictchans.cpp7
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_services_account.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp2
-rw-r--r--src/modules/m_spanningtree/svsjoin.cpp2
-rw-r--r--src/modules/m_sslmodes.cpp4
25 files changed, 61 insertions, 62 deletions
diff --git a/include/channels.h b/include/channels.h
index dda53f69d..3a6b38640 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -222,14 +222,14 @@ class CoreExport Channel : public Extensible, public InviteBase
/* Join a user to a channel. May be a channel that doesnt exist yet.
* @param user The user to join to the channel.
- * @param cn The channel name to join to. Does not have to exist.
+ * @param channame The channel name to join to. Does not have to exist.
* @param key The key of the channel, if given
* @param override If true, override all join restrictions such as +bkil
* @return A pointer to the Channel the user was joined to. A new Channel may have
* been created if the channel did not exist before the user was joined to it.
* If the user could not be joined to a channel, the return value may be NULL.
*/
- static Channel* JoinUser(User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS = 0);
+ static Channel* JoinUser(User *user, std::string channame, bool override, const std::string& key, bool bursting, time_t TS = 0);
/** Write to a channel, from a user, using va_args for text
* @param user User whos details to prefix the line with
diff --git a/include/modules.h b/include/modules.h
index 68ac9cb6c..626f6e9b8 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -509,7 +509,7 @@ class CoreExport Module : public classbase, public usecountbase
* @param keygiven The key given to join the channel, or an empty string if none was provided
* @return 1 To prevent the join, 0 to allow it.
*/
- virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven);
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven);
/** Called whenever a user is about to be kicked.
* Returning a value of 1 from this function stops the process immediately, causing no
diff --git a/src/channels.cpp b/src/channels.cpp
index 229e2b8ea..6bd021d61 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -225,10 +225,10 @@ void Channel::SetDefaultModes()
* add a channel to a user, creating the record for it if needed and linking
* it to the user record
*/
-Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS)
+Channel* Channel::JoinUser(User* user, std::string cname, bool override, const std::string& key, bool bursting, time_t TS)
{
// Fix: unregistered users could be joined using /SAJOIN
- if (!user || !cn || user->registered != REG_ALL)
+ if (!user || user->registered != REG_ALL)
return NULL;
std::string privs;
@@ -246,7 +246,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
{
if (user->chans.size() >= ServerInstance->Config->OperMaxChans)
{
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cname.c_str());
return NULL;
}
}
@@ -257,14 +257,15 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
maxchans = ServerInstance->Config->MaxChans;
if (user->chans.size() >= maxchans)
{
- user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cn);
+ user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cname.c_str());
return NULL;
}
}
}
- std::string cname;
- cname.assign(std::string(cn), 0, ServerInstance->Config->Limits.ChanMax);
+ if (cname.length() > ServerInstance->Config->Limits.ChanMax)
+ cname.resize(ServerInstance->Config->Limits.ChanMax);
+
Ptr = ServerInstance->FindChan(cname);
bool created_by_local = false;
@@ -276,7 +277,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
if (!IS_LOCAL(user))
{
if (!TS)
- ServerInstance->Logs->Log("CHANNELS",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cn);
+ ServerInstance->Logs->Log("CHANNELS",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick.c_str(), cname.c_str());
}
else
{
@@ -287,7 +288,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
if (IS_LOCAL(user) && override == false)
{
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname.c_str(), privs, key ? key : ""));
+ FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key));
if (MOD_RESULT == MOD_RES_DENY)
return NULL;
}
@@ -307,7 +308,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
if (IS_LOCAL(user) && override == false)
{
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, Ptr, cname.c_str(), privs, key ? key : ""));
+ FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key));
if (MOD_RESULT == MOD_RES_DENY)
{
return NULL;
@@ -320,8 +321,8 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
if (!ckey.empty())
{
- FIRST_MOD_RESULT(OnCheckKey, MOD_RESULT, (user, Ptr, key ? key : ""));
- if (!MOD_RESULT.check((key && ckey == key) || can_bypass))
+ FIRST_MOD_RESULT(OnCheckKey, MOD_RESULT, (user, Ptr, key));
+ if (!MOD_RESULT.check((ckey == key) || can_bypass))
{
// If no key provided, or key is not the right one, and can't bypass +k (not invited or option not enabled)
user->WriteNumeric(ERR_BADCHANNELKEY, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), Ptr->name.c_str());
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp
index 6124fcc1c..9babdb685 100644
--- a/src/commands/cmd_join.cpp
+++ b/src/commands/cmd_join.cpp
@@ -51,7 +51,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
{
- Channel::JoinUser(user, parameters[0].c_str(), false, parameters[1].c_str(), false);
+ Channel::JoinUser(user, parameters[0], false, parameters[1].c_str(), false);
return CMD_SUCCESS;
}
}
@@ -62,7 +62,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
{
- Channel::JoinUser(user, parameters[0].c_str(), false, "", false);
+ Channel::JoinUser(user, parameters[0], false, "", false);
return CMD_SUCCESS;
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 4e4d20c70..b8a831c48 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -95,7 +95,7 @@ void Module::OnUserPart(Membership*, std::string&, CUList&) { }
void Module::OnPreRehash(User*, const std::string&) { }
void Module::OnModuleRehash(User*, const std::string&) { }
void Module::OnRehash(User*) { }
-ModResult Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserPreJoin(User*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnMode(User*, void*, int, const std::vector<std::string>&, const std::vector<TranslateType>&) { }
void Module::OnOper(User*, const std::string&) { }
void Module::OnPostOper(User*, const std::string&, const std::string &) { }
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index ee52a5cfb..1a5126e61 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -267,7 +267,7 @@ class ModuleBanRedirect : public Module
}
}
- virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ virtual ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string &privs, const std::string &keygiven)
{
if (chan)
{
@@ -323,7 +323,7 @@ class ModuleBanRedirect : public Module
user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str());
user->WriteNumeric(470, "%s %s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", user->nick.c_str(), chan->name.c_str(), redir->targetchan.c_str());
nofollow = true;
- Channel::JoinUser(user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time());
+ Channel::JoinUser(user, redir->targetchan, false, "", false, ServerInstance->Time());
nofollow = false;
return MOD_RES_DENY;
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index c779f02df..6f7d576ea 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -188,16 +188,16 @@ class ModuleCBan : public Module
return MOD_RES_DENY;
}
- virtual ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
XLine *rl = ServerInstance->XLines->MatchesLine("CBAN", cname);
if (rl)
{
// Channel is banned.
- user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname, rl->reason.c_str());
+ user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname.c_str(), rl->reason.c_str());
ServerInstance->SNO->WriteGlobalSno('a', "%s tried to join %s which is CBANed (%s)",
- user->nick.c_str(), cname, rl->reason.c_str());
+ user->nick.c_str(), cname.c_str(), rl->reason.c_str());
return MOD_RES_DENY;
}
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index affd0c8d6..09364fb32 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -138,7 +138,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
void RemoveMode(User* user, irc::modestacker* stack)
{
}
-
+
ModResult AccessCheck(User* source, Channel* channel, std::string &parameter, bool adding)
{
User* theuser = ServerInstance->FindNick(parameter);
@@ -288,7 +288,7 @@ class ModuleChanProtect : public Module
settings.DeprivOthers = tag->getBool("deprotectothers", true);
}
- ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
// if the user is the first user into the channel, mark them as the founder, but only if
// the config option for it is set
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index 6b13ab1aa..6f9679eb7 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -57,7 +57,7 @@ class ModuleConnJoin : public Module
while (chans.GetToken(chan))
{
if (ServerInstance->IsChannel(chan.c_str(), ServerInstance->Config->Limits.ChanMax))
- Channel::JoinUser(user, chan.c_str(), false, "", false, ServerInstance->Time());
+ Channel::JoinUser(user, chan, false, "", false, ServerInstance->Time());
}
}
};
diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp
index 383e7b5a2..4aa8e9c20 100644
--- a/src/modules/m_cycle.cpp
+++ b/src/modules/m_cycle.cpp
@@ -66,7 +66,7 @@ class CommandCycle : public Command
channel->PartUser(user, reason);
- Channel::JoinUser(user, parameters[0].c_str(), true, "", false, ServerInstance->Time());
+ Channel::JoinUser(user, parameters[0], true, "", false, ServerInstance->Time());
}
return CMD_SUCCESS;
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index e774e92c8..a96597ace 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -87,7 +87,7 @@ class ModuleDenyChannels : public Module
}
- virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
ConfigTagList tags = ServerInstance->Config->ConfTags("badchan");
for (ConfigIter j = tags.first; j != tags.second; ++j)
@@ -118,13 +118,13 @@ class ModuleDenyChannels : public Module
Channel *newchan = ServerInstance->FindChan(redirect);
if ((!newchan) || (!(newchan->IsModeSet('L'))))
{
- user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname,cname,redirect.c_str(), reason.c_str());
- Channel::JoinUser(user,redirect.c_str(),false,"",false,ServerInstance->Time());
+ user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),redirect.c_str(), reason.c_str());
+ Channel::JoinUser(user, redirect, false, "", false, ServerInstance->Time());
return MOD_RES_DENY;
}
}
- user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname,cname,reason.c_str());
+ user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),reason.c_str());
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 0c68da1fb..8fcb2dd12 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -208,7 +208,7 @@ class ModuleJoinFlood : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 836f92e6c..8ed472d31 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -74,7 +74,7 @@ public:
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 8f8d3ca90..207be2bb5 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -193,7 +193,7 @@ class ModuleOjoin : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (mycommand.active)
{
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index ca948d95b..e0423886f 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -49,7 +49,7 @@ class ModuleOperChans : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan && chan->IsModeSet('O') && !IS_OPER(user))
{
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index b6e6b893b..b0ca38555 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -97,7 +97,7 @@ class ModuleOperPrefixMode : public Module
mw_added = ServerInstance->Modes->AddModeWatcher(&hideoperwatcher);
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string& privs, const std::string& keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
/* The user may have the +H umode on himself, but +H does not necessarily correspond
* to the +H of m_hideoper.
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 1d9447fc4..62fdfc8c9 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -116,7 +116,7 @@ class ModuleOverride : public Module
return MOD_RES_PASSTHRU;
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (IS_LOCAL(user) && IS_OPER(user))
{
@@ -135,8 +135,8 @@ 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->WriteGlobalSno('v', user->nick+" used oper override to bypass +i on "+std::string(cname));
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass invite-only", cname.c_str(), user->nick.c_str());
+ ServerInstance->SNO->WriteGlobalSno('v', user->nick+" used oper override to bypass +i on " + cname);
}
return MOD_RES_ALLOW;
}
@@ -151,8 +151,8 @@ 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->WriteGlobalSno('v', user->nick+" used oper override to bypass +k on "+std::string(cname));
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel key", cname.c_str(), user->nick.c_str());
+ ServerInstance->SNO->WriteGlobalSno('v', user->nick+" used oper override to bypass +k on " + cname);
return MOD_RES_ALLOW;
}
@@ -166,8 +166,8 @@ 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->WriteGlobalSno('v', user->nick+" used oper override to bypass +l on "+std::string(cname));
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass the channel limit", cname.c_str(), user->nick.c_str());
+ ServerInstance->SNO->WriteGlobalSno('v', user->nick+" used oper override to bypass +l on " + cname);
return MOD_RES_ALLOW;
}
@@ -181,8 +181,8 @@ class ModuleOverride : public Module
}
if (NoisyOverride)
- chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass channel ban", cname, user->nick.c_str());
- ServerInstance->SNO->WriteGlobalSno('v',"%s used oper override to bypass channel ban on %s", user->nick.c_str(), cname);
+ chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass channel ban", cname.c_str(), user->nick.c_str());
+ ServerInstance->SNO->WriteGlobalSno('v',"%s used oper override to bypass channel ban on %s", user->nick.c_str(), cname.c_str());
return MOD_RES_ALLOW;
}
}
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 26d6b162b..8076bb2a1 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -131,7 +131,7 @@ class ModuleRedirect : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{
@@ -146,21 +146,20 @@ class ModuleRedirect : public Module
destchan = ServerInstance->FindChan(channel);
if (destchan && destchan->IsModeSet('L'))
{
- user->WriteNumeric(470, "%s %s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", user->nick.c_str(), cname);
+ user->WriteNumeric(470, "%s %s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", user->nick.c_str(), cname.c_str());
return MOD_RES_DENY;
}
/* We check the bool value here to make sure we have it enabled, if we don't then
usermode +L might be assigned to something else. */
if (UseUsermode && user->IsModeSet('L'))
{
- user->WriteNumeric(470, "%s %s %s :Force redirection stopped.",
- user->nick.c_str(), cname, channel.c_str());
+ user->WriteNumeric(470, "%s %s %s :Force redirection stopped.", user->nick.c_str(), cname.c_str(), channel.c_str());
return MOD_RES_DENY;
}
else
{
- user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname, channel.c_str());
- Channel::JoinUser(user, channel.c_str(), false, "", false, ServerInstance->Time());
+ user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname.c_str(), channel.c_str());
+ Channel::JoinUser(user, channel, false, "", false, ServerInstance->Time());
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp
index 61f94c0bd..93f88fe30 100644
--- a/src/modules/m_regonlycreate.cpp
+++ b/src/modules/m_regonlycreate.cpp
@@ -34,7 +34,7 @@ class ModuleRegOnlyCreate : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
return MOD_RES_PASSTHRU;
@@ -50,7 +50,7 @@ class ModuleRegOnlyCreate : public Module
return MOD_RES_PASSTHRU;
// XXX. there may be a better numeric for this..
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname);
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname.c_str());
return MOD_RES_DENY;
}
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index c76b0e79f..d720c7b5f 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -53,10 +53,9 @@ class ModuleRestrictChans : public Module
ReadConfig();
}
-
- virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
- irc::string x = cname;
+ irc::string x(cname.c_str());
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
@@ -66,7 +65,7 @@ class ModuleRestrictChans : public Module
// user is not an oper and its not in the allow list
if ((!IS_OPER(user)) && (allowchans.find(x) == allowchans.end()))
{
- user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname);
+ user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname.c_str());
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 932b564fa..32ebf96ac 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -58,7 +58,7 @@ class CommandSajoin : public Command
*/
if (IS_LOCAL(dest))
{
- Channel::JoinUser(dest, parameters[1].c_str(), true, "", false, ServerInstance->Time());
+ Channel::JoinUser(dest, parameters[1], true, "", false, ServerInstance->Time());
/* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */
Channel* n = ServerInstance->FindChan(parameters[1]);
if (n)
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 50e2c76a6..6dd042ea6 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -245,7 +245,7 @@ class ModuleServicesAccount : public Module
return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index c0475613a..a90c62924 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -177,7 +177,7 @@ CmdResult CommandFJoin::Handle(const std::vector<std::string>& params, User *src
for (std::string::iterator x = modes.begin(); x != modes.end(); ++x)
modestack.Push(*x, who->nick);
- Channel::JoinUser(who, channel.c_str(), true, "", route_back_again->bursting, TS);
+ Channel::JoinUser(who, channel, true, "", route_back_again->bursting, TS);
}
else
{
diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp
index 416502369..f1f6b7cfd 100644
--- a/src/modules/m_spanningtree/svsjoin.cpp
+++ b/src/modules/m_spanningtree/svsjoin.cpp
@@ -41,7 +41,7 @@ CmdResult CommandSVSJoin::Handle(const std::vector<std::string>& parameters, Use
/* only join if it's local, otherwise just pass it on! */
if (IS_LOCAL(u))
- Channel::JoinUser(u, parameters[1].c_str(), false, "", false, ServerInstance->Time());
+ Channel::JoinUser(u, parameters[1], false, "", false, ServerInstance->Time());
return CMD_SUCCESS;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index c81c74207..880d40097 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -92,7 +92,7 @@ class ModuleSSLModes : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
+ ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if(chan && chan->IsModeSet('z'))
{
@@ -106,7 +106,7 @@ class ModuleSSLModes : public Module
else
{
// Deny
- user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname);
+ user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname.c_str());
return MOD_RES_DENY;
}
}