aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-04-12 00:49:32 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2010-04-12 00:49:32 +0200
commiteabc9d2c1b1d29aeb47162da64ce2b607c3d43ff (patch)
tree0f6258df41bf50a6b3bb5e7eefbba0bcfa687443
parentd986463c9e026b2a5f003f44db3105aa5449fc27 (diff)
Fixed cleanup issues when turning off an account. Also fixed syntax of
*_user_free().
-rw-r--r--irc.c5
-rw-r--r--irc.h2
-rw-r--r--irc_im.c2
-rw-r--r--irc_user.c5
-rw-r--r--protocols/bee.h2
-rw-r--r--protocols/bee_user.c6
-rw-r--r--protocols/nogaim.c9
-rw-r--r--root_commands.c2
8 files changed, 15 insertions, 18 deletions
diff --git a/irc.c b/irc.c
index 4824d0ac..b6a1b9f9 100644
--- a/irc.c
+++ b/irc.c
@@ -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 );
diff --git a/irc.h b/irc.h
index 8a40541c..e981b918 100644
--- a/irc.h
+++ b/irc.h
@@ -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_ );
diff --git a/irc_im.c b/irc_im.c
index 26d826bd..ccf0d55c 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -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 )
diff --git a/irc_user.c b/irc_user.c
index 8ad20b54..b7629490 100644
--- a/irc_user.c
+++ b/irc_user.c
@@ -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 );