summaryrefslogtreecommitdiff
path: root/src/modes
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-18 16:55:27 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-18 16:55:27 +0000
commit32a26fa539242d009ffab01e09cafdaba9270dac (patch)
treecef3ba7e424faa783c67689ec22838185eef752b /src/modes
parent3ca314bffcd18c2cc965594b46ca058e57aaa7e9 (diff)
Someone please help me fix the warnings in modules caused by this change. All mode handler OnMode events, ModeWatcher::BeforeMode/AfterMode, plus OnRawMode now have a bool servermode parameter
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8964 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modes')
-rw-r--r--src/modes/cmode_b.cpp19
-rw-r--r--src/modes/cmode_h.cpp2
-rw-r--r--src/modes/cmode_i.cpp2
-rw-r--r--src/modes/cmode_k.cpp2
-rw-r--r--src/modes/cmode_l.cpp2
-rw-r--r--src/modes/cmode_m.cpp2
-rw-r--r--src/modes/cmode_n.cpp2
-rw-r--r--src/modes/cmode_o.cpp2
-rw-r--r--src/modes/cmode_p.cpp2
-rw-r--r--src/modes/cmode_s.cpp2
-rw-r--r--src/modes/cmode_t.cpp2
-rw-r--r--src/modes/cmode_v.cpp2
-rw-r--r--src/modes/umode_i.cpp2
-rw-r--r--src/modes/umode_n.cpp2
-rw-r--r--src/modes/umode_o.cpp2
-rw-r--r--src/modes/umode_s.cpp2
-rw-r--r--src/modes/umode_w.cpp2
17 files changed, 22 insertions, 29 deletions
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 5a96c896c..bedd4b6b6 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -29,13 +29,13 @@ ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, 'b',
{
}
-ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
int status = channel->GetStatus(source);
/* Call the correct method depending on wether we're adding or removing the mode */
if (adding)
{
- parameter = this->AddBan(source, parameter, channel, status);
+ parameter = this->AddBan(source, parameter, channel, status, servermode);
}
else
{
@@ -87,7 +87,7 @@ void ModeChannelBan::DisplayEmptyList(User* user, Channel* channel)
user->WriteServ("368 %s %s :End of channel ban list",user->nick, channel->name);
}
-std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan, int)
+std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan, int, bool servermode)
{
if ((!user) || (!chan))
{
@@ -120,7 +120,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan
for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++)
{
- if (!strcasecmp(i->data,dest.c_str()))
+ if (!strcasecmp(i->data, dest.c_str()))
{
/* dont allow a user to set the same ban twice */
dest = "";
@@ -129,15 +129,8 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan
}
b.set_time = ServerInstance->Time();
- strlcpy(b.data,dest.c_str(),MAXBUF);
- if (*user->nick)
- {
- strlcpy(b.set_by,user->nick,NICKMAX-1);
- }
- else
- {
- strlcpy(b.set_by,ServerInstance->Config->ServerName,NICKMAX-1);
- }
+ strlcpy(b.data, dest.c_str(), MAXBUF);
+ strlcpy(b.set_by, servermode ? ServerInstance->Config->ServerName : user->nick, 63);
chan->bans.push_back(b);
return dest;
}
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 124506f63..26ec55de3 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -70,7 +70,7 @@ void ModeChannelHalfOp::RemoveMode(User*)
{
}
-ModeAction ModeChannelHalfOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelHalfOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
/* If halfops are not enabled in the conf, we don't execute
* anything in this class at all.
diff --git a/src/modes/cmode_i.cpp b/src/modes/cmode_i.cpp
index dae034458..57dbe75b2 100644
--- a/src/modes/cmode_i.cpp
+++ b/src/modes/cmode_i.cpp
@@ -21,7 +21,7 @@ ModeChannelInviteOnly::ModeChannelInviteOnly(InspIRCd* Instance) : ModeHandler(I
{
}
-ModeAction ModeChannelInviteOnly::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelInviteOnly::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_INVITEONLY] != adding)
{
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 3d8fc7ab3..21b5d8464 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -58,7 +58,7 @@ bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_par
return (their_param < our_param);
}
-ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
if ((channel->modes[CM_KEY] != adding) || (!IS_LOCAL(source)))
{
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp
index 154186248..5c9db31df 100644
--- a/src/modes/cmode_l.cpp
+++ b/src/modes/cmode_l.cpp
@@ -39,7 +39,7 @@ bool ModeChannelLimit::CheckTimeStamp(time_t, time_t, const std::string &their_p
return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
}
-ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
if (adding)
{
diff --git a/src/modes/cmode_m.cpp b/src/modes/cmode_m.cpp
index 4c34dcb1e..ab8ed80a1 100644
--- a/src/modes/cmode_m.cpp
+++ b/src/modes/cmode_m.cpp
@@ -21,7 +21,7 @@ ModeChannelModerated::ModeChannelModerated(InspIRCd* Instance) : ModeHandler(Ins
{
}
-ModeAction ModeChannelModerated::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelModerated::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_MODERATED] != adding)
{
diff --git a/src/modes/cmode_n.cpp b/src/modes/cmode_n.cpp
index cba2f38d2..0f3607566 100644
--- a/src/modes/cmode_n.cpp
+++ b/src/modes/cmode_n.cpp
@@ -21,7 +21,7 @@ ModeChannelNoExternal::ModeChannelNoExternal(InspIRCd* Instance) : ModeHandler(I
{
}
-ModeAction ModeChannelNoExternal::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelNoExternal::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_NOEXTERNAL] != adding)
{
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index caef82bf6..f62635658 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -70,7 +70,7 @@ void ModeChannelOp::RemoveMode(User*)
{
}
-ModeAction ModeChannelOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
int status = channel->GetStatus(source);
diff --git a/src/modes/cmode_p.cpp b/src/modes/cmode_p.cpp
index d16602976..b83980a11 100644
--- a/src/modes/cmode_p.cpp
+++ b/src/modes/cmode_p.cpp
@@ -21,7 +21,7 @@ ModeChannelPrivate::ModeChannelPrivate(InspIRCd* Instance) : ModeHandler(Instanc
{
}
-ModeAction ModeChannelPrivate::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelPrivate::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_PRIVATE] != adding)
{
diff --git a/src/modes/cmode_s.cpp b/src/modes/cmode_s.cpp
index e24ace76f..ab1365536 100644
--- a/src/modes/cmode_s.cpp
+++ b/src/modes/cmode_s.cpp
@@ -21,7 +21,7 @@ ModeChannelSecret::ModeChannelSecret(InspIRCd* Instance) : ModeHandler(Instance,
{
}
-ModeAction ModeChannelSecret::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelSecret::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_SECRET] != adding)
{
diff --git a/src/modes/cmode_t.cpp b/src/modes/cmode_t.cpp
index 2d97baa7a..fa12da75a 100644
--- a/src/modes/cmode_t.cpp
+++ b/src/modes/cmode_t.cpp
@@ -21,7 +21,7 @@ ModeChannelTopicOps::ModeChannelTopicOps(InspIRCd* Instance) : ModeHandler(Insta
{
}
-ModeAction ModeChannelTopicOps::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding)
+ModeAction ModeChannelTopicOps::OnModeChange(User*, User*, Channel* channel, std::string&, bool adding, bool servermode)
{
if (channel->modes[CM_TOPICLOCK] != adding)
{
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 2abf4e161..45a9e1879 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -70,7 +70,7 @@ void ModeChannelVoice::RemoveMode(User*)
{
}
-ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
+ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
{
int status = channel->GetStatus(source);
diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp
index c33caa94d..493687ea7 100644
--- a/src/modes/umode_i.cpp
+++ b/src/modes/umode_i.cpp
@@ -21,7 +21,7 @@ ModeUserInvisible::ModeUserInvisible(InspIRCd* Instance) : ModeHandler(Instance,
{
}
-ModeAction ModeUserInvisible::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
+ModeAction ModeUserInvisible::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode)
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
diff --git a/src/modes/umode_n.cpp b/src/modes/umode_n.cpp
index b669f3ae2..db386a32b 100644
--- a/src/modes/umode_n.cpp
+++ b/src/modes/umode_n.cpp
@@ -21,7 +21,7 @@ ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHan
{
}
-ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Channel*, std::string &parameter, bool adding)
+ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Channel*, std::string &parameter, bool adding, bool servermode)
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp
index 5d8b68ae2..17476c707 100644
--- a/src/modes/umode_o.cpp
+++ b/src/modes/umode_o.cpp
@@ -21,7 +21,7 @@ ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(Instance, '
{
}
-ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
+ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode)
{
/* Only opers can execute this class at all */
if (!*source->oper)
diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp
index 94068065f..4e5fba8e0 100644
--- a/src/modes/umode_s.cpp
+++ b/src/modes/umode_s.cpp
@@ -21,7 +21,7 @@ ModeUserServerNotice::ModeUserServerNotice(InspIRCd* Instance) : ModeHandler(Ins
{
}
-ModeAction ModeUserServerNotice::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
+ModeAction ModeUserServerNotice::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode)
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp
index b01fee083..32fbe9e76 100644
--- a/src/modes/umode_w.cpp
+++ b/src/modes/umode_w.cpp
@@ -21,7 +21,7 @@ ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : ModeHandler(Instance, 'w'
{
}
-ModeAction ModeUserWallops::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
+ModeAction ModeUserWallops::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding, bool servermode)
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))