changeset 6414:874a5c9f4eb8

[gaim-migrate @ 6921] Added gaim_chat_clear_users(). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 08 Aug 2003 19:48:50 +0000
parents 6b0a8796e9ae
children e3be6b9744b7
files src/conversation.c src/conversation.h
diffstat 2 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Fri Aug 08 02:34:13 2003 +0000
+++ b/src/conversation.c	Fri Aug 08 19:48:50 2003 +0000
@@ -2119,6 +2119,40 @@
 	}
 }
 
+void
+gaim_chat_clear_users(GaimChat *chat)
+{
+	GaimConversation *conv;
+	GaimConversationUiOps *ops;
+	GList *users;
+	GList *l, *l_next;
+
+	g_return_if_fail(chat != NULL);
+
+	conv  = gaim_chat_get_conversation(chat);
+	ops   = gaim_conversation_get_ui_ops(conv);
+	users = gaim_chat_get_users(chat);
+
+	if (ops != NULL && ops->chat_remove_users != NULL)
+		ops->chat_remove_users(conv, users);
+
+	for (l = users; l != NULL; l = l_next)
+	{
+		char *user = (char *)l->data;
+
+		l_next = l->next;
+
+		gaim_event_broadcast(event_chat_buddy_leave,
+							 gaim_conversation_get_gc(conv),
+							 gaim_chat_get_id(chat), user);
+
+		g_free(user);
+	}
+
+	g_list_free(users);
+	gaim_chat_set_users(chat, NULL);
+}
+
 GaimConversation *
 gaim_find_chat(const GaimConnection *gc, int id)
 {
--- a/src/conversation.h	Fri Aug 08 02:34:13 2003 +0000
+++ b/src/conversation.h	Fri Aug 08 19:48:50 2003 +0000
@@ -1109,6 +1109,13 @@
 void gaim_chat_remove_users(GaimChat *chat, GList *users, const char *reason);
 
 /**
+ * Clears all users from a chat.
+ *
+ * @param chat The chat.
+ */
+void gaim_chat_clear_users(GaimChat *chat);
+
+/**
  * Finds a chat with the specified chat ID.
  *
  * @param gc The gaim_connection.