diff src/browser/libervia_main.py @ 597:be2891462e63 frontends_multi_profiles

browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
author Goffi <goffi@goffi.org>
date Fri, 06 Feb 2015 19:23:08 +0100
parents a5019e62c3e9
children 7af8f4ab3675
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Fri Feb 06 19:19:49 2015 +0100
+++ b/src/browser/libervia_main.py	Fri Feb 06 19:23:08 2015 +0100
@@ -505,7 +505,7 @@
             mblog_entry = blog.MicroblogItem(data)
 
             for widget in self.widgets.getWidgets(blog.MicroblogPanel):
-                self.addBlogEntry(widget, sender, _groups, mblog_entry)
+                widget.addEntryIfAccepted(sender, _groups, mblog_entry)
 
             if sender == self.whoami.bare:
                 found = False
@@ -533,24 +533,15 @@
                         self.mblog_cache.remove(entry)
                         break
 
-    def addBlogEntry(self, mblog_panel, sender, _groups, mblog_entry):
-        """Check if an entry can go in MicroblogPanel and add to it
-        @param mblog_panel: MicroblogPanel instance
-        @param sender: jid of the entry sender
-        @param _groups: groups which can receive this entry
-        @param mblog_entry: panels.MicroblogItem instance"""
-        if mblog_entry.type == "comment" or mblog_panel.isJidAccepted(sender) or (_groups == None and self.whoami and sender == self.whoami.bare) \
-           or (_groups and _groups.intersection(mblog_panel.accepted_groups)):
-            mblog_panel.addEntry(mblog_entry)
-
     def FillMicroblogPanel(self, mblog_panel):
         """Fill a microblog panel with entries in cache
+
         @param mblog_panel: MicroblogPanel instance
         """
         #XXX: only our own entries are cached
         for cache_entry in self.mblog_cache:
             _groups, mblog_entry = cache_entry
-            self.addBlogEntry(mblog_panel, self.whoami.bare, *cache_entry)
+            mblog_panel.addEntryIfAccepted(self.whoami.bare, *cache_entry)
 
     def getEntityMBlog(self, entity):
         log.info("geting mblog for entity [%s]" % (entity,))