diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-04 20:39:04 -0400 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-04 20:39:04 -0400 |
commit | 0b5cc72bc7b4192ff5b474b81038c299d03721f1 (patch) | |
tree | e727779c8d5a02dae6f9baad5a834706059a6307 /irc_channel.c | |
parent | 1d3915951bfbcdfa1a7829a4082e90e154d4a486 (diff) |
Send nickname change notifications when necessary.
Diffstat (limited to 'irc_channel.c')
-rw-r--r-- | irc_channel.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/irc_channel.c b/irc_channel.c index db3ecd34..27216f3c 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -81,7 +81,7 @@ int irc_channel_free( irc_channel_t *ic ) int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ) { - if( g_slist_find( ic->users, iu ) != NULL ) + if( !irc_channel_has_user( ic, iu ) ) return 0; ic->users = g_slist_insert_sorted( ic->users, iu, irc_user_cmp ); @@ -97,7 +97,7 @@ int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ) int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) { - if( g_slist_find( ic->users, iu ) == NULL ) + if( !irc_channel_has_user( ic, iu ) ) return 0; ic->users = g_slist_remove( ic->users, iu ); @@ -111,6 +111,12 @@ int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) return 1; } +/* Currently a fairly stupid one-liner but I fear it's going to get worse. :-) */ +gboolean irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu ) +{ + return g_slist_find( ic->users, iu ) != NULL; +} + int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *iu ) { g_free( ic->topic ); |