Mercurial > libervia-web
comparison libervia.py @ 62:12e889a683ce SàT v0.2.0
server side: misc stuff:
- fixed lot of misuse in callbacks
- chat history fixed
- a visual indicator now appear when we have message waiting from a contact
- fixed About dialog size issue in webkit
- fixed Drag'n'Drop for webkit
- defaut room to join is now libervia@conference.libervia.org
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 31 May 2011 17:06:59 +0200 |
parents | 4fa3d57f72f8 |
children | 104e71ce2293 |
comparison
equal
deleted
inserted
replaced
61:80c490e6a1a7 | 62:12e889a683ce |
---|---|
48 if self.cb.has_key(request_info.id): | 48 if self.cb.has_key(request_info.id): |
49 self.cb[request_info.id](response) | 49 self.cb[request_info.id](response) |
50 del self.cb[request_info.id] | 50 del self.cb[request_info.id] |
51 | 51 |
52 def onRemoteError(self, code, errobj, request_info): | 52 def onRemoteError(self, code, errobj, request_info): |
53 """def dump(obj): | |
54 print "\n\nDUMPING %s\n\n" % obj | |
55 for i in dir(obj): | |
56 print "%s: %s" % (i, getattr(obj,i))""" | |
53 if code != 0: | 57 if code != 0: |
54 Window.alert("Internal server error") | 58 Window.alert("Internal server error") |
59 """for o in code, error, request_info: | |
60 dump(o)""" | |
55 else: | 61 else: |
56 if isinstance(errobj['message'],dict): | 62 if isinstance(errobj['message'],dict): |
57 Window.alert("Error %s: %s" % (errobj['message']['faultCode'], errobj['message']['faultString'])) | 63 Window.alert("Error %s: %s" % (errobj['message']['faultCode'], errobj['message']['faultString'])) |
58 else: | 64 else: |
59 Window.alert("Error: %s" % errobj['message']) | 65 Window.alert("Error: %s" % errobj['message']) |
150 else: | 156 else: |
151 self._register.call('isConnected', self._isConnectedCB) | 157 self._register.call('isConnected', self._isConnectedCB) |
152 | 158 |
153 def _isConnectedCB(self, connected): | 159 def _isConnectedCB(self, connected): |
154 if not connected: | 160 if not connected: |
155 self._register.call('connect',self.logged) | 161 self._register.call('connect',lambda x:self.logged()) |
156 else: | 162 else: |
157 self.logged() | 163 self.logged() |
158 | 164 |
159 def logged(self): | 165 def logged(self): |
160 if self._dialog: | 166 if self._dialog: |
254 self.addBlogEntry(mblog_entry, *cache_entry) | 260 self.addBlogEntry(mblog_entry, *cache_entry) |
255 | 261 |
256 def _newMessageCb(self, from_jid, msg, msg_type, to_jid): | 262 def _newMessageCb(self, from_jid, msg, msg_type, to_jid): |
257 _from = JID(from_jid) | 263 _from = JID(from_jid) |
258 _to = JID(to_jid) | 264 _to = JID(to_jid) |
265 showed = False | |
259 for panel in self.mpanels + self.other_panels: | 266 for panel in self.mpanels + self.other_panels: |
260 if isinstance(panel,panels.ChatPanel) and (panel.target.bare == _from.bare or panel.target.bare == _to.bare): | 267 if isinstance(panel,panels.ChatPanel) and (panel.target.bare == _from.bare or panel.target.bare == _to.bare): |
261 panel.printMessage(_from, msg) | 268 panel.printMessage(_from, msg) |
269 showed = True | |
270 if not showed: | |
271 #The message has not been showed, we must indicate it | |
272 other = _to if _from.bare == self.whoami.bare else _from | |
273 self.contact_panel.setContactMessageWaiting(other.bare, True) | |
274 | |
275 | |
262 | 276 |
263 def _presenceUpdateCb(self, entity, show, priority, statuses): | 277 def _presenceUpdateCb(self, entity, show, priority, statuses): |
264 _entity = JID(entity) | 278 _entity = JID(entity) |
265 #XXX: QnD way to get our status | 279 #XXX: QnD way to get our status |
266 if self.whoami and self.whoami.bare == _entity.bare and statuses: | 280 if self.whoami and self.whoami.bare == _entity.bare and statuses: |
325 elif sub_type == 'subscribe': | 339 elif sub_type == 'subscribe': |
326 #The user want to subscribe to our presence | 340 #The user want to subscribe to our presence |
327 _dialog = None | 341 _dialog = None |
328 msg = HTML('The contact <b>%s</b> want to add you in his/her contact list, do you accept ?' % html_sanitize(entity)) | 342 msg = HTML('The contact <b>%s</b> want to add you in his/her contact list, do you accept ?' % html_sanitize(entity)) |
329 | 343 |
330 def ok_cb(): | 344 def ok_cb(ignore): |
331 self.bridge.call('subscription', None, "subscribed", entity, '', _dialog.getSelectedGroups()) | 345 self.bridge.call('subscription', None, "subscribed", entity, '', _dialog.getSelectedGroups()) |
332 def cancel_cb(): | 346 def cancel_cb(ignore): |
333 self.bridge.call('subscription', None, "unsubscribed", entity, '', '') | 347 self.bridge.call('subscription', None, "unsubscribed", entity, '', '') |
334 | 348 |
335 _dialog = dialog.GroupSelector([msg], self.contact_panel.getGroups(), [], ok_cb, cancel_cb) | 349 _dialog = dialog.GroupSelector([msg], self.contact_panel.getGroups(), [], ok_cb, cancel_cb) |
336 _dialog.setHTML('<b>Add contact request</b>') | 350 _dialog.setHTML('<b>Add contact request</b>') |
337 _dialog.show() | 351 _dialog.show() |