diff libervia.py @ 202:2bc6cf004e61

browser, server: comments handling: - banner in unibar show a specific message when the message will be a comment - comments are inserted in a subpanel, in chronological order
author Goffi <goffi@goffi.org>
date Thu, 20 Jun 2013 12:16:46 +0200
parents 0f5c2f799913
children 5fdea93b2541
line wrap: on
line diff
--- a/libervia.py	Sun Apr 07 22:33:55 2013 +0200
+++ b/libervia.py	Thu Jun 20 12:16:46 2013 +0200
@@ -83,7 +83,7 @@
 class BridgeCall(LiberviaJsonProxy):
     def __init__(self):
         LiberviaJsonProxy.__init__(self, "/json_api",
-                        ["getContacts", "addContact", "sendMessage", "sendMblog", "getLastMblogs", "getMassiveLastMblogs", "getProfileJid", "getHistory", "getPresenceStatus",
+                        ["getContacts", "addContact", "sendMessage", "sendMblog", "sendMblogComment", "getLastMblogs", "getMassiveLastMblogs", "getMblogComments", "getProfileJid", "getHistory", "getPresenceStatus",
                          "joinMUC", "mucLeave", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed",
                          "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getEntityData", "getParamsUI",
                          #"setParam",
@@ -202,7 +202,7 @@
     def getAvatar(self, jid_str):
         """Return avatar of a jid if in cache, else ask for it"""
         def dataReceived(result):
-            if result.has_key('avatar'):
+            if 'avatar' in result:
                 self._entityDataUpdatedCb(jid_str, 'avatar', result['avatar'])
         
         if jid_str not in self.avatars_cache:
@@ -361,10 +361,10 @@
 
     def _personalEventCb(self, sender, event_type, data):
         if event_type == "MICROBLOG":
-            if not data.has_key('content'):
+            if not 'content' in data:
                 print ("WARNING: No content found in microblog data")
                 return
-            if data.has_key('groups'):
+            if 'groups' in data:
                 _groups = set(data['groups'].split() if data['groups'] else [])
             else:
                 _groups=None
@@ -385,7 +385,7 @@
         @param sender: jid of the entry sender
         @param _groups: groups which can receive this entry
         @param mblog_entry: MicroblogItem instance"""
-        if mblog_panel.isJidAccepted(sender) or (_groups == None and self.whoami and sender == self.whoami.bare) \
+        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)