mxpp is a bot which bridges Matrix and one-to-one XMPP chat.
I wrote this bot to finally get persistent chat history for my gchat/hangouts/google talk conversations, and to evaluate Matrix for future use, so it should probably work for those use cases.
Functionality
- The bot creates one Matrix room for each user on your contact list,
then invites a list of Matrix users (of your choosing) to all the rooms.
- Enabled with
send_messages_to_jid_rooms
option inconfig.yaml
and can be controlled with per-user granularity - Room name is set to the contact's name.
- Room topic is set to the contact's JID.
- Any text sent to the room is sent to the contact's JID.
- Any text received from the contact's JID is sent as a notice to the room.
- Enabled with
- A room named "XMPP Control Room" is created
- Presence info ("available" or "unavailable") is sent to this room,
controllable per-user with the
send_presences_to_control
option inconfig.yaml
- Text command
purge
makes the bot leave from any rooms which do not correspond to a roster entry (excluding the two special rooms), and also from any unoccupied rooms (eg. if the user left). - Text command
refresh
probes the presence of all XMPP contacts and requests a roster update from the server. - Text commands
joinmuc [email protected]
andleavemuc [email protected]
allow you to join and leave multi-user chats.
- Presence info ("available" or "unavailable") is sent to this room,
controllable per-user with the
- A room named "XMPP All Chat" is created
- All inbound and outbound chat messages are logged here.
- Enabled with per-user granularity using the
send_messages_to_all_chat
option inconfig.yaml
- You can send a message directly to a jid without creating a room using
the
/m [email protected] your message here
syntax in this room.
- If the bot is restarted, it recreates its room-JID map based on the room topics, and continues as before.
- Currently, the bot automatically accepts anytime anyone asks to add you on XMPP, and also automatically adds them to your contact roster.
- Multi-user chats (MUCs) are handled by creating additional rooms
- Room topic is set to "[email protected]"
- To join a MUC, send a message saying
joinmuc [email protected]
to the "XMPP Control Room" - To leave a MUC, send a message saying
leavemuc [email protected]
to the "XMPP Control Room". Alternatively, leave the MUC room and send the messagepurge
instead.
Install the dependencies:
pip3 install -r requirements.txt
Edit config.yaml to set your usernames, passwords, and servers.
If you're using your own homeserver and you have more than a handful of
XMPP contacts, you'll probably want to loosen the rate limits on your
homeserver (see homeserver.yaml
for synapse), or you'll have to
wait multiple minutes while the bot creates a bunch of new rooms.
You should probably also set your Matrix client to auto-accept new room invitations for the first run of the bot, so you don't have to manually accept each invitation.
From the same directory as config.yaml
, run
python3 -m mxpp.main
Dependencies:
- python >=3.5 (written and tested with 3.5)
- sleekXMPP
- matrix_client (currently requires git version)
- pyyaml
- and their dependencies (dnspython, requests, others?)
- Set bot's presence for each room individually (impossible with current Matrix m.presence API)
- Require higher-than-default power-level to speak in All-chat (i.e., only let the bot talk in all-chat) (waiting on matrix_client pull request)