- /* Forward mode changes to channel users and other servers */
- IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args);
- IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args);
+ /* MODE requests for local channels from other servers
+ * are definitely invalid! */
+ if (Channel_IsLocal(Channel)) {
+ Log(LOG_ALERT, "Got remote MODE command for local channel!? Ignored.");
+ return CONNECTED;
+ }
+
+ /* Forward mode changes to channel users and all the
+ * other remote servers: */
+ IRC_WriteStrServersPrefix(Client, Origin,
+ "MODE %s %s%s", Channel_Name(Channel),
+ the_modes, the_args);
+ IRC_WriteStrChannelPrefix(Client, Channel, Origin,
+ false, "MODE %s %s%s", Channel_Name(Channel),
+ the_modes, the_args);