Changeset 45d9eb0 for perl/modules


Ignore:
Timestamp:
Jan 24, 2007, 10:30:47 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:
b2648bc
Parents:
989fae0
Message:
* Help for jroster
* replysendercmd for groupchat
* Tweak to resolveDestJID to not be as broken
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/jabber.pl

    r989fae0 r45d9eb0  
    255255            BarnOwl::error("Connection for $jid undefined -- error in reload?");
    256256        }
    257        
     257
    258258        my $status = $client->Process(0);
    259259        if ( !defined($status) ) {
     
    390390        {
    391391            summary     => "Jabber Roster related commands.",
    392             description => "jroster sends jabber commands related to rosters.\n\n",
     392            description => "jroster sends jabber commands related to rosters.\n\n"
     393              . "The following commands are available\n\n"
     394              . "sub <jid>     Subscribe to <jid>'s presence. (implicit add)\n\n"
     395              . "add <jid>     Adds <jid> to your roster.\n\n"
     396              . "unsub <jid>   Unsubscribe from <jid>'s presence.\n\n"
     397              . "remove <jid>  Removes <jid> to your roster. (implicit unsub)\n\n"
     398              . "auth <jid>    Authorizes <jid> to subscribe to your presence.\n\n"
     399              . "deauth <jid>  De-authorizes <jid>'s subscription to your presence.\n\n"
     400              . "The following arguments are supported for all commands\n\n"
     401              . "-a <jid>      Specify which account to make the roster changes on.\n"
     402              . "              Required if you're signed into more than one account.\n\n"
     403              . "The following arguments only work with the add and sub commands.\n\n"
     404              . "-g <group>    Add <jid> to group <group>.\n"
     405              . "              May be specified more than once, will not remove <jid> from any groups.\n\n"
     406              . "-p            Purge. Removes <jid> from all groups.\n"
     407              . "              May be combined with -g completely alter <jid>'s groups.\n\n"
     408              . "-n <name>     Sets <name> as <jid>'s short name.\n\n"
     409              . "Note: Unless -n is used, you can specify multiple <jid> arguments.\n",
    393410            usage       => "jroster COMMAND ARGS"
    394411        }
     
    402419    my $password = '';
    403420    $password = shift if @_;
    404    
     421
    405422    my $uid           = $jid->GetUserID();
    406423    my $componentname = $jid->GetServer();
     
    492509    }
    493510    delete $vars{jlogin_jid};
    494     $vars{jlogin_password} =~ tr/\0-\377/x/;
     511    $vars{jlogin_password} =~ tr/\0-\377/x/ if $vars{jlogin_password};
    495512    delete $vars{jlogin_password};
    496513    delete $vars{jlogin_havepass};
     
    584601
    585602    my @candidates = guess_jwrite($from, $to);
    586    
     603
    587604    unless(scalar @candidates) {
    588605        die("Unable to resolve JID $to");
     
    601618
    602619    ($jwrite_from, $jwrite_to, $jwrite_type) = @{$candidates[0]};
    603    
     620
    604621    $vars{jwrite} = {
    605622        to      => $jwrite_to,
     
    620637           );
    621638    }
    622    
     639
    623640    my $cmd = "jwrite $jwrite_to -a $jwrite_from";
    624641    $cmd .= " -t $jwrite_thread" if $jwrite_thread;
     
    11801197          " -a " . ( ( $dir eq 'out' ) ? $props{from} : $props{to} );
    11811198
     1199        if ($dir eq 'out') {
     1200            $props{replysendercmd} = "jwrite ".$props{to}." -a ".$props{from};
     1201        }
     1202        else {
     1203            $props{replysendercmd} = "jwrite ".$props{from}." -a ".$props{to};
     1204        }
     1205
    11821206        $props{sender} = $nick || $room;
    11831207        $props{recipient} = $room;
     
    12041228    }
    12051229
    1206     $props{replysendercmd} = $props{replycmd};
     1230    $props{replysendercmd} = $props{replycmd} unless $props{replysendercmd};
    12071231    return %props;
    12081232}
     
    13231347    }
    13241348
    1325     return undef;
     1349    my @mucs = $conn->getConnectionFromJID($from)->MUCs;
     1350    for my $m (@mucs) {
     1351        if ($m->BaseJID eq $to) {
     1352            return $m->BaseJID;
     1353        }
     1354    }
     1355
     1356    return $to;
    13261357}
    13271358
     
    13651396        push @$m, $type;
    13661397    }
    1367    
     1398
    13681399    return @matches;
    13691400}
Note: See TracChangeset for help on using the changeset viewer.