- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r8789410 raa0a0b5 285 285 { 286 286 summary => "Send a Jabber Message", 287 usage => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>] "287 usage => "jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>] [-m <message>]" 288 288 } 289 289 ); … … 308 308 description => "jmuc sends Jabber commands related to MUC.\n\n" 309 309 . "The following commands are available\n\n" 310 . "join <muc> Join a MUC.\n\n" 310 . "join <muc>[/<nick>]\n" 311 . " Join a MUC (with a given nickname, or otherwise your JID).\n\n" 311 312 . "part <muc> Part a MUC.\n" 312 313 . " The MUC is taken from the current message if not supplied.\n\n" … … 377 378 my $cjidStr = $conn->baseJIDExists($jidStr); 378 379 if ($cjidStr) { 379 BarnOwl::error("Already logged in as $cjidStr."); 380 return; 380 die("Already logged in as $cjidStr.\n"); 381 381 } 382 382 } … … 387 387 388 388 if ( !$uid || !$componentname ) { 389 BarnOwl::error("usage: $cmd JID"); 390 return; 389 die("usage: $cmd JID\n"); 391 390 } 392 391 393 392 if ( $conn->jidActive($jidStr) ) { 394 BarnOwl::error("Already logged in as $jidStr."); 395 return; 393 die("Already logged in as $jidStr.\n"); 396 394 } elsif ($conn->jidExists($jidStr)) { 397 395 return $conn->tryReconnect($jidStr, 1); … … 526 524 sub cmd_jlist { 527 525 if ( !( scalar $conn->getJIDs() ) ) { 528 BarnOwl::error("You are not logged in to Jabber."); 529 return; 526 die("You are not logged in to Jabber.\n"); 530 527 } 531 528 BarnOwl::popless_ztext( onGetBuddyList() ); … … 534 531 sub cmd_jwrite { 535 532 if ( !$conn->connected() ) { 536 BarnOwl::error("You are not logged in to Jabber."); 537 return; 533 die("You are not logged in to Jabber.\n"); 538 534 } 539 535 … … 543 539 my $jwrite_thread = ""; 544 540 my $jwrite_subject = ""; 541 my $jwrite_body; 545 542 my ($to, $from); 546 543 my $jwrite_type = "chat"; … … 554 551 'subject=s' => \$jwrite_subject, 555 552 'account=s' => \$from, 556 'id=s' => \$jwrite_sid, 553 'id=s' => \$jwrite_sid, 554 'message=s' => \$jwrite_body, 557 555 ) or die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n"); 558 556 $jwrite_type = 'groupchat' if $gc; 559 557 560 558 if ( scalar @ARGV != 1 ) { 561 BarnOwl::error( 562 "Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]"); 563 return; 559 die("Usage: jwrite <jid> [-t <thread>] [-s <subject>] [-a <account>]\n"); 564 560 } 565 561 else { … … 570 566 571 567 unless(scalar @candidates) { 572 die("Unable to resolve JID $to ");568 die("Unable to resolve JID $to\n"); 573 569 } 574 570 … … 577 573 unless(scalar @candidates) { 578 574 if(!$from) { 579 die("You must specify an account with -a ");575 die("You must specify an account with -a\n"); 580 576 } else { 581 die("Unable to resolve account $from ");577 die("Unable to resolve account $from\n"); 582 578 } 583 579 } … … 594 590 type => $jwrite_type 595 591 }; 592 593 if (defined($jwrite_body)) { 594 process_owl_jwrite($jwrite_body); 595 return; 596 } 596 597 597 598 if(scalar @candidates > 1) { … … 631 632 my $func = $jmuc_commands{$cmd}; 632 633 if ( !$func ) { 633 BarnOwl::error("jmuc: Unknown command: $cmd"); 634 return; 634 die("jmuc: Unknown command: $cmd\n"); 635 635 } 636 636 … … 654 654 } 655 655 else { 656 BarnOwl::error('You must specify an account with -a <jid>');656 die("You must specify an account with -a <jid>\n"); 657 657 } 658 658 return $func->( $jid, $muc, @ARGV ); … … 667 667 668 668 $muc = shift @ARGV 669 or die("Usage: jmuc join <muc> [-p <password>] [-a <account>] ");669 or die("Usage: jmuc join <muc> [-p <password>] [-a <account>]\n"); 670 670 671 671 die("Error: Must specify a fully-qualified MUC name (e.g. barnowl\@conference.mit.edu)\n") … … 680 680 MaxChars => 0 681 681 }); 682 $completion_jids{$muc } = 1;682 $completion_jids{$muc->GetJID('base')} = 1; 683 683 return; 684 684 } … … 688 688 689 689 $muc = shift @args if scalar @args; 690 die("Usage: jmuc part [<muc>] [-a <account>] ") unless $muc;690 die("Usage: jmuc part [<muc>] [-a <account>]\n") unless $muc; 691 691 692 692 if($conn->getConnectionFromJID($jid)->MUCLeave(JID => $muc)) { 693 693 queue_admin_msg("$jid has left $muc."); 694 694 } else { 695 die("Error: Not joined to $muc ");695 die("Error: Not joined to $muc\n"); 696 696 } 697 697 } … … 703 703 $muc = shift @args if scalar @args; 704 704 705 die( 'Usage: jmuc invite <jid> [<muc>] [-a <account>]')705 die("Usage: jmuc invite <jid> [<muc>] [-a <account>]\n") 706 706 unless $muc && $invite_jid; 707 707 … … 718 718 my ( $jid, $muc, @args ) = @_; 719 719 $muc = shift @args if scalar @args; 720 die("Usage: jmuc configure [<muc>] ") unless $muc;720 die("Usage: jmuc configure [<muc>]\n") unless $muc; 721 721 my $iq = Net::Jabber::IQ->new(); 722 722 $iq->SetTo($muc); … … 759 759 760 760 $muc = shift @args if scalar @args; 761 die("Usage: jmuc presence [<muc>] ") unless $muc;761 die("Usage: jmuc presence [<muc>]\n") unless $muc; 762 762 763 763 if ($muc eq '-a') { … … 774 774 else { 775 775 my $m = $conn->getConnectionFromJID($jid)->FindMUC(jid => $muc); 776 die("No such muc: $muc ") unless $m;776 die("No such muc: $muc\n") unless $m; 777 777 BarnOwl::popless_ztext(jmuc_presence_single($m)); 778 778 } … … 801 801 my $func = $jroster_commands{$cmd}; 802 802 if ( !$func ) { 803 BarnOwl::error("jroster: Unknown command: $cmd"); 804 return; 803 die("jroster: Unknown command: $cmd\n"); 805 804 } 806 805 … … 825 824 } 826 825 else { 827 BarnOwl::error('You must specify an account with -a <jid>');826 die("You must specify an account with -a <jid>\n"); 828 827 } 829 828 return $func->( $jid, $name, \@groups, $purgeGroups, @ARGV ); … … 849 848 } 850 849 else { 851 BarnOwl::error('You must specify an account with -a <jid>');850 die("You must specify an account with -a <jid>\n"); 852 851 } 853 852 … … 1234 1233 $completion_jids{$room} = 1; 1235 1234 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; 1236 1244 $props{sender} = $nick || $room; 1237 1245 $props{recipient} = $room; … … 1331 1339 return $givenJIDStr if ($conn->jidExists($givenJIDStr) ); 1332 1340 return resolveConnectedJID($givenJID->GetJID('base')) if $loose; 1333 die("Invalid account: $givenJIDStr ");1341 die("Invalid account: $givenJIDStr\n"); 1334 1342 } 1335 1343 … … 1384 1392 # Not one of ours. 1385 1393 else { 1386 die("Invalid account: $givenJIDStr ");1394 die("Invalid account: $givenJIDStr\n"); 1387 1395 } 1388 1396 … … 1430 1438 if($from) { 1431 1439 $from_jid = resolveConnectedJID($from, 1); 1432 die("Unable to resolve account $from ") unless $from_jid;1440 die("Unable to resolve account $from\n") unless $from_jid; 1433 1441 $to_jid = resolveDestJID($to, $from_jid); 1434 1442 push @matches, [$from_jid, $to_jid] if $to_jid;
Note: See TracChangeset
for help on using the changeset viewer.