# HG changeset patch # User Goffi # Date 1357595030 -3600 # Node ID b887186e8fc886aad482f0c0633b746b9f4e9184 # Parent 6ebf7f872a385d7afb945914f3f0d93fd118ce5d browser side: get entity's microblogs for newly added contacts diff -r 6ebf7f872a38 -r b887186e8fc8 browser_side/panels.py --- a/browser_side/panels.py Mon Jan 07 22:43:00 2013 +0100 +++ b/browser_side/panels.py Mon Jan 07 22:43:50 2013 +0100 @@ -591,7 +591,7 @@ self.accepted_groups.append(group) def isJidAccepted(self, jid): - """Tell if a jid is actepted and show in this panel + """Tell if a jid is actepted and shown in this panel @param jid: jid @return: True if the jid is accepted""" if self.accept_all(): diff -r 6ebf7f872a38 -r b887186e8fc8 libervia.py --- 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 %s 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 %s 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