# HG changeset patch # User Christian Hammond # Date 1060372130 0 # Node ID 874a5c9f4eb8e942da374fea2f053f79bf1216bf # Parent 6b0a8796e9ae11afaf9351ee12d105cbe5dd9e88 [gaim-migrate @ 6921] Added gaim_chat_clear_users(). committer: Tailor Script diff -r 6b0a8796e9ae -r 874a5c9f4eb8 src/conversation.c --- 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) { diff -r 6b0a8796e9ae -r 874a5c9f4eb8 src/conversation.h --- 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.