Ignore:
Timestamp:
Jan 26, 2007, 4:52:37 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:
ac1bbe2
Parents:
c25a20f
git-author:
Nelson Elhage <nelhage@mit.edu> (01/26/07 16:41:33)
git-committer:
Nelson Elhage <nelhage@mit.edu> (01/26/07 16:52:37)
Message:
Add smartnarrow on login/out messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/jabber.pl

    rc25a20f r0da506c  
    14141414        die("Unable to resolve account $from") unless $from_jid;
    14151415        $to_jid = resolveDestJID($to, $from_jid);
    1416         push @matches, [$from_jid, $to_jid];
     1416        push @matches, [$from_jid, $to_jid] if $to_jid;
    14171417    } else {
    14181418        for my $f ($conn->getJIDs) {
     
    14611461            $user = $self->to;
    14621462        }
    1463         $user = Net::Jabber::JID->new($user)->GetJID($inst ? 'full' : 'base');
    1464         $filter = "jabber-user-$user";
    1465         $ftext = qq{type ^jabber\$ and ( ( direction ^in\$ and from ^$user ) } .
    1466                  qq{or ( direction ^out\$ and to ^$user ) ) };
    1467         BarnOwl::filter("$filter $ftext");
    1468         return $filter;
     1463        return smartfilter_user($user, $inst);
    14691464    } elsif ($self->jtype eq 'groupchat') {
    14701465        my $room = $self->room;
     
    14731468        BarnOwl::filter("$filter $ftext");
    14741469        return $filter;
    1475     }
    1476 }
     1470    } elsif ($self->login ne 'none') {
     1471        return smartfilter_user($self->from, $inst);
     1472    }
     1473}
     1474
     1475sub smartfilter_user {
     1476    my $user = shift;
     1477    my $inst = shift;
     1478
     1479    $user   = Net::Jabber::JID->new($user)->GetJID( $inst ? 'full' : 'base' );
     1480    my $filter = "jabber-user-$user";
     1481    my $ftext  =
     1482        qq{type ^jabber\$ and ( ( direction ^in\$ and from ^$user ) }
     1483      . qq{or ( direction ^out\$ and to ^$user ) ) };
     1484    BarnOwl::filter("$filter $ftext");
     1485    return $filter;
     1486
     1487}
     1488
    14771489
    147814901;
Note: See TracChangeset for help on using the changeset viewer.