comparison src/browser/sat_browser/json.py @ 914:0c0551967bdf

server, browser: partial Libervia fix Libervia was broken following the refactorings. This commit partially fixes it : Libervia is starting, avatar, blog and message are working again, but not everything is restablished yet. following things have been fixed/changed: - new dependency: shortuuid - D-Bus bridge is working again - fixed naming in several bridge methods - register method changed to register_signal - fixed Chat widget, which was not working anymore since the refactoring - avatar now use avatarGet. Cache dir is accessible using a session specific uuid, to avoid cache leak (i.e. accessing cache of other profiles) - server: new uuid attribute in session data Browser code is not fully working yet, notably OTR and contact list are not fully fixed.
author Goffi <goffi@goffi.org>
date Sun, 26 Feb 2017 18:32:47 +0100
parents 58f611481e6d
children cf527974a0fa
comparison
equal deleted inserted replaced
913:58f611481e6d 914:0c0551967bdf
165 165
166 166
167 class RegisterCall(LiberviaJsonProxy): 167 class RegisterCall(LiberviaJsonProxy):
168 def __init__(self): 168 def __init__(self):
169 LiberviaJsonProxy.__init__(self, "/register_api", 169 LiberviaJsonProxy.__init__(self, "/register_api",
170 ["getSessionMetadata", "isConnected", "asyncConnect", "registerParams", "getMenus"]) 170 ["getSessionMetadata", "isConnected", "connect", "registerParams", "menusGet"])
171 171
172 172
173 class BridgeCall(LiberviaJsonProxy): 173 class BridgeCall(LiberviaJsonProxy):
174 def __init__(self): 174 def __init__(self):
175 LiberviaJsonProxy.__init__(self, "/json_api", 175 LiberviaJsonProxy.__init__(self, "/json_api",
176 ["getContacts", "addContact", "messageSend", 176 ["getContacts", "addContact", "messageSend",
177 "psDeleteNode", "psRetractItem", "psRetractItems", 177 "psDeleteNode", "psRetractItem", "psRetractItems",
178 "mbSend", "mbRetract", "mbGet", "mbGetFromMany", "mbGetFromManyRTResult", 178 "mbSend", "mbRetract", "mbGet", "mbGetFromMany", "mbGetFromManyRTResult",
179 "mbGetFromManyWithComments", "mbGetFromManyWithCommentsRTResult", 179 "mbGetFromManyWithComments", "mbGetFromManyWithCommentsRTResult",
180 "getHistory", "getPresenceStatuses", "joinMUC", "mucLeave", "mucGetRoomsJoined", 180 "historyGet", "getPresenceStatuses", "joinMUC", "mucLeave", "mucGetRoomsJoined",
181 "inviteMUC", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", 181 "inviteMUC", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady",
182 "tarotGamePlayCards", "launchRadioCollective", 182 "tarotGamePlayCards", "launchRadioCollective",
183 "getWaitingSub", "subscription", "delContact", "updateContact", "getCard", 183 "getWaitingSub", "subscription", "delContact", "updateContact", "avatarGet",
184 "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction", 184 "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction",
185 "disconnect", "chatStateComposing", "getNewAccountDomain", 185 "disconnect", "chatStateComposing", "getNewAccountDomain",
186 "syntaxConvert", "getAccountDialogUI", "getMainResource", "getEntitiesData", 186 "syntaxConvert", "getAccountDialogUI", "getMainResource", "getEntitiesData",
187 "getVersion", "getLiberviaVersion", "mucGetDefaultService", "getFeatures", 187 "getVersion", "getLiberviaVersion", "mucGetDefaultService", "getFeatures",
188 ]) 188 ])
192 192
193 def getConfig(self, dummy1, dummy2): # FIXME 193 def getConfig(self, dummy1, dummy2): # FIXME
194 log.warning("getConfig is not implemeted in Libervia yet") 194 log.warning("getConfig is not implemeted in Libervia yet")
195 return '' 195 return ''
196 196
197 def isConnected(self, dummy): # FIXME 197 def isConnected(self, dummy, callback): # FIXME
198 log.warning("isConnected is not implemeted in Libervia as for now profile is connected if session is opened") 198 log.warning("isConnected is not implemeted in Libervia as for now profile is connected if session is opened")
199 return True 199 callback(True)
200 200
201 def getAvatarFile(self, hash_, callback=None): 201 def bridgeConnect(self, callback, errback):
202 log.warning("getAvatarFile only return hash in Libervia") 202 callback()
203 if callback is not None:
204 callback(hash_)
205 return hash_
206 203
207 204
208 class BridgeSignals(LiberviaJsonProxy): 205 class BridgeSignals(LiberviaJsonProxy):
209 206
210 def __init__(self, host): 207 def __init__(self, host):
261 self.retry_warning = main_panel.WarningPopup() 258 self.retry_warning = main_panel.WarningPopup()
262 self.retry_timer = Timer(notify=_timerCb) 259 self.retry_timer = Timer(notify=_timerCb)
263 self.retry_timer.scheduleRepeating(1000) 260 self.retry_timer.scheduleRepeating(1000)
264 _timerCb(None) 261 _timerCb(None)
265 262
266 def register(self, name, callback, with_profile=True): 263 def register_signal(self, name, callback, with_profile=True):
267 """Register a signal 264 """Register a signal
268 265
269 @param: name of the signal to register 266 @param: name of the signal to register
270 @param callback: method to call 267 @param callback: method to call
271 @param with_profile: True if the original bridge method need a profile 268 @param with_profile: True if the original bridge method need a profile