plugin XEP-0045: fix /join text command
This commit is contained in:
parent
26875b8552
commit
9d3f2be7b1
2 changed files with 17 additions and 7 deletions
|
|
@ -327,7 +327,7 @@ class TextCommands(object):
|
|||
if arg[-1] != "@":
|
||||
return jid.JID(arg)
|
||||
return jid.JID(arg + service_jid)
|
||||
return jid.JID("%s@%s" % (arg, service_jid))
|
||||
return jid.JID(f"{arg}@{service_jid}")
|
||||
|
||||
def feedBack(self, client, message, mess_data, info_type=FEEDBACK_INFO_TYPE):
|
||||
"""Give a message back to the user"""
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue