Changeset 0da506ce9d98b7097cea151432f3eb19eab40e6d

Show
Ignore:
Timestamp:
01/26/07 16:52:37 (2 years ago)
Author:
Nelson Elhage <nelhage@…>
git-author:
Nelson Elhage <nelhage@mit.edu> / 2007-01-26T16:41:33Z-0500
Parents:
c25a20fcbef752a45d4e0f8a19d35b2fda93190f
Children:
ac1bbe23d335d92de71ead394cb3042676203969
git-committer:
Nelson Elhage <nelhage@mit.edu> / 2007-01-26T21:52:37Z+0000
Message:
Add smartnarrow on login/out messages.
Files:
1 modified

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;