Create an IM conversation with Perl

Paul Aurich darkrain42 at pidgin.im
Thu Dec 31 00:23:23 EST 2009


And Benoit Caccinolo spoke on 12/29/2009 01:38 AM, saying:
> Hello,
> 
> I followed in details the great How-To on Perl scripting.
> http://developer.pidgin.im/doxygen/dev/html/perl-howto.html
> 
> But in the Conversation API part, when you create an IM conversation,
> I don't see anything about the setting of the recipient of the
> message. So as a result, I have a window to be able to send messages
> to myself. And I can't find how to define the recipient of my
> messages.
> 
> Here is the simplified code presented in the How-To:
> 
> $account = Purple::Accounts::find($account_name, $protocol);
> $conv1 = Purple::Conversation->new(1, $account, "Test Conversation 1");
> $im = $conv1->get_im_data();
> $im->send("Message Test.");
> 
> There is nothing about a buddy setting or something like that.
> 
> Any idea?

For IM (1:1) conversations, the "name" refers to the buddy you want to IM,
so to IM SmarterChild, you'd pass in Purple::Conversation->new(1, $account,
"smarterchild");

I remember being confused by this when I was first looking at the C
conversation API, so I'm going to clarify this in those docs (which should
update on the website within the next few days) [1]

> Thanks in advance,
> Benoit

HTH,
~Paul

[1] http://developer.pidgin.im/doxygen/dev/html/conversation_8h.html

--- libpurple/conversation.h	447f3f439571b5b4051ebc03ab9f7e23dc9ac36c
+++ libpurple/conversation.h	05cdfd5808f6a943f20f82df067f2fb637174233
@@ -368,7 +368,8 @@ extern "C" {
  * @param type    The type of conversation.
  * @param account The account opening the conversation window on the purple
  *                user's end.
- * @param name    The name of the conversation.
+ * @param name    The name of the conversation.  For PURPLE_CONV_TYPE_IM,
+ *                this is the name of the buddy.
  *
  * @return The new conversation.
  */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20091230/9c62e452/attachment.sig>


More information about the Devel mailing list