Mercurial > libervia-web
diff 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 |
line wrap: on
line diff
--- a/libervia.py Mon Jan 07 22:43:00 2013 +0100 +++ b/libervia.py Mon Jan 07 22:43:50 2013 +0100 @@ -357,6 +357,14 @@ _groups, mblog_entry = cache_entry self.addBlogEntry(mblog_panel, self.whoami.bare, *cache_entry) + def getEntityMBlog(self, entity): + print "geting mblog for entity [%s]" % (entity,) + for lib_wid in self.libervia_widgets: + if isinstance(lib_wid, panels.MicroblogPanel): + if lib_wid.isJidAccepted(entity): + self.bridge.call('getMassiveLastMblogs', lib_wid.massiveInsert, 'JID', [entity], 10) + + def _newMessageCb(self, from_jid, msg, msg_type, to_jid): _from = JID(from_jid) _to = JID(to_jid) @@ -441,9 +449,11 @@ def _subscribeCb(self, sub_type, entity): if sub_type == 'subscribed': dialog.InfoDialog('Subscription confirmation', 'The contact <b>%s</b> has added you to his/her contact list' % html_sanitize(entity)).show() + self.getEntityMBlog(entity) elif sub_type == 'unsubscribed': dialog.InfoDialog('Subscription refusal', 'The contact <b>%s</b> has refused to add you in his/her contact list' % html_sanitize(entity)).show() + #TODO: remove microblogs from panels elif sub_type == 'subscribe': #The user want to subscribe to our presence