pidgin: 0257ab6e: Set PURPLE_MESSAGE_RECV before receiving...

Sadrul Habib Chowdhury imadil at gmail.com
Mon Apr 6 12:10:36 EDT 2009


* Richard Nelson had this to say on [06 Apr 2009, 23:12:51 +1000]:
[snip]
> 
> Thanks for looking at this. I just realised conversation.c sets
> _MESSAGE_(SEND|RECV) properly in purple_conv_chat_write. The problem is that I
> think it would be nice for them to be set for plugins using
> {received,receiving}-chat-msg, which happens just before the call to
> purple_conv_chat_write. I propose to move the setting of these flags where I put
> the above erroneous code, and will do so in the morning, unless someone beats me
> to it, or has a better idea :)

I suppose since you are listening to {received,receiving}- signals, the
_RECV flag is implied. ;) But we probably should set the _SEND flag where
appropriate. For that, I think the attached patch is more suited. But
I don't foresee a problem with explicitly setting the _RECV flag either.

Sadrul
-------------- next part --------------
#
# old_revision [a59a573e3b9b2eb42ff728ba9ff56095f5c9e0d0]
#
# patch "libpurple/server.c"
#  from [b9c6a880738b280c7302dd352dfe947ee3f7101e]
#    to [5fd1bd72b4155cd467655033c4e0d127831e3fb4]
#
============================================================
--- libpurple/server.c	b9c6a880738b280c7302dd352dfe947ee3f7101e
+++ libpurple/server.c	5fd1bd72b4155cd467655033c4e0d127831e3fb4
@@ -939,6 +939,14 @@ void serv_got_chat_in(PurpleConnection *
 	if (!conv)
 		return;
 
+	/* Did I send the message? */
+	if (purple_strequal(purple_conv_chat_get_nick(chat), who)) {
+		flags |= PURPLE_MESSAGE_SEND;
+		flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */
+	} else {
+		flags |= PURPLE_MESSAGE_RECV;
+	}
+
 	/*
 	 * Make copies of the message and the sender in case plugins want
 	 * to free these strings and replace them with a modifed version.


More information about the Devel mailing list