Hopefully correct implementation of OnRawMode.. can someone pls check this for me tomorrow.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8654 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
w00t 2008-01-06 21:25:38 +00:00
parent 413074b771
commit 38cc4dda4d
3 changed files with 17 additions and 2 deletions

View File

@ -1095,7 +1095,7 @@ class CoreExport Module : public Extensible
* @param pcnt The parameter count for the mode (0 or 1) * @param pcnt The parameter count for the mode (0 or 1)
* @return 1 to deny the mode, 0 to allow * @return 1 to deny the mode, 0 to allow
*/ */
virtual int OnRawMode(User* user, Channel* chan, char mode, const std::string &param, bool adding, int pcnt); virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt);
/** Called whenever a user joins a channel, to determine if key checks should go ahead or not. /** Called whenever a user joins a channel, to determine if key checks should go ahead or not.
* This method will always be called for each join, wether or not the channel is actually +k, and * This method will always be called for each join, wether or not the channel is actually +k, and

View File

@ -306,6 +306,11 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser
{ {
unsigned char mletter = *mode; unsigned char mletter = *mode;
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, *mode, "", true, 0));
if (MOD_RESULT == ACR_DENY)
continue;
if (*mode == '+') if (*mode == '+')
{ {
mode++; mode++;
@ -501,6 +506,11 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser
continue; continue;
} }
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, modechar, parameter, adding, 1));
if (MOD_RESULT == ACR_DENY)
return;
bool had_parameter = !parameter.empty(); bool had_parameter = !parameter.empty();
for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
@ -523,6 +533,11 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser
} }
else else
{ {
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnRawMode, OnRawMode(user, targetchannel, modechar, "", adding, 0));
if (MOD_RESULT == ACR_DENY)
return;
/* Fix by brain: mode watchers not being called for parameterless modes */ /* Fix by brain: mode watchers not being called for parameterless modes */
for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++) for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
{ {

View File

@ -140,7 +140,7 @@ bool Module::OnCheckReady(User*) { return true; }
int Module::OnUserRegister(User*) { return 0; } int Module::OnUserRegister(User*) { return 0; }
int Module::OnUserPreKick(User*, User*, Channel*, const std::string&) { return 0; } int Module::OnUserPreKick(User*, User*, Channel*, const std::string&) { return 0; }
void Module::OnUserKick(User*, User*, Channel*, const std::string&, bool&) { } void Module::OnUserKick(User*, User*, Channel*, const std::string&, bool&) { }
int Module::OnRawMode(User*, Channel*, char, const std::string &, bool, int) { return 0; } int Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return 0; }
int Module::OnCheckInvite(User*, Channel*) { return 0; } int Module::OnCheckInvite(User*, Channel*) { return 0; }
int Module::OnCheckKey(User*, Channel*, const std::string&) { return 0; } int Module::OnCheckKey(User*, Channel*, const std::string&) { return 0; }
int Module::OnCheckLimit(User*, Channel*) { return 0; } int Module::OnCheckLimit(User*, Channel*) { return 0; }