AnyEvent-XMPP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

           passing the hostname specified by 'host' for ::Connection to
           Authen::SASL's client_new method.
         - fixed bug in ::XMPP::Client where remove_account didn't work
           as expected (and set_accounts).

0.2 Sun Dec 28 15:09:25 CET 2008
         - Using the better tested AnyEvent::Handle and
           AnyEvent::Socket for DNS resolution, TCP connect and TLS now.
         - override_host and override_port have been removed.
         - weird DNS SRV handling and comments have been removed.
         - removed blocked_write option and drain function, send_buffer_empty event
           should be used. blocking behaviour should be emulated with send_buffer_empty
           at the toplevel of the program.
         - improved message tracking api in ::IM::Account
         - added added_account/removed_account events to ::Client
         - added set_accounts() function to ::Client
         - removed unneccessary sample (devcl)
         - renamed module from Net::XMPP2 to AnyEvent::XMPP
         - minor additions to ::Ext::Pubsub.

0.14 Fri Aug  1 12:13:11 CEST 2008

TODO  view on Meta::CPAN

   - implement status code mappings
      - that room logged
      - non anonymous
   x look over error reporting (more conclusive errors!)
      x change presenceerror to something more clear
      x entering members only
      x banned
      x nickname conflict
         - with resolution
      x max users
      x locked
      x 11. Error and Status Codes
         x 11.1 Error Codes
         - 11.2 Status Codes
   - managing of discussion history when entering
      - maxchars, maxstanzas, seconds, since
   x nickname changes
      x make own possible
      x log changes of other people nicknames
      - according errors
   - test changing of presence of a user

lib/AnyEvent/XMPP/Error/MUC.pm  view on Meta::CPAN

=over 4

=cut

sub init {
   my ($self) = @_;
   if ($self->{presence_error}) {
      my %mapping = (
         'not-authorized' => 'password_required',
         'forbidden'      => 'banned',
         'item-not-found' => 'room_locked',
         'not-allowed'    => 'room_not_creatable',
         'not-acceptable' => 'use_reserved_nick',
         'registration-required' => 'not_on_memberlist',
         'conflict'              => 'nickname_in_use',
         'service-unavailable'   => 'room_full',
      );
      my $cond = $self->{presence_error}->{error_cond};
      $self->{type} = $mapping{$cond};
   }
   if ($self->{message_node}) {

lib/AnyEvent/XMPP/Error/MUC.pm  view on Meta::CPAN

Entering a room Inform user that a password is required.

(Condition: not-authorized, Code: 401)

=item banned

Entering a room Inform user that he or she is banned from the room

(Condition: forbidden, Code: 403)

=item room_locked

Entering a room Inform user that the room does not exist and someone
is currently creating it.

(Condition: item-not-found, Code: 404)

=item room_not_creatable

Entering a room Inform user that room creation is restricted

lib/AnyEvent/XMPP/Ext/MUC.pm  view on Meta::CPAN

=item B<join_room ($con, $jid, $nick, %args)>

This method joins a room.

C<$con> should be the L<AnyEvent::XMPP::IM::Connection> object that
is to be used to send the necessary stanzas.
C<$jid> should be the bare JID of the room.
C<$nick> should be your desired nickname in the room.

When you successfully entered the room a C<enter> event is emitted.  In case
you created the room, and it is locked, a C<locked> event is emitted.  Please
look in the C<EVENTS> section below for more details about how to handle
C<locked> rooms. (You won't have to care about locked rooms if you
didn't disable the C<create_instant> flag in C<%args>).

If an error occurred and we couldn't join the room, the first two arguments are
undef and the third is a L<AnyEvent::XMPP::Error::MUC> object signalling the error.

C<%args> hash can contain one of the following keys:

=over 4

=item timeout => $timeout_in_secs

lib/AnyEvent/XMPP/Ext/MUC.pm  view on Meta::CPAN

   my ($self, $con, $jid, $nick, %args) = @_;

   unless (exists $args{create_instant}) {
      $args{create_instant} = 1;
   }

   my $timeout = $args{timeout} || $self->{join_timeout};

   my $room = $self->install_room ($con, $jid);

   $room->{locked_cb} =
      $args{create_instant} ? sub {
         my ($room) = @_;

         $room->make_instant (sub {
            my ($room, $error) = @_;

            if ($error) {
               $self->event (join_error => $room, $error);
            } else {
               $self->event (enter => $room, $room->get_me);

lib/AnyEvent/XMPP/Ext/MUC.pm  view on Meta::CPAN

=item error => $room, $error

This event is emitted when any error occurred.
C<$error> is a L<AnyEvent::XMPP::Error::MUC> object.

=item join_error => $room, $error

This event is emitted when a error occurred when joining a room.
C<$error> is a L<AnyEvent::XMPP::Error::MUC> object.

=item locked => $room

This event is emitted when you disabled the 'create_instant'
flag when calling C<join_room>. It means that you just created
a new room, which is locked. You need to configure it before
it is unlocked and others can enter.

Please consult the methods C<make_instant>, C<request_configuration> and
C<send_configuration> of L<AnyEvent::XMPP::Ext::MUC::Room> for more information
about how to configure a room.

B<NOTE:> You won't get another event when you finished configuring the room, so
you maybe want to call this on the C<AnyEvent::XMPP::Ext::MUC> object when you
finished configuring the room successfully:

   $muc->event (enter => $room, $room->get_me);

That could be helpful if you want to place some generic
stuff in your C<enter> event handlers.

B<NOTE2:> If you didn't disable the C<create_instant> flag of C<join_room> you
won't have to care about a C<locked> event, as everything will be internally
handled for you and you will get an C<enter> event if the room is finally
setted up.

=item enter => $room, $user

This event is emitted when we successfully joined the room.
C<$user> is a L<AnyEvent::XMPP::Ext::MUC::User> object which is
the user handle for ourself.

=item join => $room, $user

lib/AnyEvent/XMPP/Ext/MUC/Room.pm  view on Meta::CPAN

         );
         $self->event (join_error => $muce);

      } else {
         if (cmp_jid ($from, $self->nick_jid)) {
            my $user = $self->add_user_xml ($node);
            $self->{status} = JOINED;
            $self->{me} = $user;

            if ($user->did_create_room) {
               if ($self->{locked_cb}) {
                  (delete $self->{locked_cb})->($self);

               } else {
                  $self->event ('locked');
               }
            } else {
               $self->event (enter => $user);
            }

         } else {
            $self->add_user_xml ($node);
         }
      }

t/z_05_muc2.t  view on Meta::CPAN

         my ($muc, $room) = @_;

         $muc->join_room ($cl->{acc}->connection, $ROOM, "test1owner",
                          create_instant => 0);
      },
      leave => sub {
         my ($muc, $room) = @_;

         $room_cnt_after_leave = scalar ($muc->get_rooms ($cl->{acc}->connection));
      },
      locked => sub {
         my ($muc, $room) = @_;

         $cl->{room} = $room;
         $sr_created = 1;
         $room->request_configuration (sub {
            my ($form, $error) = @_;

            if ($form) {

               if ($form->get_field ('muc#roomconfig_passwordprotectedroom')



( run in 0.511 second using v1.01-cache-2.11-cpan-49f99fa48dc )