comparison libervia.py @ 242:a25aa882e09a

browser_side: add context menu for contact: - for now only when a blog exists on the current libervia's server - retrieve the server domain with the bridge method getNewAccountDomain - getNewAccountDomain is also used to display the current libervia domain in the dialogs (new contact default domain, messages for invalid contact or group)
author souliane <souliane@mailoo.org>
date Fri, 18 Oct 2013 11:14:55 +0200
parents b911f2b43fd4
children 43a27ffc74df
comparison
equal deleted inserted replaced
241:86055ccf69c3 242:a25aa882e09a
116 "getHistory", "getPresenceStatus", "joinMUC", "mucLeave", "getRoomsJoined", 116 "getHistory", "getPresenceStatus", "joinMUC", "mucLeave", "getRoomsJoined",
117 "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", 117 "launchTarotGame", "getTarotCardsPaths", "tarotGameReady",
118 "tarotGameContratChoosed", "tarotGamePlayCards", "launchRadioCollective", 118 "tarotGameContratChoosed", "tarotGamePlayCards", "launchRadioCollective",
119 "getWaitingSub", "subscription", "delContact", "updateContact", "getCard", 119 "getWaitingSub", "subscription", "delContact", "updateContact", "getCard",
120 "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction", 120 "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction",
121 "disconnect", "chatStateComposing" 121 "disconnect", "chatStateComposing", "getNewAccountDomain"
122 ]) 122 ])
123
123 124
124 class BridgeSignals(LiberviaJsonProxy): 125 class BridgeSignals(LiberviaJsonProxy):
125 RETRY_BASE_DELAY = 1000 126 RETRY_BASE_DELAY = 1000
126 127
127 def __init__(self, host): 128 def __init__(self, host):
302 self.bridge.call('getContacts', self._getContactsCB) 303 self.bridge.call('getContacts', self._getContactsCB)
303 self.bridge.call('getParamsUI', self._getParamsUICB) 304 self.bridge.call('getParamsUI', self._getParamsUICB)
304 self.bridge_signals.call('getSignals', self._getSignalsCB) 305 self.bridge_signals.call('getSignals', self._getSignalsCB)
305 #We want to know our own jid 306 #We want to know our own jid
306 self.bridge.call('getProfileJid', self._getProfileJidCB) 307 self.bridge.call('getProfileJid', self._getProfileJidCB)
308
309 def domain_cb(value):
310 self._defaultDomain = value
311 print("new account domain: %s" % value)
312
313 def domain_eb(value):
314 self._defaultDomain = "libervia.org"
315
316 self.bridge.call("getNewAccountDomain", (domain_cb, domain_eb))
307 317
308 def _getContactsCB(self, contacts_data): 318 def _getContactsCB(self, contacts_data):
309 for contact in contacts_data: 319 for contact in contacts_data:
310 jid, attributes, groups = contact 320 jid, attributes, groups = contact
311 self._newContactCb(jid, attributes, groups) 321 self._newContactCb(jid, attributes, groups)
573 def _radioColGenericCb(self, event_name, room_jid_s, args): 583 def _radioColGenericCb(self, event_name, room_jid_s, args):
574 for lib_wid in self.libervia_widgets: 584 for lib_wid in self.libervia_widgets:
575 if isinstance(lib_wid, panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s: 585 if isinstance(lib_wid, panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid_s:
576 getattr(lib_wid.getGame("RadioCol"), event_name)(*args) 586 getattr(lib_wid.getGame("RadioCol"), event_name)(*args)
577 587
578
579 def _getPresenceStatusCb(self, presence_data): 588 def _getPresenceStatusCb(self, presence_data):
580 for entity in presence_data: 589 for entity in presence_data:
581 for resource in presence_data[entity]: 590 for resource in presence_data[entity]:
582 args = presence_data[entity][resource] 591 args = presence_data[entity][resource]
583 self._presenceUpdateCb("%s/%s" % (entity, resource), *args) 592 self._presenceUpdateCb("%s/%s" % (entity, resource), *args)