Don't send original error message if we're already on the channel we're forwarding to

Closes #55
This commit is contained in:
Elizabeth Myers 2016-04-04 03:08:52 -05:00
parent 3256156aca
commit fc9013d6b0

View file

@ -110,19 +110,28 @@ check_forward(struct Client *source_p, struct Channel *chptr,
{ {
if (next == NULL) if (next == NULL)
return NULL; return NULL;
chptr = find_channel(next); chptr = find_channel(next);
/* Can only forward to existing channels */ /* Can only forward to existing channels */
if (chptr == NULL) if (chptr == NULL)
return NULL; return NULL;
/* Already on there, show original error message */ /* Already on there... but don't send the original reason for
* being unable to join. It isn't their fault they're already
* on the channel, and it looks hostile otherwise.
* --Elizafox
*/
if (IsMember(source_p, chptr)) if (IsMember(source_p, chptr))
{
*err = ERR_USERONCHANNEL; /* I'm borrowing this for now. --Elizafox */
return NULL; return NULL;
}
/* Juped. Sending a warning notice would be unfair */ /* Juped. Sending a warning notice would be unfair */
if (hash_find_resv(chptr->chname)) if (hash_find_resv(chptr->chname))
return NULL; return NULL;
/* Don't forward to +Q channel */ /* Don't forward to +Q channel */
if (chptr->mode.mode & MODE_DISFORWARD) if (chptr->mode.mode & MODE_DISFORWARD)
return NULL; return NULL;
i = can_join(source_p, chptr, key, &next); i = can_join(source_p, chptr, key, &next);
if (i == 0) if (i == 0)
return chptr; return chptr;
@ -299,7 +308,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
} }
/* If check_forward returns NULL, they couldn't join and there wasn't a usable forward channel. */ /* If check_forward returns NULL, they couldn't join and there wasn't a usable forward channel. */
if(!(chptr2 = check_forward(source_p, chptr, key, &i))) if((chptr2 = check_forward(source_p, chptr, key, &i)) == NULL)
{ {
/* might be wrong, but is there any other better location for such? /* might be wrong, but is there any other better location for such?
* see extensions/chm_operonly.c for other comments on this * see extensions/chm_operonly.c for other comments on this