Fix #2335 (crash on /cycle with room without userpart)

This commit is contained in:
mathieui 2013-07-29 19:31:33 +02:00
parent d64a95bd3b
commit cbcac03510
2 changed files with 9 additions and 10 deletions

View file

@ -1811,14 +1811,14 @@ class Core(object):
nick = tab.own_nick nick = tab.own_nick
else: else:
room = info.bare room = info.bare
if room.find('@') == -1 and not server_root: # 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 # use the server of the current room if available
# check if the current room's name has a server # check if the current room's name has a server
if isinstance(self.current_tab(), tabs.MucTab) and\ if isinstance(self.current_tab(), tabs.MucTab) and\
self.current_tab().get_name().find('@') != -1: self.current_tab().get_name().find('@') != -1:
room += '@%s' % safeJID(self.current_tab().get_name()).domain room += '@%s' % safeJID(self.current_tab().get_name()).domain
else: else:
room = args[0] room = args[0]
room = room.lower() room = room.lower()
if room in self.pending_invites: if room in self.pending_invites:
del self.pending_invites[room] del self.pending_invites[room]

View file

@ -66,8 +66,7 @@ def change_nick(core, jid, nick, status=None, show=None):
def join_groupchat(core, jid, nick, passwd='', maxhistory=None, status=None, show=None, seconds=0): def join_groupchat(core, jid, nick, passwd='', maxhistory=None, status=None, show=None, seconds=0):
xmpp = core.xmpp xmpp = core.xmpp
jid = safeJID(jid) stanza = xmpp.makePresence(pto='%s/%s' % (jid, nick), pstatus=status, pshow=show)
stanza = xmpp.makePresence(pto="%s/%s" % (jid, nick), pstatus=status, pshow=show)
x = ET.Element('{http://jabber.org/protocol/muc}x') x = ET.Element('{http://jabber.org/protocol/muc}x')
if passwd: if passwd:
passelement = ET.Element('password') passelement = ET.Element('password')