plugin XEP-0045: fix /join text command

This commit is contained in:
Goffi 2021-06-03 17:59:41 +02:00
commit 9d3f2be7b1

View file

@ -674,10 +674,19 @@ class XEP_0045(object):
@command (all): JID
- JID: room to join (on the same service if full jid is not specified)
"""
if mess_data["unparsed"].strip():
room_jid = self.text_cmds.getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
nick = (self.getRoomNick(client, room_jid) or
client.jid.user)
room_raw = mess_data["unparsed"].strip()
if room_raw:
if self.isJoinedRoom(client, mess_data["to"]):
# we use the same service as the one from the room where the command has
# been entered if full jid is not entered
muc_service = mess_data["to"].host
nick = self.getRoomNick(client, mess_data["to"]) or client.jid.user
else:
# the command has been entered in a one2one conversation, so we use
# our server MUC service as default service
muc_service = client.muc_service or ""
nick = client.jid.user
room_jid = self.text_cmds.getRoomJID(room_raw, muc_service)
self.join(client, room_jid, nick, {})
return False
@ -688,8 +697,9 @@ class XEP_0045(object):
@command (group): [ROOM_JID]
- ROOM_JID: jid of the room to live (current room if not specified)
"""
if mess_data["unparsed"].strip():
room = self.text_cmds.getRoomJID(mess_data["unparsed"].strip(), mess_data["to"].host)
room_raw = mess_data["unparsed"].strip()
if room_raw:
room = self.text_cmds.getRoomJID(room_raw, mess_data["to"].host)
else:
room = mess_data["to"]