comparison src/plugins/plugin_xep_0045.py @ 1384:73f8582c7c99

plugins XEP-0045, XEP-0249: allow to join / invite without specifying the JID's host part (use client's values)
author souliane <souliane@mailoo.org>
date Tue, 24 Mar 2015 07:34:32 +0100
parents 0d12d4e32664
children c7082457d03f
comparison
equal deleted inserted replaced
1383:59c48796759e 1384:73f8582c7c99
361 """ 361 """
362 profile = self.host.memory.getProfileName(profile_key) 362 profile = self.host.memory.getProfileName(profile_key)
363 if not self.checkClient(profile): 363 if not self.checkClient(profile):
364 return 364 return
365 if room_jid_s: 365 if room_jid_s:
366 muc_service = self.host.getClient(profile).muc_service
366 try: 367 try:
367 room_jid = jid.JID(room_jid_s) 368 room_jid = jid.JID(room_jid_s)
368 except (RuntimeError, jid.InvalidFormat, AttributeError): 369 except (RuntimeError, jid.InvalidFormat, AttributeError):
369 mess = _("Invalid room JID: %s") % room_jid_s 370 return defer.fail(jid.InvalidFormat(_(u"Invalid room identifier: '%s'. Please give a room short or full identifier like 'room' or 'room@%s'.") % (room_jid_s, unicode(muc_service))))
370 log.warning(mess) 371 if not room_jid.user:
371 self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) 372 room_jid.user, room_jid.host = room_jid.host, muc_service
372 return defer.succeed(None)
373 else: 373 else:
374 room_jid = self.getUniqueName(profile_key=profile_key) 374 room_jid = self.getUniqueName(profile_key=profile_key)
375 # TODO: error management + signal in bridge 375 # TODO: error management + signal in bridge
376 d = self.join(room_jid, nick, options, profile) 376 d = self.join(room_jid, nick, options, profile)
377 return d.addCallback(lambda room: room.roomJID.userhost()) 377 return d.addCallback(lambda room: room.roomJID.userhost())