Simple send perl plugin
Etan Reisner
pidgin at unreliablesource.net
Sun Oct 18 18:09:15 EDT 2009
On Mon, Sep 21, 2009 at 03:53:33PM +0200, mowsen wrote:
> Hey there.
>
> I want to send a simple message via a perl plugin using finch on the
> console. Basically, i try using the code from the perl tutorial -
> without any luck. The code looks like this:
<snip>
> sub plugin_load {
> my $plugin = shift;
> my $protocol = "prpl-oscar";
> my $account_name = "mowsen1212";
>
> $account = Purple::Accounts::find($account_name, $protocol);
>
> print "Testing Purple::Conversation->new()...";
> $conv1 = Purple::Conversation->new(1, $account, "Test Conversation 1");
> if ($conv1) { print "ok.\n"; } else { print "fail.\n"; }
>
> print "Testing Purple::Conversation::get_im_data()...\n";
> $im = $conv1->get_im_data();
> if ($im) { print "ok.\n"; } else { print "fail.\n"; }
>
> print "Testing Purple::Conversation::IM::send()...\n";
> $im->send("Message Test.");
> }
>
> In the debug console i get:
>
> g_log: purple_conversation_new: assertion `account != NULL' failed
This means that Purple::Accounts::find failed to find an account with the
information you requested and thusly returned NULL, and
Purple::Conversation->new requires an account to work.
> ax
> perl: Perl function Purple::Script::test::plugin_load exited
> abnormally: Can't call method "get_im_data" on an undefined value at
> (eval 5) line 35.
This is a similar error to the one above, you can't call the function
get_im_data on a non-existant value (and the value of $conv1 is not
defined because of the above error about the account being NULL).
Are you sure you have an account that matches those criteria set up in
finch?
> Anyone a clue what's wrong here. And btw. where the heck do i enter
> the receiver? (I somewhere read i must replace the third argument of
> the conversation statement to the receivers screen name - but that
> still gave the same error)
Correct, the "name" of the conversation is the buddy you wish to have the
conversation with.
> Thanks,
> mowsen
-Etan
More information about the Devel
mailing list