changeset 19424:c17e41049b61

Do not duplicate the same message in the history, and store the correct information when sending a message.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 25 Aug 2007 12:06:40 +0000
parents dc4e8460622f
children 4da3c8618c24
files libpurple/conversation.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/conversation.c	Sat Aug 25 11:36:02 2007 +0000
+++ b/libpurple/conversation.c	Sat Aug 25 12:06:40 2007 +0000
@@ -211,6 +211,15 @@
 {
 	GList *list;
 	PurpleConvMessage *msg;
+
+	if (flags & PURPLE_MESSAGE_SEND) {
+		const char *me = NULL;
+		if (conv->account->gc)
+			me = conv->account->gc->display_name;
+		if (!me)
+			me = conv->account->username;
+		who = me;
+	}
 	
 	msg = g_new0(PurpleConvMessage, 1);
 	PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage);
@@ -1145,10 +1154,9 @@
 	c = purple_conv_im_get_conversation(im);
 
 	/* Pass this on to either the ops structure or the default write func. */
-	if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) {
+	if (c->ui_ops != NULL && c->ui_ops->write_im != NULL)
 		c->ui_ops->write_im(c, who, message, flags, mtime);
-		add_message_to_history(c, who, message, flags, mtime);
-	} else
+	else
 		purple_conversation_write(c, who, message, flags, mtime);
 }
 
@@ -1472,10 +1480,9 @@
 	}
 
 	/* Pass this on to either the ops structure or the default write func. */
-	if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) {
+	if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL)
 		conv->ui_ops->write_chat(conv, who, message, flags, mtime);
-		add_message_to_history(conv, who, message, flags, mtime);
-	} else
+	else
 		purple_conversation_write(conv, who, message, flags, mtime);
 }