项目作者: anewusername

项目描述 :
Bot for bridging Matrix and XMPP
高级语言: Python
项目地址: git://github.com/anewusername/mxpp.git
创建时间: 2016-10-27T02:49:39Z
项目社区:https://github.com/anewusername/mxpp

开源协议:Other

下载


mxpp

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 in config.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.
  • 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
      in config.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 room_jid@roomserver.com and leavemuc room_jid@roomserver.com
      allow you to join and leave multi-user chats.
  • 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 in config.yaml
    • You can send a message directly to a jid without creating a room using
      the /m jid@example.com 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

Installation

Install the dependencies:

  1. 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

  1. 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?)

TODO

  • 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)