- /* Only IRC opers and channel members allowed */
- is_oper = Client_OperByMe(from);
- if (!Channel_IsMemberOf(chan, from) && !is_oper)
- return IRC_WriteStrClient(from, ERR_NOTONCHANNEL_MSG,
- Client_ID(from), Req->argv[0]);
+ /* Only remote servers and channel members are allowed to change the
+ * channel topic, and IRC opreators when the Conf_OperCanMode option
+ * is set in the server configuration. */
+ if (Client_Type(Client) != CLIENT_SERVER) {
+ topic_power = Client_HasMode(from, 'o');
+ if (!Channel_IsMemberOf(chan, from)
+ && !(Conf_OperCanMode && topic_power))
+ return IRC_WriteStrClient(from, ERR_NOTONCHANNEL_MSG,
+ Client_ID(from), Req->argv[0]);
+ } else
+ topic_power = true;