Clear conversation window from a protocol prpl

avictor.za at gmail.com avictor.za at gmail.com
Wed Jul 21 05:58:41 EDT 2010


hi,

I have extended the PurpleConversationUiOps with a clear method.

Is the following implementation acceptable?
Can I submit it via the mxit branch for 2.7.3?


--- finch/gntconv.c	b8ced2d04137efad17e22b90e6871d1d335af903
+++ finch/gntconv.c	41c84407ace9696f3d7adb737cd1e06623ee6a94
@@ -1155,6 +1155,13 @@ finch_conv_has_focus(PurpleConversation
 	return FALSE;
 }

+static void
+finch_conv_clear(PurpleConversation *conv)
+{
+	FinchConv *fc = FINCH_CONV(conv);
+	gnt_text_view_clear(GNT_TEXT_VIEW(fc->tv));
+}
+
 static PurpleConversationUiOps conv_ui_ops =
 {
 	finch_create_conversation,
@@ -1172,9 +1179,9 @@ static PurpleConversationUiOps conv_ui_o
 	NULL, /* custom_smiley_write */
 	NULL, /* custom_smiley_close */
 	NULL, /* send_confirm */
+	finch_conv_clear,
 	NULL,
 	NULL,
-	NULL,
 	NULL
 };

============================================================
--- libpurple/conversation.c	d272e427e9274e088c365ba0b1e0b5c7bf169a70
+++ libpurple/conversation.c	6b12dbbb700e398063f4e906ed04d0f07c21cfae
@@ -1048,6 +1048,17 @@ purple_conversation_update(PurpleConvers
 					 "conversation-updated", conv, type);
 }

+void
+purple_conversation_clear(PurpleConversation *conv) {
+	PurpleConversationUiOps *ops;
+
+	g_return_if_fail(conv != NULL);
+
+	ops = purple_conversation_get_ui_ops(conv);
+	if(ops && ops->clear)
+		ops->clear(conv);
+}
+
 /**************************************************************************
  * IM Conversation API
  **************************************************************************/
============================================================
--- libpurple/conversation.h	381a495feb11bace150cc4afcf6b7b50a9c8624d
+++ libpurple/conversation.h	5109c6dc2fb16b431a371029b4b4e8e73898a712
@@ -242,10 +242,12 @@ struct _PurpleConversationUiOps
 	 */
 	void (*send_confirm)(PurpleConversation *conv, const char *message);

+	/** Clear the conversation window */
+	void (*clear)(PurpleConversation *conv);
+
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
 	void (*_purple_reserved3)(void);
-	void (*_purple_reserved4)(void);
 };

 /**
@@ -709,6 +711,15 @@ void purple_conversation_clear_message_h
 void purple_conversation_clear_message_history(PurpleConversation *conv);

 /**
+ * Clear the conversation window.
+ *
+ * @param conv	The conversation
+ *
+ * @since 2.7.3
+ */
+void purple_conversation_clear(PurpleConversation *conv);
+
+/**
  * Get the sender from a PurpleConvMessage
  *
  * @param msg   A PurpleConvMessage
============================================================
--- libpurple/example/nullclient.c	23ee636379a805df74c7580277b9937b7078cce7
+++ libpurple/example/nullclient.c	7968431ead67c15613c4e99990bb679e1df06342
@@ -151,9 +151,9 @@ static PurpleConversationUiOps null_conv
 	NULL,                      /* custom_smiley_write  */
 	NULL,                      /* custom_smiley_close  */
 	NULL,                      /* send_confirm         */
+	NULL,                      /* clear                */
 	NULL,
 	NULL,
-	NULL,
 	NULL
 };

============================================================
--- pidgin/gtkconv.c	cef422192a37a5966dba76f5b879e24470fce162
+++ pidgin/gtkconv.c	d4d40c58bf2f77d08a7ad0b07ebfd05093087285
@@ -6907,6 +6907,12 @@ wrote_msg_update_unseen_cb(PurpleAccount
 	}
 }

+static void
+pidgin_conv_clear(PurpleConversation *conv)
+{
+	clear_conversation_scrollback(conv);
+}
+
 static PurpleConversationUiOps conversation_ui_ops =
 {
 	pidgin_conv_new,
@@ -6924,9 +6930,9 @@ static PurpleConversationUiOps conversat
 	pidgin_conv_custom_smiley_write,  /* custom_smiley_write  */
 	pidgin_conv_custom_smiley_close,  /* custom_smiley_close  */
 	pidgin_conv_send_confirm,         /* send_confirm         */
+	pidgin_conv_clear,                /* clear                */
 	NULL,
 	NULL,
-	NULL,
 	NULL
 };



Regards,
  Andrew Victor




More information about the Devel mailing list