diff options
author | dequis <dx@dxzone.com.ar> | 2015-11-26 01:46:51 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-11-26 01:46:51 -0300 |
commit | d088ee8bc50cfe13130da745791f533705acd35e (patch) | |
tree | e489321b585ec462ce14c0cdef3f02bcd91fec89 /irc_im.c | |
parent | 1ec454cf138125d65b75d4f0516c7e097d22db6b (diff) |
irc: Send numeric error when failing to join a channel
This fixes issues like getting a blank window with a channel that the
irc client thinks the user is in but bitlbee doesn't.
The error is sent either by returning NULL in the chat_join prpl
function, or by calling imcb_chat_free() before the user is added to the
channel.
This wasn't possible before since purple returned NULL in its chat_join,
which resulted in other bugs too. Since that's fixed, I can finally
apply this, which has been in my stash for a very long while.
Diffstat (limited to 'irc_im.c')
-rw-r--r-- | irc_im.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -882,15 +882,20 @@ static gboolean bee_irc_channel_chat_join(irc_channel_t *ic) acc->ic && (acc->ic->flags & OPT_LOGGED_IN) && acc->prpl->chat_join) { char *nick; + struct groupchat *gc; if (!(nick = set_getstr(&ic->set, "nick"))) { nick = ic->irc->user->nick; } ic->flags |= IRC_CHANNEL_CHAT_PICKME; - acc->prpl->chat_join(acc->ic, room, nick, NULL, &ic->set); + gc = acc->prpl->chat_join(acc->ic, room, nick, NULL, &ic->set); ic->flags &= ~IRC_CHANNEL_CHAT_PICKME; + if (!gc) { + irc_send_num(ic->irc, 403, "%s :Error joining channel (check control channel?)", ic->name); + } + return FALSE; } else { irc_send_num(ic->irc, 403, "%s :Can't join channel, account offline?", ic->name); |