diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-08 15:48:38 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-08 15:48:38 +0100 |
commit | eaaa9862451175392d6df48c4795b188518bed4b (patch) | |
tree | baf01847709f54d56fc009b261484120e90e5be4 /protocols | |
parent | 4a9fd5f7a980831ee2c96a728f4f83137cfc73fe (diff) |
Misc. cleanup. Also updated the Yahoo! module to deal with struct groupchat
in a GSList so that a default config fully compiles again.
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/bee.h | 1 | ||||
-rw-r--r-- | protocols/bee_chat.c | 15 | ||||
-rw-r--r-- | protocols/jabber/presence.c | 1 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 20 |
4 files changed, 25 insertions, 12 deletions
diff --git a/protocols/bee.h b/protocols/bee.h index e0ab0030..b8fee2ae 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -128,5 +128,6 @@ void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char static int remove_chat_buddy_silent( struct groupchat *b, const char *handle ); #endif int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags ); +struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title ); #endif /* __BEE_H__ */ diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index e565b616..3e17a42f 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -217,3 +217,18 @@ int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags ) return 1; } + +struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title ) +{ + struct groupchat *c; + GSList *l; + + for( l = ic->groupchats; l; l = l->next ) + { + c = l->data; + if( strcmp( c->title, title ) == 0 ) + return c; + } + + return NULL; +} diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index dadccfb9..2875d23e 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -204,7 +204,6 @@ int presence_send_update( struct im_connection *ic ) { struct jabber_data *jd = ic->proto_data; struct xt_node *node, *cap; - struct groupchat *c; GSList *l; int st; diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index b61f6ff9..4fd7bee5 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -152,7 +152,7 @@ static void byahoo_logout( struct im_connection *ic ) GSList *l; while( ic->groupchats ) - imcb_chat_free( ic->groupchats ); + imcb_chat_free( ic->groupchats->data ); for( l = yd->buddygroups; l; l = l->next ) { @@ -790,10 +790,14 @@ static void byahoo_accept_conf( void *data ) { struct byahoo_conf_invitation *inv = data; struct groupchat *b; + GSList *l; - for( b = inv->ic->groupchats; b; b = b->next ) + for( l = inv->ic->groupchats; l; l = l->next ) + { + b = l->data; if( b == inv->c ) break; + } if( b != NULL ) { @@ -855,9 +859,7 @@ void ext_yahoo_conf_userdecline( int id, const char *ignored, const char *who, c void ext_yahoo_conf_userjoin( int id, const char *ignored, const char *who, const char *room ) { struct im_connection *ic = byahoo_get_ic_by_id( id ); - struct groupchat *c; - - for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next ); + struct groupchat *c = bee_chat_by_title( ic->bee, ic, room ); if( c ) imcb_chat_add_buddy( c, (char*) who ); @@ -867,9 +869,7 @@ void ext_yahoo_conf_userleave( int id, const char *ignored, const char *who, con { struct im_connection *ic = byahoo_get_ic_by_id( id ); - struct groupchat *c; - - for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next ); + struct groupchat *c = bee_chat_by_title( ic->bee, ic, room ); if( c ) imcb_chat_remove_buddy( c, (char*) who, "" ); @@ -879,9 +879,7 @@ void ext_yahoo_conf_message( int id, const char *ignored, const char *who, const { struct im_connection *ic = byahoo_get_ic_by_id( id ); char *m = byahoo_strip( msg ); - struct groupchat *c; - - for( c = ic->groupchats; c && strcmp( c->title, room ) != 0; c = c->next ); + struct groupchat *c = bee_chat_by_title( ic->bee, ic, room ); if( c ) imcb_chat_msg( c, (char*) who, (char*) m, 0, 0 ); |