Changeset f1589b5 for perl/modules


Ignore:
Timestamp:
Jun 4, 2007, 10:30:39 PM (17 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
48609ce
Parents:
f1fc47f
Message:
Adding 3 variables for the Jabber module.

* jabber:show_offline_buddies (bool, default=true)

If false, only contacts in your roster whose presence you are
subscribed to, and happen to be online.

* jabber:auto_away_timeout    (int, default 5)
* jabber:auto_xa_timeout      (int, default 15)

The timeouts, in minutes, for setting your jabber accounts auto-away
and auto-extended-away. Set to 0 to disable. Even if xa < away, you
will not transition from xa -> away.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r4508e21 rf1589b5  
    3737            die("Not loading Jabber.par\n");
    3838        }
    39     }       
     39    }
    4040}
    4141
     
    6868        $BarnOwl::Hooks::getBuddyList->add(\&onGetBuddyList);
    6969        $vars{show} = '';
     70        BarnOwl::new_variable_bool("jabber:show_offline_buddies",
     71                                   { default => 1,
     72                                     summary => 'Show offline or pending buddies.'});
     73        BarnOwl::new_variable_int("jabber:auto_away_timeout",
     74                                  { default => 5,
     75                                    summary => 'After minutes idle, auto away.',
     76                                  });
     77        BarnOwl::new_variable_int("jabber:auto_xa_timeout",
     78                                  { default => 15,
     79                                    summary => 'After minutes idle, auto extended away.'
     80                                });
    7081    } else {
    7182        # Our owl doesn't support queue_message. Unfortunately, this
     
    8192
    8293    $vars{status_changed} = 0;
     94    my $auto_away = BarnOwl::getvar('jabber:auto_away_timeout');
     95    my $auto_xa = BarnOwl::getvar('jabber:auto_xa_timeout');
    8396    my $idletime = BarnOwl::getidletime();
    84     if ($idletime >= 900 && $vars{show} eq 'away') {
     97    if ($auto_xa != 0 && $idletime >= (60 * $auto_xa) && ($vars{show} eq 'away' || $vars{show} eq '' )) {
    8598        $vars{show} = 'xa';
    86         $vars{status} = 'Auto extended-away after 15 minutes idle.';
     99        $vars{status} = 'Auto extended-away after '.$auto_xa.' minute'.($auto_xa == 1 ? '' : 's').' idle.';
    87100        $vars{status_changed} = 1;
    88     } elsif ($idletime >= 300 && $vars{show} eq '') {
     101    } elsif ($auto_away != 0 && $idletime >= (60 * $auto_away) && $vars{show} eq '') {
    89102        $vars{show} = 'away';
    90         $vars{status} = 'Auto away after 5 minutes idle.';
     103        $vars{status} = 'Auto away after '.$auto_away.' minute'.($auto_away == 1 ? '' : 's').' idle.';
    91104        $vars{status_changed} = 1;
    92105    } elsif ($idletime == 0 && $vars{show} ne '') {
     
    140153    }
    141154    else {
     155        return '' unless BarnOwl::getvar('jabber:show_offline_buddies') != 'on';
    142156        if ($jq{ask}) {
    143157            $blistStr .= " [pending]";
     
    195209        jabberlogin => \&cmd_login,
    196210        {
    197             summary => "Log into jabber", 
     211            summary => "Log into jabber",
    198212            usage   => "jabberlogin JID [PASSWORD]"
    199213        }
     
    379393    delete $vars{jlogin_connhash};
    380394    delete $vars{jlogin_authhash};
    381  
     395
    382396    return "";
    383397}
Note: See TracChangeset for help on using the changeset viewer.