Changeset 6df381b
- Timestamp:
- Nov 9, 2006, 11:40:50 PM (18 years ago)
- 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:
- a55abb3
- Parents:
- 960395d
- git-author:
- Nelson Elhage <nelhage@mit.edu> (11/09/06 23:40:36)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (11/09/06 23:40:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/jabber.pl
r960395d r6df381b 188 188 my ($server, $port) = getServerFromJID($jid); 189 189 190 $connections->{$jidStr}->{client} = Net::Jabber::Client->new(); 190 $connections->{$jidStr}->{client} = Net::Jabber::Client->new(debuglevel => owl::getvar('debug') eq 'on' ? 1 : 0, 191 debugfile => 'jabber.log'); 191 192 my $client = \$connections->{$jidStr}->{client}; 192 193 $connections->{$jidStr}->{roster} = $connections->{$jidStr}->{client}->Roster(); … … 413 414 sub cmd_jmuc 414 415 { 415 416 417 owl::error("You are not logged in to Jabber.");418 return;419 416 if (!connected()) 417 { 418 owl::error("You are not logged in to Jabber."); 419 return; 420 } 420 421 421 my $ocmd = shift; 422 my $cmd = shift; 423 if (!$cmd) 424 { 425 #XXX TODO: Write general usage for jmuc command. 426 return; 427 } 428 429 if ($cmd eq 'join') 430 { 431 local @::ARGV = @_; 422 my $ocmd = shift; 423 my $cmd = shift; 424 if (!$cmd) 425 { 426 #XXX TODO: Write general usage for jmuc command. 427 return; 428 } 429 430 my %jmuc_commands = ( 431 join => \&jmuc_join, 432 part => \&jmuc_part, 433 invite => \&jmuc_invite 434 ); 435 my $func = $jmuc_commands{$cmd}; 436 if(!$func) { 437 owl::error("jmuc: Unknown command: $cmd"); 438 } else { 439 return $func->(@_); 440 } 441 } 442 443 sub jmuc_join { 444 local @ARGV = @_; 432 445 my $password; 433 446 my $jid; … … 436 449 437 450 my $muc; 438 if (scalar @ ::ARGV != 1)451 if (scalar @ARGV != 1) 439 452 { 440 453 owl::error('Usage: jmuc join {muc} [-p password] [-a account]'); … … 443 456 else 444 457 { 445 $muc = @ ::ARGV[0];458 $muc = @ARGV[0]; 446 459 } 447 460 … … 477 490 $presence->AddX($x); 478 491 $connections->{$jid}->{client}->Send($presence); 479 480 elsif ($cmd eq 'part') 481 492 } 493 494 sub jmuc_part { 482 495 my $muc; 483 496 my $jid; … … 498 511 else 499 512 { 500 local @ ::ARGV = @_;513 local @ARGV = @_; 501 514 GetOptions('account=s' => \$jid); 502 if (scalar @ ::ARGV != 1)515 if (scalar @ARGV != 1) 503 516 { 504 517 owl::error('Usage: jmuc part {muc} [-a account]'); … … 507 520 else 508 521 { 509 $muc = @ ::ARGV[0];522 $muc = @ARGV[0]; 510 523 } 511 524 if (!$jid) … … 529 542 $connections->{$jid}->{client}->PresenceSend(to => $muc, type => 'unavailable'); 530 543 queue_admin_msg("$jid has left $muc."); 531 } 532 elsif ($cmd eq 'invite') 533 { 544 } 545 546 sub jmuc_invite 547 { 534 548 my $jid; 535 549 my $invite_jid; … … 555 569 else 556 570 { 557 local @ ::ARGV = @_;571 local @ARGV = @_; 558 572 GetOptions('account=s' => \$jid); 559 if (scalar @ ::ARGV != 2)573 if (scalar @ARGV != 2) 560 574 { 561 575 owl::error('Usage: jmuc invite {jid} [muc] [-a account]'); … … 564 578 else 565 579 { 566 ($muc, $invite_jid) = @ ::ARGV;580 ($muc, $invite_jid) = @ARGV; 567 581 } 568 582 if (!$jid) … … 594 608 $connections->{$jid}->{client}->Send($message); 595 609 queue_admin_msg("$jid has invited $invite_jid to $muc."); 596 } 597 else 598 { 599 owl::error('jmuc: unrecognized command.'); 600 } 601 return ""; 602 } 610 } 611 603 612 604 613 ################################################################################
Note: See TracChangeset
for help on using the changeset viewer.