XEP-0045: Add a groupchat_join MUC event for components

This commit is contained in:
mathieui 2021-01-12 20:29:27 +01:00
parent ca465032e7
commit 2b11d81b86

View file

@ -91,6 +91,14 @@ class XEP_0045(BasePlugin):
StanzaPath("presence/muc"), StanzaPath("presence/muc"),
self.handle_groupchat_presence, self.handle_groupchat_presence,
)) ))
if self.xmpp.is_component:
self.xmpp.register_handler(
Callback(
'MUCPresenceJoin',
StanzaPath("presence/muc_join"),
self.handle_groupchat_join,
))
self.xmpp.register_handler( self.xmpp.register_handler(
Callback( Callback(
'MUCError', 'MUCError',
@ -189,6 +197,10 @@ class XEP_0045(BasePlugin):
else: else:
self.client_handle_presence(pr) self.client_handle_presence(pr)
def handle_groupchat_join(self, pr: Presence):
"""Received a join presence (as a component)"""
self.xmpp.event('groupchat_join', pr)
def handle_groupchat_message(self, msg: Message) -> None: def handle_groupchat_message(self, msg: Message) -> None:
""" Handle a message event in a muc. """ Handle a message event in a muc.
""" """