Changeset 892568b for perl/modules/Jabber/lib/Net/Jabber/MUC.pm
- Timestamp:
- Sep 12, 2007, 10:46:17 PM (17 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:
- 6711361
- Parents:
- 86840c5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Jabber/lib/Net/Jabber/MUC.pm
rc2bed55 r892568b 64 64 $self->{JID} = $args{jid}; 65 65 $self->{PRESENCE} = { }; 66 $self->{ANONYMOUS} = 1; 66 67 67 68 bless($self, $class); … … 188 189 delete $self->{PRESENCE}->{$from->GetJID('full')}; 189 190 } elsif($type eq 'available') { 190 $self->{PRESENCE}->{$from->GetJID('full')} = $from; 191 $self->{PRESENCE}->{$from->GetJID('full')} = {ROOMNICK => $from}; 192 my $x = $presence->GetX('http://jabber.org/protocol/muc#user'); 193 if($x && $x->DefinedItem()) { 194 my $item = $x->GetItem(); 195 if($item->DefinedJID()) { 196 $self->{PRESENCE}->{$from->GetJID('full')}->{FULLJID} = $item->GetJID(); 197 $self->{ANONYMOUS} = 0; 198 } 199 } 191 200 } 192 201 } … … 207 216 } 208 217 218 =head2 GetFullJID roomjid 219 220 Given the roomnick of a user in the MUC, return their full NIC if the 221 MUC makes it available. If the MUC is anonymous or the user does not 222 exist in the MUC, return undef. 223 224 =cut 225 226 sub GetFullJID { 227 my $self = shift; 228 my $jid = shift; 229 230 $jid = $jid->GetJID('full') if UNIVERSAL::isa($jid, 'Net::Jabber::JID'); 231 my $pres = $self->{PRESENCE}->{$jid}; 232 return unless $pres; 233 return $pres->{FULLJID}; 234 } 235 209 236 =head2 Presence 210 237 … … 215 242 sub Presence { 216 243 my $self = shift; 217 return values %{$self->{PRESENCE}}; 244 return map {$_->{ROOMNICK}} values %{$self->{PRESENCE}}; 245 } 246 247 =head2 Anonymous 248 249 Returns true if the MUC is anonymous (hides participants real JIDs) 250 251 =cut 252 253 sub Anonymous { 254 my $self = shift; 255 return $self->{ANONYMOUS}; 218 256 } 219 257
Note: See TracChangeset
for help on using the changeset viewer.