}
else if (targetuser)
{
- if ((targetuser == user) || (*user->oper))
+ if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user))
+ {
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, text);
+ return;
+ }
+
+ if ((targetuser == user) || (IS_OPER(user)))
{
/* Display user's current mode string */
user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes());
- if (*targetuser->oper)
+ if (IS_OPER(targetuser))
user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks());
return;
}
while (mode && *mode)
{
+ unsigned char mletter = *mode;
+
if (*mode == '+')
{
mode++;
/* Ensure the user doesnt request the same mode twice,
* so they cant flood themselves off out of idiocy.
*/
- if (!sent[*mode])
+ if (!sent[mletter])
{
- sent[*mode] = true;
+ sent[mletter] = true;
}
else
{
continue;
}
- if (ServerInstance->Config->HideModeLists[*mode] && (targetchannel->GetStatus(user) < STATUS_HOP))
- {
- user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
- continue;
- }
-
ModeHandler *mh = this->FindMode(*mode, MODETYPE_CHANNEL);
bool display = true;
if ((mh) && (mh->IsListMode()))
{
+ if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
+ {
+ user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
+ continue;
+ }
+
/** See below for a description of what craq this is :D
*/
unsigned char handler_id = (*mode - 65) | mask;
for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
{
+ ServerInstance->Log(DEBUG,"Call mode watcher");
if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == false)
{
abort = true;
if (abort)
continue;
}
+ else
+ {
+ /* Fix by brain: mode watchers not being called for parameterless modes */
+ for (ModeWatchIter watchers = modewatchers[handler_id].begin(); watchers != modewatchers[handler_id].end(); watchers++)
+ {
+ if ((*watchers)->BeforeMode(user, targetuser, targetchannel, parameter, adding, type) == false)
+ {
+ abort = true;
+ break;
+ }
+ }
+
+ if (abort)
+ continue;
+ }
/* It's an oper only mode, check if theyre an oper. If they arent,
* eat any parameter that came with the mode, and continue to next
*/
- if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!*user->oper))
+ if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!IS_OPER(user)))
{
- user->WriteServ("481 %s :Permission Denied- Only IRC operators may %sset %s mode %c", user->nick,
+ user->WriteServ("481 %s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick,
adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user",
modehandlers[handler_id]->GetModeChar());
continue;
return type1 + "," + type2 + "," + type3 + "," + type4;
}
-bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two)
+bool ModeParser::PrefixComparison(prefixtype one, prefixtype two)
{
return one.second > two.second;
}
pos = (mw->GetModeChar()-65) | mask;
modewatchers[pos].push_back(mw);
+
return true;
}