From 9e8860cd6abae3c41af085fc940853653f1ee9d6 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 5 Jun 2013 20:44:27 +0200 Subject: Fix joining a domain-only room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (e.g. “/join @conference.prosody.im”) - If the current tab is a MUC the @ prefix is mandatory as there is no way to tell if the user meant a room name or a domain. - If it is not a MUC, then the @ prefix is not mandatory (but works anyway) --- src/core.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 40661e89..a77868cb 100644 --- a/src/core.py +++ b/src/core.py @@ -1684,7 +1684,12 @@ class Core(object): room = safeJID(tab.get_name()).bare nick = tab.own_nick else: - info = safeJID(args[0]) + if args[0].startswith('@'): # we try to join a server directly + server_root = True + info = safeJID(args[0][1:]) + else: + info = safeJID(args[0]) + server_root = False if info == '' and len(args[0]) > 1 and args[0][0] == '/': nick = args[0][1:] elif info.resource == '': @@ -1703,15 +1708,14 @@ class Core(object): nick = tab.own_nick else: room = info.bare - if room.find('@') == -1: # no server is provided, like "/join hello" + if room.find('@') == -1 and not server_root: # no server is provided, like "/join hello" # use the server of the current room if available # check if the current room's name has a server if isinstance(self.current_tab(), tabs.MucTab) and\ self.current_tab().get_name().find('@') != -1: room += '@%s' % safeJID(self.current_tab().get_name()).domain - else: # no server could be found, print a message and return - self.information(_("You didn't specify a server for the room you want to join"), 'Error') - return + else: + room = args[0] room = room.lower() if room in self.pending_invites: del self.pending_invites[room] -- cgit v1.2.3