New question #61580 on Pidgin:

I have written a simple perl plugin for pidgin that automaticaly closes all 
conversations that have been idle for one minute...
This is becose I want to write a instant messenger bot, so when someone stops 
talking, close conversation to reduce number of open conversations....

It has a problem that I can't explain.... If someone send's me message, and I 
close conversation manually, conv_closed si evaluated OK, but, it doesn't stop 
timeout properly ... so after timeout, close_conv in evaluated (as it should if 
I left conversation open) and when it tries to destroy conversation, pidgin 

Is this a bug or lack of my knowledge of pidgin and perl ??? 

Here is the code:

sub plugin_load {
        our $plugin = shift;
        our %conv_list;
        Purple::Debug::info('auto_close_conv', "plugin_load(): plugin 

'conversation-created', $plugin, \&conv_created, 'conversation-created');
'deleting-conversation', $plugin, \&conv_closed, 'deleting-conversation');
'received-im-msg', $plugin, \&im_received, 'received-im-msg');

        foreach $conv (Purple::get_conversations()) {
                $conv->{'timeout_handle'} = Purple::timeout_add($plugin, 60, 
\&close_conv, $conv);


sub plugin_unload {
        Purple::Debug::info('auto_close_conv', "plugin_unload(): plugin 

sub conv_created {
        my ($conv, $data) = @_;
        Purple::Debug::info('auto_close_conv', "conv_created()\n");
        $conv_list{$conv->get_name()} = $conv;
        $conv->{'timeout_handle'} = Purple::timeout_add($plugin, 60, 
\&close_conv, $conv);

sub conv_closed {
        my ($conv, $data) = @_;
        Purple::Debug::info('auto_close_conv', "conv_closed()\n");
        delete $conv->{'timeout_handle'};
        delete $conv_list{$conv->get_name()};

sub im_received {
        my ($account, $sender, $msg, $flags) = @_;
        Purple::Debug::info('auto_close_conv', "im_received()\n");
        if (defined($conv_list{$sender})) {
                $conv_list{$sender}->{'timeout_handle'} = 
Purple::timeout_add($plugin, 60, \&close_conv, $conv_list{$sender});

sub close_conv {
        my ($conv) = @_;
        Purple::Debug::info('auto_close_conv', "close_conv()\n");
        if (ref($conv) ne 'HASH') {
                Purple::Debug::info('auto_close_conv', "close_conv(): closing 

You received this question notification because you are a member of
Pidgin Rocks, which is an answer contact for Pidgin.

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to