Index: irc.h
===================================================================
--- irc.h	(revision f537044f96de6b6553f042e2274252cb834680b3)
+++ irc.h	(revision 006a84f999248d1bc1c1e36fa3437765d4bd1142)
@@ -206,4 +206,11 @@
 extern const struct bee_ui_funcs irc_ui_funcs;
 
+typedef enum
+{
+	IRC_CDU_SILENT,
+	IRC_CDU_PART,
+	IRC_CDU_KICK,
+} irc_channel_del_user_type_t;
+
 /* irc.c */
 extern GSList *irc_connection_list;
@@ -233,5 +240,5 @@
 void irc_channel_free_soon( 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, gboolean silent, const char *msg );
+int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, irc_channel_del_user_type_t type, 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 );
@@ -256,4 +263,5 @@
 void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason );
 void irc_send_quit( irc_user_t *iu, const char *reason );
+void irc_send_kick( irc_channel_t *ic, irc_user_t *iu, irc_user_t *kicker, const char *reason );
 void irc_send_names( irc_channel_t *ic );
 void irc_send_topic( irc_channel_t *ic, gboolean topic_change );
Index: irc_channel.c
===================================================================
--- irc_channel.c	(revision f537044f96de6b6553f042e2274252cb834680b3)
+++ irc_channel.c	(revision 006a84f999248d1bc1c1e36fa3437765d4bd1142)
@@ -119,5 +119,5 @@
 	
 	if( ic->flags & IRC_CHANNEL_JOINED )
-		irc_channel_del_user( ic, irc->user, FALSE, "Cleaning up channel" );
+		irc_channel_del_user( ic, irc->user, IRC_CDU_KICK, "Cleaning up channel" );
 	
 	if( ic->f->_free )
@@ -223,5 +223,5 @@
 }
 
-int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg )
+int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, irc_channel_del_user_type_t type, const char *msg )
 {
 	irc_channel_user_t *icu;
@@ -233,6 +233,11 @@
 	g_free( icu );
 	
-	if( ic->flags & IRC_CHANNEL_JOINED && !silent )
+	if( !( ic->flags & IRC_CHANNEL_JOINED ) || type == IRC_CDU_SILENT ) {}
+		/* Do nothing. The caller should promise it won't screw
+		   up state of the IRC client. :-) */
+	else if( type == IRC_CDU_PART )
 		irc_send_part( ic, iu, msg );
+	else if( type == IRC_CDU_KICK )
+		irc_send_kick( ic, iu, ic->irc->root, msg );
 	
 	if( iu == ic->irc->user )
Index: irc_im.c
===================================================================
--- irc_im.c	(revision f537044f96de6b6553f042e2274252cb834680b3)
+++ irc_im.c	(revision 006a84f999248d1bc1c1e36fa3437765d4bd1142)
@@ -183,5 +183,5 @@
 	if( !show )
 	{
-		irc_channel_del_user( ic, iu, FALSE, NULL );
+		irc_channel_del_user( ic, iu, IRC_CDU_PART, NULL );
 	}
 	else
@@ -479,5 +479,5 @@
 	
 	ic->data = NULL;
-	irc_channel_del_user( ic, ic->irc->user, FALSE, "Chatroom closed by server" );
+	irc_channel_del_user( ic, ic->irc->user, IRC_CDU_KICK, "Chatroom closed by server" );
 	
 	return TRUE;
@@ -525,5 +525,5 @@
 	   using imcb_chat_free() and the channel was IRC_CHANNEL_TEMP, we get into
 	   a broken state around here. */
-	irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, FALSE, NULL );
+	irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, IRC_CDU_PART, NULL );
 	
 	return TRUE;
Index: irc_send.c
===================================================================
--- irc_send.c	(revision f537044f96de6b6553f042e2274252cb834680b3)
+++ irc_send.c	(revision 006a84f999248d1bc1c1e36fa3437765d4bd1142)
@@ -158,4 +158,10 @@
 }
 
+void irc_send_kick( irc_channel_t *ic, irc_user_t *iu, irc_user_t *kicker, const char *reason )
+{
+	irc_write( ic->irc, ":%s!%s@%s KICK %s %s :%s", kicker->nick, kicker->user,
+	           kicker->host, ic->name, iu->nick, reason ? : "" );
+}
+
 void irc_send_names( irc_channel_t *ic )
 {
Index: irc_user.c
===================================================================
--- irc_user.c	(revision f537044f96de6b6553f042e2274252cb834680b3)
+++ irc_user.c	(revision 006a84f999248d1bc1c1e36fa3437765d4bd1142)
@@ -205,5 +205,5 @@
 	
 	for( l = iu->irc->channels; l; l = l->next )
-		send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, TRUE, NULL );
+		send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, IRC_CDU_SILENT, NULL );
 	
 	if( send_quit )
