aboutsummaryrefslogtreecommitdiffstats
path: root/irc_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_channel.c')
-rw-r--r--irc_channel.c10
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 );