From 5c7b45cb652c73a8f2c827116786a1b21519d4b7 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Jul 2010 14:36:08 +0100 Subject: Auto joins for chatrooms. --- irc_im.c | 15 +++++++++++++++ protocols/bee.h | 3 +++ protocols/nogaim.c | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/irc_im.c b/irc_im.c index caf0e38e..57ff893e 100644 --- a/irc_im.c +++ b/irc_im.c @@ -30,6 +30,18 @@ static const struct irc_user_funcs irc_user_im_funcs; +static void bee_irc_imc_connected( struct im_connection *ic ) +{ + irc_t *irc = (irc_t*) ic->bee->ui_data; + + irc_channel_auto_joins( irc, ic->acc ); +} + +static void bee_irc_imc_disconnected( struct im_connection *ic ) +{ + /* Maybe try to send /QUITs here instead of later on. */ +} + static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu ) { irc_user_t *iu; @@ -822,6 +834,9 @@ static void bee_irc_ft_finished( struct im_connection *ic, file_transfer_t *file } const struct bee_ui_funcs irc_ui_funcs = { + bee_irc_imc_connected, + bee_irc_imc_disconnected, + bee_irc_user_new, bee_irc_user_free, bee_irc_user_fullname, diff --git a/protocols/bee.h b/protocols/bee.h index c3230f47..e82913d6 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -81,6 +81,9 @@ typedef struct bee_group typedef struct bee_ui_funcs { + void (*imc_connected)( struct im_connection *ic ); + void (*imc_disconnected)( struct im_connection *ic ); + gboolean (*user_new)( bee_t *bee, struct bee_user *bu ); gboolean (*user_free)( bee_t *bee, struct bee_user *bu ); gboolean (*user_fullname)( bee_t *bee, bee_user_t *bu ); diff --git a/protocols/nogaim.c b/protocols/nogaim.c index f88ec693..0998291b 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -286,6 +286,9 @@ void imcb_connected( struct im_connection *ic ) exponential backoff timer. */ ic->acc->auto_reconnect_delay = 0; + if( ic->bee->ui->imc_connected ) + ic->bee->ui->imc_connected( ic ); + /* for( c = irc->chatrooms; c; c = c->next ) { @@ -328,6 +331,9 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) else ic->flags |= OPT_LOGGING_OUT; + if( ic->bee->ui->imc_disconnected ) + ic->bee->ui->imc_disconnected( ic ); + imcb_log( ic, "Signing off.." ); b_event_remove( ic->keepalive ); -- cgit v1.2.3