Use _purple_conversation_write_common for all types of clients

Thu, 12 Jun 2014 21:39:38 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Thu, 12 Jun 2014 21:39:38 +0200
changeset 36113
4c9faa80e58b
parent 36112
4aa7dfcc02a1
child 36114
97ea8574aeea

Use _purple_conversation_write_common for all types of clients

libpurple/conversation.c file | annotate | diff | comparison | revisions
libpurple/conversationtypes.c file | annotate | diff | comparison | revisions
--- a/libpurple/conversation.c	Thu Jun 12 21:33:01 2014 +0200
+++ b/libpurple/conversation.c	Thu Jun 12 21:39:38 2014 +0200
@@ -672,8 +672,14 @@
 		}
 	}
 
-	if (ops && ops->write_conv)
-		ops->write_conv(conv, pmsg);
+	if (ops) {
+		if (PURPLE_IS_CHAT_CONVERSATION(conv) && ops->write_chat)
+			ops->write_chat(PURPLE_CHAT_CONVERSATION(conv), pmsg);
+		else if (PURPLE_IS_IM_CONVERSATION(conv) && ops->write_im)
+			ops->write_im(PURPLE_IM_CONVERSATION(conv), pmsg);
+		else if (ops->write_conv)
+			ops->write_conv(conv, pmsg);
+	}
 
 	add_message_to_history(conv,
 		(purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) ? purple_message_get_recipient(pmsg) : purple_message_get_author(pmsg),
--- a/libpurple/conversationtypes.c	Thu Jun 12 21:33:01 2014 +0200
+++ b/libpurple/conversationtypes.c	Thu Jun 12 21:39:38 2014 +0200
@@ -355,24 +355,18 @@
 static void
 im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg)
 {
-	PurpleConversationUiOps *ops;
 	PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
 	gboolean is_recv;
 
 	g_return_if_fail(im != NULL);
 	g_return_if_fail(msg != NULL);
 
-	ops = purple_conversation_get_ui_ops(conv);
 	is_recv = (purple_message_get_flags(msg) & PURPLE_MESSAGE_RECV);
 
 	if (is_recv)
 		purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
 
-	/* Pass this on to either the ops structure or the default write func. */
-	if (ops != NULL && ops->write_im != NULL)
-		ops->write_im(im, msg);
-	else
-		_purple_conversation_write_common(conv, msg);
+	_purple_conversation_write_common(conv, msg);
 }
 
 /**************************************************************************
@@ -800,7 +794,6 @@
 static void
 chat_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg)
 {
-	PurpleConversationUiOps *ops;
 	PurpleChatConversationPrivate *priv = PURPLE_CHAT_CONVERSATION_GET_PRIVATE(conv);
 	PurpleMessageFlags flags;
 
@@ -830,13 +823,7 @@
 		}
 	}
 
-	ops = purple_conversation_get_ui_ops(conv);
-
-	/* Pass this on to either the ops structure or the default write func. */
-	if (ops != NULL && ops->write_chat != NULL)
-		ops->write_chat(PURPLE_CHAT_CONVERSATION(conv), msg);
-	else
-		_purple_conversation_write_common(conv, msg);
+	_purple_conversation_write_common(conv, msg);
 }
 
 void

mercurial