diff options
-rw-r--r-- | irc.h | 2 | ||||
-rw-r--r-- | irc_channel.c | 8 | ||||
-rw-r--r-- | irc_commands.c | 2 | ||||
-rw-r--r-- | irc_im.c | 6 | ||||
-rw-r--r-- | irc_send.c | 2 | ||||
-rw-r--r-- | irc_user.c | 2 |
6 files changed, 11 insertions, 11 deletions
@@ -221,7 +221,7 @@ irc_channel_t *irc_channel_new( irc_t *irc, const char *name ); irc_channel_t *irc_channel_by_name( irc_t *irc, const char *name ); int irc_channel_free( irc_channel_t *ic ); 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 ); +int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg ); irc_channel_user_t *irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu ); int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who ); void irc_channel_user_set_mode( irc_channel_t *ic, irc_user_t *iu, irc_channel_user_flags_t flags ); diff --git a/irc_channel.c b/irc_channel.c index bceb067c..b3904d22 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -80,7 +80,7 @@ int irc_channel_free( irc_channel_t *ic ) irc_t *irc = ic->irc; if( ic->flags & IRC_CHANNEL_JOINED ) - irc_channel_del_user( ic, irc->user ); + irc_channel_del_user( ic, irc->user, FALSE, "Cleaning up channel" ); irc->channels = g_slist_remove( irc->channels, ic ); while( ic->users ) @@ -141,7 +141,7 @@ int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ) return 1; } -int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) +int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg ) { irc_channel_user_t *icu; @@ -151,8 +151,8 @@ int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu ) ic->users = g_slist_remove( ic->users, icu ); g_free( icu ); - if( ic->flags & IRC_CHANNEL_JOINED ) - irc_send_part( ic, iu, "" ); + if( ic->flags & IRC_CHANNEL_JOINED && !silent ) + irc_send_part( ic, iu, msg ); if( iu == ic->irc->user ) ic->flags &= ~IRC_CHANNEL_JOINED; diff --git a/irc_commands.c b/irc_commands.c index ccfc2171..4ea53299 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -176,7 +176,7 @@ static void irc_cmd_part( irc_t *irc, char **cmd ) { irc_send_num( irc, 403, "%s :No such channel", cmd[1] ); } - else if( irc_channel_del_user( ic, irc->user ) ) + else if( irc_channel_del_user( ic, irc->user, FALSE, cmd[2] ) ) { if( ic->f->part ) ic->f->part( ic, NULL ); @@ -159,7 +159,7 @@ void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu ) if( !show ) { - irc_channel_del_user( ic, iu ); + irc_channel_del_user( ic, iu, FALSE, NULL ); } else { @@ -367,7 +367,7 @@ static gboolean bee_irc_chat_free( bee_t *bee, struct groupchat *c ) /* irc_channel_free( ic ); */ - irc_channel_del_user( ic, ic->irc->user ); + irc_channel_del_user( ic, ic->irc->user, FALSE, "Chatroom closed by server" ); ic->data = NULL; return TRUE; @@ -411,7 +411,7 @@ static gboolean bee_irc_chat_remove_user( bee_t *bee, struct groupchat *c, bee_u { irc_t *irc = bee->ui_data; - irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data ); + irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, FALSE, NULL ); return TRUE; } @@ -149,7 +149,7 @@ void irc_send_join( irc_channel_t *ic, irc_user_t *iu ) void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason ) { - irc_write( ic->irc, ":%s!%s@%s PART %s :%s", iu->nick, iu->user, iu->host, ic->name, reason ); + irc_write( ic->irc, ":%s!%s@%s PART %s :%s", iu->nick, iu->user, iu->host, ic->name, reason ? : "" ); } void irc_send_names( irc_channel_t *ic ) @@ -57,7 +57,7 @@ int irc_user_free( irc_t *irc, irc_user_t *iu ) g_hash_table_remove( irc->nick_user_hash, iu->key ); for( l = irc->channels; l; l = l->next ) - irc_channel_del_user( (irc_channel_t*) l->data, iu ); + irc_channel_del_user( (irc_channel_t*) l->data, iu, FALSE, NULL ); g_free( iu->nick ); if( iu->nick != iu->user ) g_free( iu->user ); |