errbot.backends.xmpp module

class errbot.backends.xmpp.XMPPBackend(config)[source]

Bases: errbot.core.ErrBot

__init__(config)[source]

Those arguments will be directly those put in BOT_IDENTITY

build_identifier[source]
build_reply(msg, text=None, private=False, threaded=False)[source]

Should be implemented by the backend

change_presence(status: str = 'online', message: str = '') → None[source]

Signal a presence change for the bot. Should be overridden by backends with a super().send_message() call.

chat_topic(event)[source]
connected(data)[source]

Callback for connection events

contact_offline(event)[source]
contact_online(event)[source]
create_connection()[source]
disconnected(data)[source]

Callback for disconnection events

incoming_message(xmppmsg)[source]

Callback for message events

mode
prefix_groupchat_reply(message, identifier)[source]

Patches message with the conventional prefix to ping the specific contact For example: @gbin, you forgot the milk !

query_room(room)[source]

Query a room for information.

Parameters:room – The JID/identifier of the room to query for.
Returns:An instance of XMPPMUCRoom.
room_factory

alias of XMPPRoom

roomoccupant_factory

alias of XMPPRoomOccupant

rooms()[source]

Return a list of rooms the bot is currently in.

Returns:A list of XMPPMUCRoom instances.
send_message(msg)[source]

This needs to be overridden by the backends with a super() call.

Parameters:msg – the message to send.
Returns:None
serve_forever()[source]

Connect the back-end to the server and serve forever.

Back-ends MAY choose to re-implement this method, in which case they are responsible for implementing reconnection logic themselves.

Back-ends SHOULD trigger connect_callback() and disconnect_callback() themselves after connection/disconnection.

user_changed_status(event)[source]
user_joined_chat(event)[source]
user_left_chat(event)[source]
class errbot.backends.xmpp.XMPPConnection(jid, password, feature=None, keepalive=None, ca_cert=None, server=None, use_ipv6=None, bot=None, ssl_version=None)[source]

Bases: object

__init__(jid, password, feature=None, keepalive=None, ca_cert=None, server=None, use_ipv6=None, bot=None, ssl_version=None)[source]

Initialize self. See help(type(self)) for accurate signature.

add_event_handler(name, cb)[source]
connect()[source]
del_event_handler(name, cb)[source]
disconnect()[source]
serve_forever()[source]
session_start(_)[source]
class errbot.backends.xmpp.XMPPIdentifier(node, domain, resource)[source]

Bases: errbot.backends.base.Identifier

This class is the parent and the basic contract of all the ways the backends are identifying a person on their system.

__init__(node, domain, resource)[source]

Initialize self. See help(type(self)) for accurate signature.

client
domain
email
fullname
nick
node
person
resource
class errbot.backends.xmpp.XMPPPerson(node, domain, resource)[source]

Bases: errbot.backends.xmpp.XMPPIdentifier, errbot.backends.base.Person

aclattr
class errbot.backends.xmpp.XMPPRoom(room_jid, bot)[source]

Bases: errbot.backends.xmpp.XMPPIdentifier, errbot.backends.base.Room

__init__(room_jid, bot)[source]

Initialize self. See help(type(self)) for accurate signature.

configure()[source]

Configure the room.

Currently this simply sets the default room configuration as received by the server. May be extended in the future to set a custom room configuration instead.

create()[source]

Not supported on this back-end (Slixmpp doesn’t support it). Will join the room to ensure it exists, instead.

destroy()[source]

Destroy the room.

Calling this on a non-existing room is a no-op.

exists

Boolean indicating whether this room already exists or not.

Getter:Returns True if the room exists, False otherwise.
invite(*args)[source]

Invite one or more people into the room.

*argsargs:One or more JID’s to invite into the room.
join(username=None, password=None)[source]

Join the room.

If the room does not exist yet, this will automatically call create() on it first.

joined

Boolean indicating whether this room has already been joined.

Getter:Returns True if the room has been joined, False otherwise.
leave(reason=None)[source]

Leave the room.

Parameters:reason – An optional string explaining the reason for leaving the room
occupants

The room’s occupants.

Getter:Returns a list of MUCOccupant instances.
Raises:MUCNotJoinedError if the room has not yet been joined.
topic

The room topic.

Getter:Returns the topic (a string) if one is set, None if no topic has been set at all.
Raises:RoomNotJoinedError if the room has not yet been joined.
class errbot.backends.xmpp.XMPPRoomOccupant(node, domain, resource, room)[source]

Bases: errbot.backends.xmpp.XMPPPerson, errbot.backends.base.RoomOccupant

__init__(node, domain, resource, room)[source]

Initialize self. See help(type(self)) for accurate signature.

nick
person
Returns:a backend specific unique identifier representing the person you are talking to.
real_jid

The JID of the room occupant, they used to login. Will only work if the errbot is moderator in the MUC or it is not anonymous.

room

Some backends have the full name of a user.

Returns:the fullname of this user if available.
errbot.backends.xmpp.split_identifier(txtrep)[source]