Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    raa0a0b5 r8789410  
    285285        {
    286286            summary => "Send a Jabber Message",
    287             usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>] [-m <message>]"
     287            usage   => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]"
    288288        }
    289289    );
     
    308308            description => "jmuc sends Jabber commands related to MUC.\n\n"
    309309              . "The following commands are available\n\n"
    310               . "join <muc>[/<nick>]\n"
    311               . "            Join a MUC (with a given nickname, or otherwise your JID).\n\n"
     310              . "join <muc>  Join a MUC.\n\n"
    312311              . "part <muc>  Part a MUC.\n"
    313312              . "            The MUC is taken from the current message if not supplied.\n\n"
     
    378377        my $cjidStr = $conn->baseJIDExists($jidStr);
    379378        if ($cjidStr) {
    380             die("Already logged in as $cjidStr.\n");
     379            BarnOwl::error("Already logged in as $cjidStr.");
     380            return;
    381381        }
    382382    }
     
    387387
    388388    if ( !$uid || !$componentname ) {
    389         die("usage: $cmd JID\n");
     389        BarnOwl::error("usage: $cmd JID");
     390        return;
    390391    }
    391392
    392393    if ( $conn->jidActive($jidStr) ) {
    393         die("Already logged in as $jidStr.\n");
     394        BarnOwl::error("Already logged in as $jidStr.");
     395        return;
    394396    } elsif ($conn->jidExists($jidStr)) {
    395397        return $conn->tryReconnect($jidStr, 1);
     
    524526sub cmd_jlist {
    525527    if ( !( scalar $conn->getJIDs() ) ) {
    526         die("You are not logged in to Jabber.\n");
     528        BarnOwl::error("You are not logged in to Jabber.");
     529        return;
    527530    }
    528531    BarnOwl::popless_ztext( onGetBuddyList() );
     
    531534sub cmd_jwrite {
    532535    if ( !$conn->connected() ) {
    533         die("You are not logged in to Jabber.\n");
     536        BarnOwl::error("You are not logged in to Jabber.");
     537        return;
    534538    }
    535539
     
    539543    my $jwrite_thread  = "";
    540544    my $jwrite_subject = "";
    541     my $jwrite_body;
    542545    my ($to, $from);
    543546    my $jwrite_type    = "chat";
     
    551554        'subject=s' => \$jwrite_subject,
    552555        'account=s' => \$from,
    553         'id=s'      => \$jwrite_sid,
    554         'message=s' => \$jwrite_body,
     556        'id=s'     =>  \$jwrite_sid,
    555557    ) or die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
    556558    $jwrite_type = 'groupchat' if $gc;
    557559
    558560    if ( scalar @ARGV != 1 ) {
    559         die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n");
     561        BarnOwl::error(
     562            "Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]");
     563        return;
    560564    }
    561565    else {
     
    566570
    567571    unless(scalar @candidates) {
    568         die("Unable to resolve JID $to\n");
     572        die("Unable to resolve JID $to");
    569573    }
    570574
     
    573577    unless(scalar @candidates) {
    574578        if(!$from) {
    575             die("You must specify an account with -a\n");
     579            die("You must specify an account with -a");
    576580        } else {
    577             die("Unable to resolve account $from\n");
     581            die("Unable to resolve account $from");
    578582        }
    579583    }
     
    590594        type    => $jwrite_type
    591595    };
    592 
    593     if (defined($jwrite_body)) {
    594         process_owl_jwrite($jwrite_body);
    595         return;
    596     }
    597596
    598597    if(scalar @candidates > 1) {
     
    632631    my $func = $jmuc_commands{$cmd};
    633632    if ( !$func ) {
    634         die("jmuc: Unknown command: $cmd\n");
     633        BarnOwl::error("jmuc: Unknown command: $cmd");
     634        return;
    635635    }
    636636
     
    654654        }
    655655        else {
    656             die("You must specify an account with -a <jid>\n");
     656            BarnOwl::error('You must specify an account with -a <jid>');
    657657        }
    658658        return $func->( $jid, $muc, @ARGV );
     
    667667
    668668    $muc = shift @ARGV
    669       or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]\n");
     669      or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]");
    670670
    671671    die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n")
     
    680680                                                   MaxChars => 0
    681681                                                  });
    682     $completion_jids{$muc->GetJID('base')} = 1;
     682    $completion_jids{$muc} = 1;
    683683    return;
    684684}
     
    688688
    689689    $muc = shift @args if scalar @args;
    690     die("Usage: jmuc part [<muc>] [-a <account>]\n") unless $muc;
     690    die("Usage: jmuc part [<muc>] [-a <account>]") unless $muc;
    691691
    692692    if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) {
    693693        queue_admin_msg("$jid has left $muc.");
    694694    } else {
    695         die("Error: Not joined to $muc\n");
     695        die("Error: Not joined to $muc");
    696696    }
    697697}
     
    703703    $muc = shift @args if scalar @args;
    704704
    705     die("Usage: jmuc invite <jid> [<muc>] [-a <account>]\n")
     705    die('Usage: jmuc invite <jid> [<muc>] [-a <account>]')
    706706      unless $muc && $invite_jid;
    707707
     
    718718    my ( $jid, $muc, @args ) = @_;
    719719    $muc = shift @args if scalar @args;
    720     die("Usage: jmuc configure [<muc>]\n") unless $muc;
     720    die("Usage: jmuc configure [<muc>]") unless $muc;
    721721    my $iq = Net::Jabber::IQ->new();
    722722    $iq->SetTo($muc);
     
    759759
    760760    $muc = shift @args if scalar @args;
    761     die("Usage: jmuc presence [<muc>]\n") unless $muc;
     761    die("Usage: jmuc presence [<muc>]") unless $muc;
    762762
    763763    if ($muc eq '-a') {
     
    774774    else {
    775775        my $m = $conn->getConnectionFromJID($jid)->FindMUC(jid => $muc);
    776         die("No such muc: $muc\n") unless $m;
     776        die("No such muc: $muc") unless $m;
    777777        BarnOwl::popless_ztext(jmuc_presence_single($m));
    778778    }
     
    801801    my $func = $jroster_commands{$cmd};
    802802    if ( !$func ) {
    803         die("jroster: Unknown command: $cmd\n");
     803        BarnOwl::error("jroster: Unknown command: $cmd");
     804        return;
    804805    }
    805806
     
    824825        }
    825826        else {
    826             die("You must specify an account with -a <jid>\n");
     827            BarnOwl::error('You must specify an account with -a <jid>');
    827828        }
    828829        return $func->( $jid, $name, \@groups, $purgeGroups,  @ARGV );
     
    848849    }
    849850    else {
    850         die("You must specify an account with -a <jid>\n");
     851        BarnOwl::error('You must specify an account with -a <jid>');
    851852    }
    852853
     
    12331234        $completion_jids{$room} = 1;
    12341235
    1235         my $muc;
    1236         if ($dir eq 'in') {
    1237             my $connection = $conn->getConnectionFromSid($props{sid});
    1238             $muc = $connection->FindMUC(jid => $from);
    1239         } else {
    1240             my $connection = $conn->getConnectionFromJID($props{from});
    1241             $muc = $connection->FindMUC(jid => $to);
    1242         }
    1243         $props{from} = $muc->GetFullJID($from) || $nick || $room;
    12441236        $props{sender} = $nick || $room;
    12451237        $props{recipient} = $room;
     
    13391331        return $givenJIDStr if ($conn->jidExists($givenJIDStr) );
    13401332        return resolveConnectedJID($givenJID->GetJID('base')) if $loose;
    1341         die("Invalid account: $givenJIDStr\n");
     1333        die("Invalid account: $givenJIDStr");
    13421334    }
    13431335
     
    13921384        # Not one of ours.
    13931385        else {
    1394             die("Invalid account: $givenJIDStr\n");
     1386            die("Invalid account: $givenJIDStr");
    13951387        }
    13961388
     
    14381430    if($from) {
    14391431        $from_jid = resolveConnectedJID($from, 1);
    1440         die("Unable to resolve account $from\n") unless $from_jid;
     1432        die("Unable to resolve account $from") unless $from_jid;
    14411433        $to_jid = resolveDestJID($to, $from_jid);
    14421434        push @matches, [$from_jid, $to_jid] if $to_jid;
Note: See TracChangeset for help on using the changeset viewer.