+ if(nl > NICKLEN - 1)
+ nl = NICKLEN - 1;
+ if(ul > USERLEN)
+ ul = USERLEN;
+ if(hl > HOSTLEN)
+ hl = HOSTLEN;
+ if(fl > CHANNELLEN)
+ fl = CHANNELLEN;
+
+ memcpy(mask_buf + mask_pos, nick, nl), mask_pos += nl;
+ mask_buf[mask_pos++] = '!';
+ memcpy(mask_buf + mask_pos, user, ul), mask_pos += ul;
+ mask_buf[mask_pos++] = '@';
+ memcpy(mask_buf + mask_pos, host, hl), mask_pos += hl;
+ if (forward) {
+ mask_buf[mask_pos++] = '$';
+ memcpy(mask_buf + mask_pos, forward, fl), mask_pos += fl;
+ }
+ mask_buf[mask_pos++] = '\0';
+
+ return mask_buf + old_mask_pos;
+}
+
+/* check_forward()
+ *
+ * input - client, channel to set mode on, target channel name
+ * output - true if forwarding should be allowed
+ * side effects - numeric sent if not allowed
+ */
+static int
+check_forward(struct Client *source_p, struct Channel *chptr,
+ const char *forward)
+{
+ struct Channel *targptr;
+ struct membership *msptr;
+
+ if(!check_channel_name(forward) ||
+ (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward))))