+ 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 == '+')
+ {
+ mode++;
+ continue;
+ }
+
+ /* Ensure the user doesnt request the same mode twice,
+ * so they cant flood themselves off out of idiocy.
+ */
+ if (!sent[mletter])
+ {
+ sent[mletter] = true;
+ }
+ else
+ {
+ 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++);
+ mh->DisplayEmptyList(user, targetchannel);
+ 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++)
+ {
+ std::string dummyparam;
+
+ if (!((*watchers)->BeforeMode(user, NULL, targetchannel, dummyparam, true, MODETYPE_CHANNEL)))
+ display = false;
+ }
+
+ if (display)
+ mh->DisplayList(user, targetchannel);
+ }
+ else
+ nonlistmodes_found++;
+
+ mode++;