NAME
Bot::Backbone::Service::JabberChat - Connect and chat with a Jabber server
VERSION
version 0.140280
SYNOPSIS
service jabber_chat => (
service => 'JabberChat',
username => 'bot',
domain => 'example.com',
resource => 'coolbot',
password => 'secret',
);
DESCRIPTION
Connects to and chats directly with other users and chat groups using a Jabber (XMPP) server.
ATTRIBUTES
username
This is the username (or localpart in XMPP parlance) to use when connecting to the Jabber server. E.g., if your bot's login name is bot@example.com
, the username is "bot".
domain
This is the domain (or domainpart) to use when connecting to the Jabber server. E.g., f your bot's login mame is bot@example.com
, the domain is "example.com".
group_domain
This is the domain to contact for group chats. Normally, this is the same as "domain", but with "conference." tacked on at the front.
resource
This is a the resourcepart of your login name. You may not really care what this is set to, but it shows up in some chat clients. By default it will be set to "backbone-bot", but you can set it something else, if you like.
password
This is the password to use when logging in to the Jabber server.
host
This is the host to contact to login. If not set, the "domain" will be used.
If you run your bot on Google Talk, you will probably want this set to talk.google.com.
port
This is the port to connect. If you do not set it to anything, the default of 5222 will be used.
connection_args
These are additional connection arguments to pass to the XMPP connector. See AnyEvent::XMPP::Connection for a list of available options.
xmpp_client
This is the XMPP client object for organizing connections.
xmpp_disco
This is the XMPP discovery extension helper.
xmpp_muc
This is the XMPP multi-user chat extension helper.
session_ready
Once the connection has been made and is ready to start sending and receiving messages, this will be set to true.
group_options
This is a list of multi-user chat groups the bot has joined or intends to join once "session_ready" becomes true.
METHODS
jid
This assembles a full JID (Jabber ID) using the "username", "domain", and "resource".
group_jid
my $group_jid = $chat->group_jid('bar');
Given a short group name, returns the bare JID for that group.
xmpp_account
Returns the XMPP account object.
xmpp_connection
Returns teh XMPP connection object.
xmpp_room
my $xmpp_room = $chat->xmpp_room('qux');
Returns the XMPP room object for the named room.
xmpp_contact
my $xmpp_contact = $chat->xmpp_contact('user@example.com/blah');
Given a JID, returns the XMPP contact object for that user.
initialize
Connects to the Jabber server and registers the events for receiving messages from it.
join_group
Asks to join the named multi-user chat groups on the Jabber server. If "session_ready" is false, the chat service will only record a desire to join the group. No actual join will take place. Once the session becomes ready, all pending groups will be joined.
If the session is ready already, then the group will be joined immediately.
EVENT HANDLERS
got_direct_message
Whenever someone sends the bot a direct message throught eh Jabber server, this handler is called. It builds a Bot::Backbone::Message and then passes that message on the associated chat consumers and the dispatcher.
got_group_message
Whenever someone posts to a conference room that the bot has joined, this method will be called to create a Bot::Backbone::Message and pass that message on to chat consumers and the dispatcher.
send_message
Sends a message to the Jabber server for a direct chat or group.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.