|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Simple send perl plugin
by mowsen@googlemail.com
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message 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: use Purple; %PLUGIN_INFO = ( perl_api_version => 2, name => "Perl Test Plugin", version => "0.1", summary => "Test plugin for the Perl interpreter.", description => "Your description here", author => "John H. Kelm <johnhkelm\@gmail.com", url => "http://pidgin.im", load => "plugin_load", unload => "plugin_unload" ); sub plugin_init { return %PLUGIN_INFO; } sub plugin_unload { my $plugin = shift; Purple::Debug::info("testplugin", "plugin_unload() - Test Plugin Unloaded.\n"); } 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 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. 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) Thanks, mowsen _______________________________________________ Devel mailing list Devel@... http://pidgin.im/cgi-bin/mailman/listinfo/devel |
|
|
Re: Simple send perl plugin
by Etan Reisner-2
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message 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 _______________________________________________ Devel mailing list Devel@... http://pidgin.im/cgi-bin/mailman/listinfo/devel |
| Free embeddable forum powered by Nabble | Forum Help |