diff options
-rw-r--r-- | irc.c | 5 | ||||
-rw-r--r-- | irc.h | 2 | ||||
-rw-r--r-- | irc_im.c | 2 | ||||
-rw-r--r-- | irc_user.c | 5 | ||||
-rw-r--r-- | protocols/bee.h | 2 | ||||
-rw-r--r-- | protocols/bee_user.c | 6 | ||||
-rw-r--r-- | protocols/nogaim.c | 9 | ||||
-rw-r--r-- | root_commands.c | 2 |
8 files changed, 15 insertions, 18 deletions
@@ -209,10 +209,7 @@ void irc_free( irc_t * irc ) */ while( irc->users ) - { - irc_user_t *iu = irc->users->data; - irc_user_free( irc, iu->nick ); - } + irc_user_free( irc, (irc_user_t *) irc->users->data ); while( irc->channels ) irc_channel_free( irc->channels->data ); @@ -203,7 +203,7 @@ void irc_send_nick( irc_user_t *iu, const char *new ); /* irc_user.c */ irc_user_t *irc_user_new( irc_t *irc, const char *nick ); -int irc_user_free( irc_t *irc, const char *nick ); +int irc_user_free( irc_t *irc, irc_user_t *iu ); irc_user_t *irc_user_by_name( irc_t *irc, const char *nick ); int irc_user_set_nick( irc_user_t *iu, const char *new ); gint irc_user_cmp( gconstpointer a_, gconstpointer b_ ); @@ -73,7 +73,7 @@ static gboolean bee_irc_user_new( bee_t *bee, bee_user_t *bu ) static gboolean bee_irc_user_free( bee_t *bee, bee_user_t *bu ) { - return irc_user_free( bee->ui_data, bu->ui_data ); + return irc_user_free( bee->ui_data, (irc_user_t *) bu->ui_data ); } static gboolean bee_irc_user_status( bee_t *bee, bee_user_t *bu, bee_user_t *old ) @@ -46,12 +46,11 @@ irc_user_t *irc_user_new( irc_t *irc, const char *nick ) return iu; } -int irc_user_free( irc_t *irc, const char *nick ) +int irc_user_free( irc_t *irc, irc_user_t *iu ) { - irc_user_t *iu; GSList *l; - if( !( iu = irc_user_by_name( irc, nick ) ) ) + if( !iu ) return 0; irc->users = g_slist_remove( irc->users, iu ); diff --git a/protocols/bee.h b/protocols/bee.h index 6f896c51..e87bb762 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -84,7 +84,7 @@ void bee_free( bee_t *b ); /* bee_user.c */ bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *handle ); -int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle ); +int bee_user_free( bee_t *bee, bee_user_t *bu ); bee_user_t *bee_user_by_handle( bee_t *bee, struct im_connection *ic, const char *handle ); int bee_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, int flags ); diff --git a/protocols/bee_user.c b/protocols/bee_user.c index 20c760a9..f856e7a2 100644 --- a/protocols/bee_user.c +++ b/protocols/bee_user.c @@ -45,11 +45,9 @@ bee_user_t *bee_user_new( bee_t *bee, struct im_connection *ic, const char *hand return bu; } -int bee_user_free( bee_t *bee, struct im_connection *ic, const char *handle ) +int bee_user_free( bee_t *bee, bee_user_t *bu ) { - bee_user_t *bu; - - if( ( bu = bee_user_by_handle( bee, ic, handle ) ) == NULL ) + if( !bu ) return 0; if( bee->ui->user_free ) diff --git a/protocols/nogaim.c b/protocols/nogaim.c index cbfbe00a..4dd60ea6 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -326,12 +326,15 @@ void imc_logout( struct im_connection *ic, int allow_reconnect ) g_free( ic->away ); ic->away = NULL; - for( l = bee->users; l; l = l->next ) + for( l = bee->users; l; ) { bee_user_t *bu = l->data; + GSList *next = l->next; if( bu->ic == ic ) - bee_user_free( bee, ic, bu->handle ); + bee_user_free( bee, bu ); + + l = next; } //query_del_by_conn( ic->irc, ic ); @@ -402,7 +405,7 @@ void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group ) { - bee_user_free( ic->bee, ic, handle ); + bee_user_free( ic->bee, bee_user_by_handle( ic->bee, ic, handle ) ); } /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM diff --git a/root_commands.c b/root_commands.c index 7f3a6599..e5a5b41d 100644 --- a/root_commands.c +++ b/root_commands.c @@ -632,7 +632,7 @@ static void cmd_remove( irc_t *irc, char **cmd ) bu->ic->acc->prpl->remove_buddy( bu->ic, bu->handle, NULL ); nick_del( bu->ic->acc, bu->handle ); - irc_user_free( irc, cmd[1] ); + //TODO(wilmer): bee_user_free() and/or let the IM mod do it? irc_user_free( irc, cmd[1] ); irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] ); g_free( s ); |