/pidgin/main: 03ba2ca0be88: Fix sending-im-msg behavior with dis...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Wed Jun 18 06:18:22 EDT 2014
Changeset: 03ba2ca0be882c46e457bc3b071cf64fce53ece2
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-06-18 12:18 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/03ba2ca0be88
Description:
Fix sending-im-msg behavior with displayed messages
diffstat:
libpurple/conversation.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (46 lines):
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -88,7 +88,8 @@ common_send(PurpleConversation *conv, co
PurpleConnection *gc;
PurpleConversationPrivate *priv = PURPLE_CONVERSATION_GET_PRIVATE(conv);
PurpleMessage *msg;
- char *displayed = NULL, *sent = NULL;
+ char *displayed = NULL;
+ const char *sent;
int err = 0;
g_return_if_fail(priv != NULL);
@@ -113,9 +114,9 @@ common_send(PurpleConversation *conv, co
if (displayed && (priv->features & PURPLE_CONNECTION_FLAG_HTML) &&
!(msgflags & PURPLE_MESSAGE_RAW)) {
- sent = g_strdup(displayed);
+ sent = displayed;
} else
- sent = g_strdup(message);
+ sent = message;
msgflags |= PURPLE_MESSAGE_SEND;
@@ -130,8 +131,11 @@ common_send(PurpleConversation *conv, co
err = purple_serv_send_im(gc, msg);
- if ((err > 0) && (displayed != NULL))
+ if ((err > 0) && (displayed != NULL)) {
+ /* revert the contents in case sending-im-msg changed it */
+ purple_message_set_contents(msg, displayed);
purple_conversation_write_message(conv, msg);
+ }
purple_signal_emit(purple_conversations_get_handle(),
"sent-im-msg", account, msg);
@@ -187,7 +191,6 @@ common_send(PurpleConversation *conv, co
}
g_free(displayed);
- g_free(sent);
}
static void
More information about the Commits
mailing list