Changeset 38a7f22 for perl


Ignore:
Timestamp:
Aug 21, 2008, 2:08:39 AM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a82e091
Parents:
c4ba74d
Message:
Convert Message::IRC and Message::Jabber to use the new BarnOwl::command()

We should now be able to properly narrow to MUCs and users and
channels containing whitespace or quotation marks.
Location:
perl/modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/IRC/lib/BarnOwl/Message/IRC.pm

    r4789b17 r38a7f22  
    2020    my $inst = shift;
    2121
    22     my ($filter, $ftext);
     22    my $filter;
     23    my @filter;
    2324
    2425    if($self->is_private) {
     
    3031        }
    3132        $filter = "irc-user-$who";
    32         my $ftext  =
    33              qq{( type ^irc\$ and filter personal and }
    34            . qq{( ( direction ^in\$ and sender ^$who\$ ) or ( direction ^out\$ and recipient ^$who\$ ) ) ) };
    35         BarnOwl::filter("$filter $ftext");
     33        @filter  =
     34             (qw{( type ^irc$ and filter personal and },
     35              qw{( ( direction ^in$ and sender}, "^$who\$",
     36              qw{ ) or ( direction ^out$ and recipient}, "^$who\$",
     37              qw{) ) ) });
     38        BarnOwl::command("filter", "$filter", @filter);
    3639        return $filter;
    3740    } else {
     
    4346        if ($inst && $self->body =~ /^(\S+):/) {
    4447            $filter = "irc-$network-channel-$channel-$sender-$1";
    45             $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$ and ( sender ^$sender\$ or sender ^$1\$ )};
     48            @filter =
     49                 (qw{type ^irc$ and network}, "^$network\$",
     50                  qw{and channel}, "^$channel\$",
     51                  qw{and ( sender}, "^$sender\$",
     52                  qw{or sender}, "^$1\$",qq{)});
    4653        } else {
    4754            $filter = "irc-$network-channel-$channel";
    48             $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$};
     55            @filter = (qw{type ^irc$ and network}, "^$network\$",
     56                       qw{and channel}, "^$channel\$");
    4957        }
    50         BarnOwl::filter("$filter $ftext");
     58        BarnOwl::command("filter", "$filter", @filter);
    5159        return $filter;
    5260    }
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    ra1a2036 r38a7f22  
    5656    my $inst = shift;
    5757
    58     my ($filter, $ftext);
     58    my $filter;
    5959
    6060    if($self->jtype eq 'chat') {
     
    6969        my $room = $self->room;
    7070        $filter = "jabber-room-$room";
    71         $ftext = qq{type ^jabber\$ and room ^$room\$};
    72         BarnOwl::filter("$filter $ftext");
     71        BarnOwl::command(qw[filter], $filter,
     72                         qw[type ^jabber$ and room], "^$room\$");
    7373        return $filter;
    7474    } elsif ($self->login ne 'none') {
     
    8383    $user   = Net::Jabber::JID->new($user)->GetJID( $inst ? 'full' : 'base' );
    8484    my $filter = "jabber-user-$user";
    85     my $ftext  =
    86         qq{type ^jabber\$ and ( ( direction ^in\$ and from ^$user ) }
    87       . qq{or ( direction ^out\$ and to ^$user ) ) };
    88     BarnOwl::filter("$filter $ftext");
     85    BarnOwl::command(qw[filter], $filter, qw[type ^jabber$],
     86                     qw[and ( ( direction ^in$ and from], "^$user",
     87                     qw[) or ( direction ^out$ and to ], "^$user",
     88                     qw[ ) ) ]);
    8989    return $filter;
    9090
Note: See TracChangeset for help on using the changeset viewer.