Mercurial > libervia-backend
diff src/plugins/plugin_xep_0045.py @ 1407:77f07ea90420
plugin XEP-0045, quick_frontend, primitivus: replace C.DEFAULT_MUC by bridge method getDefaultMUC (value is defined in plugin XEP-0045 and can be overriden with the config file)
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 09 Apr 2015 11:27:13 +0200 |
parents | 069ad98b360d |
children | 3265a2639182 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py Thu Apr 09 11:24:25 2015 +0200 +++ b/src/plugins/plugin_xep_0045.py Thu Apr 09 11:27:13 2015 +0200 @@ -48,6 +48,10 @@ AFFILIATIONS = ('owner', 'admin', 'member', 'none', 'outcast') +CONFIG_SECTION = u'plugin muc' + +default_conf = {"default_muc": u'sat@chat.jabberfr.org'} + class UnknownRoom(Exception): pass @@ -72,6 +76,7 @@ host.bridge.addMethod("getRoomsSubjects", ".plugin", in_sign='s', out_sign='a(ss)', method=self.getRoomsSubjects) host.bridge.addMethod("getUniqueRoomName", ".plugin", in_sign='ss', out_sign='s', method=self._getUniqueName) host.bridge.addMethod("configureRoom", ".plugin", in_sign='ss', out_sign='s', method=self._configureRoom, async=True) + host.bridge.addMethod("getDefaultMUC", ".plugin", in_sign='', out_sign='s', method=self.getDefaultMUC) host.bridge.addSignal("roomJoined", ".plugin", signature='sasss') # args: room_jid, room_nicks, user_nick, profile host.bridge.addSignal("roomLeft", ".plugin", signature='ss') # args: room_jid, profile host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s') # args: room_jid, user_nick, user_data, profile @@ -337,6 +342,13 @@ muc_service = muc_service.userhost() return jid.JID("%s@%s" % (room_name, muc_service)) + def getDefaultMUC(self): + """Return the default MUC. + + @return: unicode + """ + return self.host.memory.getConfig(CONFIG_SECTION, 'default_muc', default_conf['default_muc']) + def join(self, room_jid, nick, options, profile_key=C.PROF_KEY_NONE): def _errDeferred(exc_obj=Exception, txt='Error while joining room'): d = defer.Deferred()