+ (!(chptr->mode.mode & MODE_NOPRIVMSGS) ||
+ IsMember(source_p, chptr)))
+ {
+ if(MyClient(source_p) && !IsOperGeneral(source_p) &&
+ !add_channel_target(source_p, chptr))
+ {
+ sendto_one(source_p, form_str(ERR_TARGCHANGE),
+ me.name, source_p->name, chptr->chname);
+ return;
+ }
+ if(!flood_attack_channel(msgtype, source_p, chptr, chptr->chname))
+ {
+ sendto_channel_opmod(client_p, source_p, chptr,
+ cmdname[msgtype], text);
+ }
+ }
+ else
+ {
+ if(msgtype != MESSAGE_TYPE_NOTICE)
+ sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
+ form_str(ERR_CANNOTSENDTOCHAN), chptr->chname);
+ }
+}
+/*
+ * msg_channel_opmod
+ *
+ * inputs - flag privmsg or notice
+ * - pointer to client_p
+ * - pointer to source_p
+ * - pointer to channel
+ * output - NONE
+ * side effects - message given channel ops
+ *
+ * XXX - We need to rework this a bit, it's a tad ugly. --nenolod
+ */
+static void
+msg_channel_opmod(enum message_type msgtype,
+ struct Client *client_p, struct Client *source_p,
+ struct Channel *chptr, const char *text)
+{
+ hook_data_privmsg_channel hdata;
+
+ hdata.msgtype = msgtype;
+ hdata.source_p = source_p;
+ hdata.chptr = chptr;
+ hdata.text = text;
+ hdata.approved = 0;
+
+ call_hook(h_privmsg_channel, &hdata);
+
+ /* memory buffer address may have changed, update pointer */
+ text = hdata.text;
+
+ if (hdata.approved != 0)
+ return;
+
+ /* hook may have reduced the string to nothing. */
+ if (EmptyString(text))
+ {
+ /* could be empty after colour stripping and
+ * that would cause problems later */
+ if(msgtype != MESSAGE_TYPE_NOTICE)
+ sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+ return;
+ }
+
+ if(chptr->mode.mode & MODE_OPMODERATE &&
+ (!(chptr->mode.mode & MODE_NOPRIVMSGS) ||
+ IsMember(source_p, chptr)))