AnyEvent::XMPP::Ext::MUC::RoomInfo - Room information


AnyEvent-XMPP documentation Contained in the AnyEvent-XMPP distribution.

Index


Code Index:

NAME

Top

AnyEvent::XMPP::Ext::MUC::RoomInfo - Room information

SYNOPSIS

Top

DESCRIPTION

Top

This module represents the room information for a MUC.

METHODS

Top

new (%args)
disco_info

This method returns the info discovery object AnyEvent::XMPP::Ext::Disco::Info for the disco query that this roominfo was obtained from.

as_debug_string

Returns the MUC room information as string for debugging.

AUTHOR

Top

Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>

COPYRIGHT & LICENSE

Top


AnyEvent-XMPP documentation Contained in the AnyEvent-XMPP distribution.
package AnyEvent::XMPP::Ext::MUC::RoomInfo;
use strict;
use AnyEvent::XMPP::Namespaces qw/xmpp_ns/;

sub new {
   my $this = shift;
   my $class = ref($this) || $this;
   my $self = bless { @_ }, $class;
   $self->init;
   $self
}

sub init {
   my ($self) = @_;
   my $info = $self->{disco_info};
   my $df;
   if (my ($xdata) = $info->xml_node ()->find_all ([qw/data_form x/])) {
      $df = AnyEvent::XMPP::Ext::DataForm->new;
      $df->from_node ($xdata);
   }
   $self->{form} = $df;
}

sub disco_info {
   $_[0]->{disco_info}
}

sub as_debug_string {
   my ($self) = @_;
   my $info = $self->{disco_info};
   my @feats = keys %{$info->features};
   my $str = "MUC features for " . $info->jid . "\n";
   for (@feats) {
      if (/^muc_/) {
         $str .= "- $_\n";
      }
   }
   if (defined $self->{form}) {
      $str .= "form:\n";
      $str .= $self->{form}->as_debug_string;
   }
   $str
}

1;