/pidgin/main: 4c9faa80e58b: Use _purple_conversation_write_commo...

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu Jun 12 15:39:46 EDT 2014


Changeset: 4c9faa80e58b54e144584c14c01864144e1a3800
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-06-12 21:39 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/4c9faa80e58b

Description:

Use _purple_conversation_write_common for all types of clients

diffstat:

 libpurple/conversation.c      |  10 ++++++++--
 libpurple/conversationtypes.c |  17 ++---------------
 2 files changed, 10 insertions(+), 17 deletions(-)

diffs (72 lines):

diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -672,8 +672,14 @@ void
 		}
 	}
 
-	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),
diff --git a/libpurple/conversationtypes.c b/libpurple/conversationtypes.c
--- a/libpurple/conversationtypes.c
+++ b/libpurple/conversationtypes.c
@@ -355,24 +355,18 @@ purple_im_conversation_update_typing(Pur
 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 @@ purple_chat_conversation_get_id(const Pu
 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 @@ chat_conversation_write_message(PurpleCo
 		}
 	}
 
-	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



More information about the Commits mailing list