comparison libervia.py @ 163:b887186e8fc8

browser side: get entity's microblogs for newly added contacts
author Goffi <goffi@goffi.org>
date Mon, 07 Jan 2013 22:43:50 +0100
parents 58442ed28f2b
children 9763dec220ed
comparison
equal deleted inserted replaced
162:6ebf7f872a38 163:b887186e8fc8
355 #XXX: only our own entries are cached 355 #XXX: only our own entries are cached
356 for cache_entry in self.mblog_cache: 356 for cache_entry in self.mblog_cache:
357 _groups, mblog_entry = cache_entry 357 _groups, mblog_entry = cache_entry
358 self.addBlogEntry(mblog_panel, self.whoami.bare, *cache_entry) 358 self.addBlogEntry(mblog_panel, self.whoami.bare, *cache_entry)
359 359
360 def getEntityMBlog(self, entity):
361 print "geting mblog for entity [%s]" % (entity,)
362 for lib_wid in self.libervia_widgets:
363 if isinstance(lib_wid, panels.MicroblogPanel):
364 if lib_wid.isJidAccepted(entity):
365 self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'JID', [entity], 10)
366
367
360 def _newMessageCb(self, from_jid, msg, msg_type, to_jid): 368 def _newMessageCb(self, from_jid, msg, msg_type, to_jid):
361 _from = JID(from_jid) 369 _from = JID(from_jid)
362 _to = JID(to_jid) 370 _to = JID(to_jid)
363 showed = False 371 showed = False
364 for lib_wid in self.libervia_widgets: 372 for lib_wid in self.libervia_widgets:
439 self._subscribeCb(waiting_sub[sub], sub) 447 self._subscribeCb(waiting_sub[sub], sub)
440 448
441 def _subscribeCb(self, sub_type, entity): 449 def _subscribeCb(self, sub_type, entity):
442 if sub_type == 'subscribed': 450 if sub_type == 'subscribed':
443 dialog.InfoDialog('Subscription confirmation', 'The contact <b>%s</b> has added you to his/her contact list' % html_sanitize(entity)).show() 451 dialog.InfoDialog('Subscription confirmation', 'The contact <b>%s</b> has added you to his/her contact list' % html_sanitize(entity)).show()
452 self.getEntityMBlog(entity)
444 453
445 elif sub_type == 'unsubscribed': 454 elif sub_type == 'unsubscribed':
446 dialog.InfoDialog('Subscription refusal', 'The contact <b>%s</b> has refused to add you in his/her contact list' % html_sanitize(entity)).show() 455 dialog.InfoDialog('Subscription refusal', 'The contact <b>%s</b> has refused to add you in his/her contact list' % html_sanitize(entity)).show()
456 #TODO: remove microblogs from panels
447 457
448 elif sub_type == 'subscribe': 458 elif sub_type == 'subscribe':
449 #The user want to subscribe to our presence 459 #The user want to subscribe to our presence
450 _dialog = None 460 _dialog = None
451 msg = HTML('The contact <b>%s</b> want to add you in his/her contact list, do you accept ?' % html_sanitize(entity)) 461 msg = HTML('The contact <b>%s</b> want to add you in his/her contact list, do you accept ?' % html_sanitize(entity))