diff libpurple/conversation.c @ 31894:a9e077fb65e9

Add a cleared-message-history conversation signal, and use it in Pidgin and Finch This stems out of an email discussion with Andrew Victor back in July 2010 regarding letting protocol plugins clear the message scrollback area for UIs. At the time, nobody objected to having the libpurple-clearing function call the UI clearing function. This should also be happily backward-compatible.
author Paul Aurich <paul@darkrain42.org>
date Thu, 31 Mar 2011 04:41:27 +0000
parents 7e20e5bbaf2b
children 8b9e9c61d061 5ffd5582f5fe 47f7b8ca6149
line wrap: on
line diff
--- a/libpurple/conversation.c	Wed Mar 30 22:36:30 2011 +0000
+++ b/libpurple/conversation.c	Thu Mar 31 04:41:27 2011 +0000
@@ -575,6 +575,7 @@
 
 	if (ops != NULL && ops->destroy_conversation != NULL)
 		ops->destroy_conversation(conv);
+	conv->ui_data = NULL;
 
 	purple_conversation_close_logs(conv);
 
@@ -2270,6 +2271,9 @@
 	GList *list = conv->message_history;
 	message_history_free(list);
 	conv->message_history = NULL;
+
+	purple_signal_emit(purple_conversations_get_handle(),
+			"cleared-message-history", conv);
 }
 
 GList *purple_conversation_get_message_history(PurpleConversation *conv)
@@ -2626,6 +2630,11 @@
 						 purple_value_new(PURPLE_TYPE_STRING),
 						 purple_value_new(PURPLE_TYPE_STRING));
 
+	purple_signal_register(handle, "cleared-message-history",
+	                       purple_marshal_VOID__POINTER, NULL, 1,
+	                       purple_value_new(PURPLE_TYPE_SUBTYPE,
+	                                        PURPLE_SUBTYPE_CONVERSATION));
+
 	purple_signal_register(handle, "conversation-extended-menu",
 			     purple_marshal_VOID__POINTER_POINTER, NULL, 2,
 			     purple_value_new(PURPLE_TYPE_SUBTYPE,