summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_ojoin.cpp63
1 files changed, 10 insertions, 53 deletions
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 6e9e36812..38497f1bb 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -132,71 +132,28 @@ class NetworkPrefix : public ModeHandler
}
}
- User* FindAndVerify(std::string &parameter, Channel* channel)
+ unsigned int GetPrefixRank()
{
- User* theuser = ServerInstance->FindNick(parameter);
- if ((!theuser) || (!channel->HasUser(theuser)))
- {
- parameter.clear();
- return NULL;
- }
- return theuser;
+ return NETWORK_VALUE;
}
- ModeAction HandleChange(User* source, User* theuser, bool adding, Channel* channel, std::string &parameter)
+ void RemoveMode(User* user, irc::modestacker* stack)
{
- Membership* m = channel->GetUser(theuser);
- if (m && adding)
- {
- if (!m->hasMode('Y'))
- {
- parameter = theuser->nick;
- return MODEACTION_ALLOW;
- }
- }
- else if (m && !adding)
- {
- if (m->hasMode('Y'))
- {
- parameter = theuser->nick;
- return MODEACTION_ALLOW;
- }
- }
- return MODEACTION_DENY;
}
- unsigned int GetPrefixRank()
+ ModResult AccessCheck(User* source, Channel* channel, std::string &parameter, bool adding)
{
- return NETWORK_VALUE;
- }
+ User* theuser = ServerInstance->FindNick(parameter);
+ // remove own privs?
+ if (source == theuser && !adding)
+ return MOD_RES_ALLOW;
- void RemoveMode(User* user, irc::modestacker* stack)
- {
+ return MOD_RES_PASSTHRU;
}
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
{
- User* theuser = FindAndVerify(parameter, channel);
-
- if (!theuser)
- return MODEACTION_DENY;
-
- // source is a server, or ulined, we'll let them +-Y the user.
- if (source == ServerInstance->FakeClient ||
- ((source == theuser) && (!adding)) ||
- (ServerInstance->ULine(source->nick.c_str())) ||
- (ServerInstance->ULine(source->server)) ||
- (!IS_LOCAL(source))
- )
- {
- return HandleChange(source, theuser, adding, channel, parameter);
- }
- else
- {
- // bzzzt, wrong answer!
- source->WriteNumeric(482, "%s %s :Only servers may change this mode.", source->nick.c_str(), channel->name.c_str());
- return MODEACTION_DENY;
- }
+ return MODEACTION_ALLOW;
}
};