コード例 #1
0
def make_xmpp_client(connection_info: LoginConfig):
    client = ClientXMPP('%s@%s' % (connection_info.user, connection_info.host),
                        connection_info.password)
    client.use_signals()

    # TODO: Make sure all events are handled, and check if we should support other XEPs.
    client.register_plugin('xep_0030')  # Service Discovery
    client.register_plugin('xep_0045')  # Multi-User Chat
    client.register_plugin('xep_0085')  # Chat State Notifications
    client.register_plugin('xep_0199')  # XMPP Ping

    # TODO: Use XEP 0079 to add delivery failure notifications once the sleekxmpp plugin for this XEP is released.
    # client.register_plugin('xep_0079')  # Advanced Message Processing

    return client