Help with creating a plugin (my master thesis)
sardemff7+pidgin at sardemff7.net
Mon Mar 3 03:55:01 EST 2014
(This message was lost somewhere, I am resending it. Sorry for the delay.)
On 21/02/2014 00:46, Agnieszka Pachuta wrote:
> Your previous tips helped me a lot, but now I have some other
> problems with my plugin.
> 1. I use receiving_im_msg_cb callback:
> receiving_im_msg_cb(PurpleAccount *account, char **sender, char
> **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void
> My idea is to check the type of message and send a proper message in
> this function to execute the whole cryptographic protocol. However,
> when I send the first initial message, the receiving_im_msg_cb is
> called, but the PurpleConversation has not been created yet. (I can
> see in a debug window that conversation_created_cb is called after
> receiving_im_msg_cb) When I try to print conv->name or conv->type, I
> get an error and Pidgin stops working. So I can't use this object
> and, in particular, I can't respond to a message because
> purple_conv_im_send function takes a PurpleConversation as an
> argument. How to deal with that?
> Is it a good idea to create a PurpleConversation object on one's
> own? If so, how to do that?
Right after the code sending the received-im-msg event, you can see this
/* search for conversation again in case it was created by
received-im-msg handler */
So I guess it is fine to create one yourself. You should however check
if another handler did already. Here is the code (stolen from
conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name,
if (conv == NULL)
conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
Then just use conv normally!
> 2. I use purple_conversation_set_data function to keep some
> additional data connected to conversation (like a current state of
> the protocol). I would also need to keep some data connected to
> people on a Buddy List (I mean I need one additional variable for
> each buddy) Is it possible to do that?
There is an API exactly for that:
Just peek the one you need. :-)
Quentin âSardem FF7â Glidic
More information about the Devel