IM Chat using Perl

Duncan Berriman duncan at dcl.co.uk
Mon Mar 14 12:39:16 EDT 2011


I wrote my own automated client in C to use libpurple to send automated
messages 

to send a message I do the following.

Get the connection for the account using purple_account_get_connection 
If I have a connection then I check the connection state using
purple_connection_get_state and check it is PURPLE_CONNECTED
I then find the buddy with purple_find_buddy, if it exists I check the
presense of the buddy with purple_buddy_get_presence
I then check If the buddy is online  with purple_presence_is_online
If they are online then I check if I have a conversation already open with
them using purple_find_conversation_with_account
If there is no conversation then I create one with purple_conversation_new
Once I have a conversation I can send a message using
purple_conversation_get_im_data and then finally purple_conv_im_send

Hope that helps.

Duncan

-----Original Message-----
From: devel-bounces at pidgin.im [mailto:devel-bounces at pidgin.im] On Behalf Of
Gabor Szabo
Sent: 14 March 2011 14:54
To: devel at pidgin.im
Subject: Re: IM Chat using Perl

On Mon, Mar 14, 2011 at 3:54 PM, Gabor Szabo <szabgab at gmail.com> wrote:
> Using the signals-test.pl example in the Pidgin distribution I can now 
> get a signal when someone sends me an IM.
>
> Unfortunately I have not yet figured out how to send an IM.
> Neither as a response to the received IM message nor as an initiated IM.
>
> The signal handler looks like this:
>
> sub conv_received_msg
> {
>        my ($account, $sender, $message, $conv, $flags, $data) = @_; 
> ...
> }
>
> From the $account  I can get the connection object using
>
> my $con = $account->get_connection;
>
> but I am not sure how to go on.
>
> Your help would be appreciated.
>
> Gabor

I was expecting $conv to hold the Purple::Conversation object but it is
undef.

Also when following the example in
http://developer.pidgin.im/doxygen/dev/html/perl-howto.html under
"Conversation API" I don't see where the IM is connected to a buddy. I tried
to run that code but it seems to just talk locally.

Gabor

_______________________________________________
Devel mailing list
Devel at pidgin.im
http://pidgin.im/cgi-bin/mailman/listinfo/devel

--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Devel mailing list