Changeset 7cdf756ca67dbcf29abc6a767985f62a637c2e7f
- Timestamp:
- 01/25/07 15:46:26 (3 years ago)
- Author:
- Alejandro R. Sedeño <asedeno@mit.edu>
- Parents:
- 71e33caeb86dbdb2b5b471da2d3dab3cd746afb8
- Children:
- c25a20fcbef752a45d4e0f8a19d35b2fda93190f
- git-committer:
- Alejandro R. Sedeño <asedeno@mit.edu> / 2007-01-25T20:46:26Z+0000
- Message:
-
* Added `jmuc presence -a' to show presence for all MUCs
* Updated jmuc docs
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r71e33ca
|
r7cdf756
|
|
| 373 | 373 | description => "jmuc sends jabber commands related to muc.\n\n" |
| 374 | 374 | . "The following commands are available\n\n" |
| 375 | | . "join MUC Join a muc.\n\n" |
| 376 | | . "part MUC Part a muc.\n" |
| | 375 | . "join <muc> Join a muc.\n\n" |
| | 376 | . "part <muc> Part a muc.\n" |
| 377 | 377 | . " The muc is taken from the current message if not supplied.\n\n" |
| 378 | | . "invite JID MUC\n" |
| 379 | | . " Invite JID to MUC.\n" |
| | 378 | . "invite <jid> <muc>\n" |
| | 379 | . " Invite <jid> to <muc>.\n" |
| 380 | 380 | . " The muc is taken from the current message if not supplied.\n\n" |
| 381 | | . "configure MUC\n" |
| 382 | | . " Configure [muc].\n" |
| 383 | | . " Necessary to initalize a new MUC\n" |
| 384 | | . " At present, only the default configuration is supported.", |
| | 381 | . "configure <muc>\n" |
| | 382 | . " Configures a MUC.\n" |
| | 383 | . " Necessary to initalize a new MUC.\n" |
| | 384 | . " At present, only the default configuration is supported.\n" |
| | 385 | . " The muc is taken from the current message if not supplied.\n\n" |
| | 386 | . "presence <muc>\n" |
| | 387 | . " Shows the roster for <muc>.\n" |
| | 388 | . " The muc is taken from the current message if not supplied.\n\n" |
| | 389 | . "presence -a\n" |
| | 390 | . " Shows rosters for all MUCs you're participating in.\n\n", |
| 385 | 391 | usage => "jmuc COMMAND ARGS" |
| 386 | 392 | } |
| … |
… |
|
| 752 | 758 | } |
| 753 | 759 | |
| | 760 | sub jmuc_presence_single { |
| | 761 | my $m = shift; |
| | 762 | my @jids = $m->Presence(); |
| | 763 | return "JIDs present in " . $m->BaseJID . "\n\t" |
| | 764 | . join("\n\t", map {$_->GetResource}@jids) . "\n"; |
| | 765 | } |
| | 766 | |
| 754 | 767 | sub jmuc_presence { |
| 755 | 768 | my ( $jid, $muc, @args ) = @_; |
| … |
… |
|
| 758 | 771 | die("Usage: jmuc presence MUC") unless $muc; |
| 759 | 772 | |
| 760 | | my $m = $conn->getConnectionFromJID($jid)->FindMUC(jid => $muc); |
| 761 | | die("No such muc: $muc") unless $m; |
| 762 | | |
| 763 | | my @jids = $m->Presence(); |
| 764 | | BarnOwl::popless_ztext("JIDs present in " . $m->BaseJID . "\n\t" . |
| 765 | | join("\n\t", map {$_->GetResource}@jids) . "\n"); |
| | 773 | if ($muc eq '-a') { |
| | 774 | my $str = ""; |
| | 775 | foreach my $jid ($conn->getJIDs()) { |
| | 776 | $str .= boldify("Conferences for $jid:\n"); |
| | 777 | my $connection = $conn->getConnectionFromJID($jid); |
| | 778 | foreach my $muc ($connection->MUCs) { |
| | 779 | $str .= jmuc_presence_single($muc)."\n"; |
| | 780 | } |
| | 781 | } |
| | 782 | BarnOwl::popless_ztext($str); |
| | 783 | } |
| | 784 | else { |
| | 785 | my $m = $conn->getConnectionFromJID($jid)->FindMUC(jid => $muc); |
| | 786 | die("No such muc: $muc") unless $m; |
| | 787 | BarnOwl::popless_ztext(jmuc_presence_single($m)); |
| | 788 | } |
| 766 | 789 | } |
| 767 | 790 | |