XEP-0045: Better component handling
This commit is contained in:
parent
1e23167ce4
commit
6369ee0e5f
@ -136,22 +136,27 @@ class XEP_0045(BasePlugin):
|
|||||||
|
|
||||||
def handle_groupchat_invite(self, inv):
|
def handle_groupchat_invite(self, inv):
|
||||||
""" Handle an invite into a muc. """
|
""" Handle an invite into a muc. """
|
||||||
if inv['from'] not in self.rooms.keys():
|
if self.xmpp.is_component:
|
||||||
self.xmpp.event("groupchat_invite", inv)
|
self.xmpp.event('groupchat_invite', inv)
|
||||||
|
else:
|
||||||
|
if inv['from'] not in self.rooms.keys():
|
||||||
|
self.xmpp.event("groupchat_invite", inv)
|
||||||
|
|
||||||
def handle_groupchat_decline(self, decl):
|
def handle_groupchat_decline(self, decl):
|
||||||
"""Handle an invitation decline."""
|
"""Handle an invitation decline."""
|
||||||
if decl['from'] in self.room.keys():
|
if self.xmpp.is_component:
|
||||||
self.xmpp.event('groupchat_decline', decl)
|
self.xmpp.event('groupchat_invite', decl)
|
||||||
|
else:
|
||||||
|
if decl['from'] in self.room.keys():
|
||||||
|
self.xmpp.event('groupchat_decline', decl)
|
||||||
|
|
||||||
def handle_config_change(self, msg):
|
def handle_config_change(self, msg):
|
||||||
"""Handle a MUC configuration change (with status code)."""
|
"""Handle a MUC configuration change (with status code)."""
|
||||||
self.xmpp.event('groupchat_config_status', msg)
|
self.xmpp.event('groupchat_config_status', msg)
|
||||||
self.xmpp.event('muc::%s::config_status' % msg['from'].bare , msg)
|
self.xmpp.event('muc::%s::config_status' % msg['from'].bare , msg)
|
||||||
|
|
||||||
def handle_groupchat_presence(self, pr):
|
def client_handle_presence(self, pr: Presence):
|
||||||
""" Handle a presence in a muc.
|
"""As a client, handle a presence stanza"""
|
||||||
"""
|
|
||||||
got_offline = False
|
got_offline = False
|
||||||
got_online = False
|
got_online = False
|
||||||
if pr['muc']['room'] not in self.rooms.keys():
|
if pr['muc']['room'] not in self.rooms.keys():
|
||||||
@ -177,6 +182,13 @@ class XEP_0045(BasePlugin):
|
|||||||
if got_online:
|
if got_online:
|
||||||
self.xmpp.event("muc::%s::got_online" % entry['room'], pr)
|
self.xmpp.event("muc::%s::got_online" % entry['room'], pr)
|
||||||
|
|
||||||
|
def handle_groupchat_presence(self, pr: Presence):
|
||||||
|
""" Handle a presence in a muc."""
|
||||||
|
if self.xmpp.is_component:
|
||||||
|
self.xmpp.event('groupchat_presence', pr)
|
||||||
|
else:
|
||||||
|
self.client_handle_presence(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.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user