Changeset 25729b2 for perl/modules


Ignore:
Timestamp:
Jan 8, 2007, 4:17:55 PM (18 years ago)
Author:
Nelson Elhage <nelhage@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:
723f464
Parents:
6beac73
git-author:
Nelson Elhage <nelhage@mit.edu> (01/08/07 15:55:09)
git-committer:
Nelson Elhage <nelhage@mit.edu> (01/08/07 16:17:55)
Message:
Adding basic smartnarrow support for jabber, and infrastructure to
make it extensible.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/jabber.pl

    r9667006 r25729b2  
    11561156}
    11571157
     1158#####################################################################
     1159#####################################################################
     1160
     1161package owl::Message::Jabber;
     1162
     1163our @ISA = qw( owl::Message );
     1164
     1165sub jtype { shift->{jtype} };
     1166sub from { shift->{from} };
     1167sub to { shift->{to} };
     1168
     1169sub smartfilter {
     1170    my $self = shift;
     1171    my $inst = shift;
     1172
     1173    if($self->jtype eq 'chat') {
     1174        my ($user, $filter, $ftext);
     1175        if($self->direction eq 'in') {
     1176            $user = $self->from;
     1177        } else {
     1178            $user = $self->to;
     1179        }
     1180        $user = Net::Jabber::JID->new($user)->GetJID($inst ? 'full' : 'base');
     1181        $filter = "jabber-user-$user";
     1182        $ftext = qq{type ^jabber\$ and ( ( direction ^in\$ and from ^$user ) } .
     1183                 qq{or ( direction ^out\$ and to ^$user ) ) };
     1184        owl::filter("$filter $ftext");
     1185        return $filter;
     1186    }
     1187}
     1188
    115811891;
Note: See TracChangeset for help on using the changeset viewer.