From 83e92bf7487623c10567502936ca727f3a4c104c Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 27 Mar 2010 08:30:00 -0400 Subject: Topic handling changes. --- irc_channel.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'irc_channel.c') diff --git a/irc_channel.c b/irc_channel.c index c58d6b1c..d15b73eb 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -108,13 +108,21 @@ int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) return 1; } -int irc_channel_set_topic( irc_channel_t *ic, const char *topic ) +int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *iu ) { g_free( ic->topic ); ic->topic = g_strdup( topic ); + g_free( ic->topic_who ); + if( iu ) + ic->topic_who = g_strdup_printf( "%s!%s@%s", iu->nick, iu->user, iu->host ); + else + ic->topic_who = NULL; + + ic->topic_time = time( NULL ); + if( ic->flags & IRC_CHANNEL_JOINED ) - irc_send_topic( ic ); + irc_send_topic( ic, TRUE ); return 1; } -- cgit v1.2.3