AnyEvent-XMPP

 view release on metacpan or  search on metacpan

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


=cut

sub get_me {
   my ($self) = @_;
   $self->{me}
}

=item B<get_user_jid ($jid)>

This method looks whether a user with the JID C<$jid> exists
in the room. That means whether the node and domain part of the
JID match the rooms node and domain part, and the resource part of the
JID matches a joined nick.

=cut

sub get_user_jid {
   my ($self, $jid) = @_;
   my ($room, $srv, $nick) = split_jid ($jid);
   return unless prep_join_jid ($room, $srv) eq prep_bare_jid $self->jid;

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

sub init {
    my ($self) = @_;

    set_xmpp_ns_alias(receipts => 'urn:xmpp:receipts');

    $self->reg_cb(
        ext_before_message_xml => sub {
            my ($self, $con, $node) = @_;

            # Figure out if this is a receive receipt (XEP-0184), such a message
            # looks like this:
            #  <message from="recipient@jabber.ccc.de/androidDc9226M8"
            #   id="CA597-36"
            #   to="me@jabber.ccc.de/18327446281349735808246801">
            #    <received id="foobar23" xmlns="urn:xmpp:receipts"/>
            #  </message>
            my ($receipt) = $node->find_all ([qw/receipts received/]);
            if (defined($receipt)) {
                my $id = $receipt->attr('id');
                print "(xep0184) message $id acknowledged\n" if $self->{debug};
                delete $timers{$id};

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

            # Figure out if this is a message which requests a receipt, such as
            # <message from="me@jabber.ccc.de/Psi+" id="aae0a" to="recipient@jabber.ccc.de/presence" type="chat" xml:lang="en">
            #   <body>Did you get this?</body>
            #   <request xmlns="urn:xmpp:receipts"/>
            # </message>
            my ($request) = $node->find_all ([qw/receipts request/]);
            if (defined($request)) {
                my $id = $node->attr('id');
                print "(xep0184) sending receipt for $id\n" if $self->{debug};

                # A receipt looks like this:
                # <message from="recipient@jabber.ccc.de/presence" to="me@jabber.ccc.de/Psi+">
                # <received xmlns="urn:xmpp:receipts" id="aae0a"/>
                # </message>
                $con->send_message(
                    $node->attr('from'),
                    $node->attr('type'),
                    # Add a receipt request tag to the message, like this:
                    # <received xmlns='urn:xmpp:receipts' id="aae0a"/>
                    sub {
                        my $w = shift;

lib/AnyEvent/XMPP/IM/Account.pm  view on Meta::CPAN

sub nickname {
   my ($self) = @_;
   # FIXME: fetch real nickname from server somehow? Does that exist?
   # eg. from the roster?
   my ($user, $host, $res) = split_jid ($self->bare_jid);
   $user
}

=item B<nickname_for_jid ($jid)>

This method transforms the C<$jid> to a nickname. It looks the C<$jid>
up in the roster and looks for a nickname. If no nickname could be found
in the roster it returns the node part for the C<$jid>.

=cut

sub nickname_for_jid {
   my ($self, $jid) = @_;

   if ($self->is_connected) {
      my $c = $self->connection->get_roster->get_contact ($jid);
      return $c ? $c->nickname : node_jid ($jid);



( run in 0.784 second using v1.01-cache-2.11-cpan-64827b87656 )