Hide plugin messages sent to conversation

Etan Reisner pidgin at unreliablesource.net
Mon Jun 15 14:47:14 EDT 2009


On Mon, Jun 15, 2009 at 03:11:06PM +0100, António Pinho wrote:
>  HI there! My plugin needs to send some "special" messages that i wouldn't
> want the user on the other side to see. I tried to send the message with the
> flag PURPLE_MESSAGE_INVISIBLE but the message keeps being shown in the
> user's conversation window :/ any suggestions?

Flags like PURPLE_MESSAGE_INVISIBLE don't propagate across to the
receiving end, think about it, what sense would it make to have clients
support receiving a message that they *know* is going to be invisible?

Not to mention basically nothing in pidgin uses PURPLE_MESSAGE_INVISIBLE
at the moment.

The way to do this is to have your plugin watch incoming messages and
either NULL-ify the incoming message you want to ignore or, at this point,
set the INVISIBLE flag. Note, though, that as per the previous paragraph
setting INVISIBLE will likely still not prevent the message from showing
up (which is arguably a bug and could be filed as one).

As a side note, if you are intending to use this plugin over XMPP it might
be worthwhile looking into the much improved sending/receiving support for
stanzas in the current development code and using that when appropriate
(as that would let you send custom stanzas as opposed to simply
overloading messages).

    -Etan




More information about the Devel mailing list