summaryrefslogtreecommitdiff
path: root/src/modules/m_delayjoin.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-04 05:12:25 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-04 05:12:25 +0000
commit6fc5882d5c88371e37887e47718f97a8b1b476ef (patch)
tree5223447ccefd1f43a45320068cc77e4f3c71256e /src/modules/m_delayjoin.cpp
parent71cd4678a53200f148280a91861325cc40e3bab4 (diff)
delayjoin: Remove broken check for channel ops, use ModeHandler parameter instead
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11169 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_delayjoin.cpp')
-rw-r--r--src/modules/m_delayjoin.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 116bdde10..90d193cd3 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -20,7 +20,7 @@ class DelayJoinMode : public ModeHandler
CUList empty;
Module* Creator;
public:
- DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, 'D', 0, 0, false, MODETYPE_CHANNEL, false), Creator(Parent) {};
+ DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, 'D', 0, 0, false, MODETYPE_CHANNEL, false, '@', '@'), Creator(Parent) {};
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool);
};
@@ -56,33 +56,22 @@ class ModuleDelayJoin : public Module
ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
{
- if (channel->IsModeSet('D') != adding)
- {
- if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP))
- {
- source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only channel operators may %sset channel mode +D", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un");
- return MODEACTION_DENY;
- }
- else
- {
- if (channel->IsModeSet('D'))
- {
- /*
- * Make all users visible, as +D is being removed. If we don't do this,
- * they remain permanently invisible on this channel!
- */
- CUList* names = channel->GetUsers();
- for (CUListIter n = names->begin(); n != names->end(); ++n)
- Creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
- }
- channel->SetMode('D', adding);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
+ /* no change */
+ if (channel->IsModeSet('D') == adding)
return MODEACTION_DENY;
+
+ if (!adding)
+ {
+ /*
+ * Make all users visible, as +D is being removed. If we don't do this,
+ * they remain permanently invisible on this channel!
+ */
+ CUList* names = channel->GetUsers();
+ for (CUListIter n = names->begin(); n != names->end(); ++n)
+ Creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
}
+ channel->SetMode('D', adding);
+ return MODEACTION_ALLOW;
}
ModuleDelayJoin::~ModuleDelayJoin()