received-im-msg signal - no conversation

mowsen mowsen at googlemail.com
Fri Sep 25 04:48:45 EDT 2009


hey there.

i'm want to extract the received text of an im message and then close
the conversation. the code is very simple and looks like this:

sub received_im_msg_cb {
    my ($account, $sender, $msg, $conv, $flags) = @_;
    Purple::Debug::info("testplugin", "Account \"" .
$account->get_username() . "\" has a new message from ".$sender.":
".$msg." Conversation: ".$conv."\n");
  Purple::Conversation::destroy($conv);
}

sub plugin_load {
    my $plugin = shift;
    $data = "";
    my $accounts_handle = Purple::Conversations::get_handle();
    Purple::Signal::connect($accounts_handle, "received-im-msg",
$plugin, \&received_im_msg_cb, $data);
}

the problem now is, that $conv is empty. after sending a second
message from the same sender $conv exists. how can i close the
conversation right after the first received message?

thanks alot,
mowsen




More information about the Devel mailing list