diff --git a/include/channel.h b/include/channel.h index 6aa72ed..6dca63a 100644 --- a/include/channel.h +++ b/include/channel.h @@ -271,5 +271,7 @@ extern int match_extban(const char *banstr, struct Client *client_p, struct Chan extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type); const char * get_extban_string(void); +extern struct Channel * check_forward(struct Client *source_p, struct Channel *chptr, char *key) + #endif /* INCLUDED_channel_h */ diff --git a/modules/core/m_join.c b/modules/core/m_join.c index c01aba7..257efbf 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -84,45 +84,6 @@ static const char *para[MAXMODEPARAMS]; static char *mbuf; static int pargs; -/* Check what we will forward to, without sending any notices to the user - * -- jilles - */ -static struct Channel * -check_forward(struct Client *source_p, struct Channel *chptr, - char *key) -{ - int depth = 0, i; - - /* User is +Q */ - if (IsNoForward(source_p)) - return NULL; - - while (depth < 16) - { - chptr = find_channel(chptr->mode.forward); - /* Can only forward to existing channels */ - if (chptr == NULL) - return NULL; - /* Already on there, show original error message */ - if (IsMember(source_p, chptr)) - return NULL; - /* Juped. Sending a warning notice would be unfair */ - if (hash_find_resv(chptr->chname)) - return NULL; - /* Don't forward to +Q channel */ - if (chptr->mode.mode & MODE_DISFORWARD) - return NULL; - i = can_join(source_p, chptr, key); - if (i == 0) - return chptr; - if (i != ERR_INVITEONLYCHAN && i != ERR_NEEDREGGEDNICK && i != ERR_THROTTLE && i != ERR_CHANNELISFULL) - return NULL; - depth++; - } - - return NULL; -} - /* * m_join * parv[1] = channel diff --git a/src/channel.c b/src/channel.c index c959687..61332aa 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1357,3 +1357,42 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, sendto_server(client_p, chptr, cap, nocap, "%s %s", modebuf, parabuf); } } + +/* Check what we will forward to, without sending any notices to the user + * -- jilles + */ +struct Channel * +check_forward(struct Client *source_p, struct Channel *chptr, + char *key) +{ + int depth = 0, i; + + /* User is +Q */ + if (IsNoForward(source_p)) + return NULL; + + while (depth < 16) + { + chptr = find_channel(chptr->mode.forward); + /* Can only forward to existing channels */ + if (chptr == NULL) + return NULL; + /* Already on there, show original error message */ + if (IsMember(source_p, chptr)) + return NULL; + /* Juped. Sending a warning notice would be unfair */ + if (hash_find_resv(chptr->chname)) + return NULL; + /* Don't forward to +Q channel */ + if (chptr->mode.mode & MODE_DISFORWARD) + return NULL; + i = can_join(source_p, chptr, key); + if (i == 0) + return chptr; + if (i != ERR_INVITEONLYCHAN && i != ERR_NEEDREGGEDNICK && i != ERR_THROTTLE && i != ERR_CHANNELISFULL) + return NULL; + depth++; + } + + return NULL; +}