diff libervia.tac @ 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 aa76793da353
children 890776a6fdb7
line wrap: on
line diff
--- a/libervia.tac	Sun Apr 07 22:33:55 2013 +0200
+++ b/libervia.tac	Thu Jun 20 12:16:46 2013 +0200
@@ -201,10 +201,21 @@
             if _type == "PUBLIC":
                 #This text if for the public microblog
                 print "sending public blog"
-                return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, profile)
+                return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, {'allow_comments': 'True'}, profile)
             else:
                 print "sending group blog"
-                return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, profile)
+                return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, {'allow_comments': 'True'}, profile)
+        else:
+            raise Exception("Invalid data")
+
+    def jsonrpc_sendMblogComment(self, node, text):
+        """ Send microblog message
+        @param node: url of the comments node
+        @param text: comment
+        """
+        profile = ISATSession(self.session).profile
+        if node and text:
+            return self.sat_host.bridge.sendGroupBlogComment(node, text, profile)
         else:
             raise Exception("Invalid data") 
     
@@ -230,6 +241,17 @@
         self.sat_host.bridge.massiveSubscribeGroupBlogs(publishers_type, publishers_list, profile)
         return d
 
+    def jsonrpc_getMblogComments(self, service, node):
+        """Get all comments of given node
+        @param service: jid of the service hosting the node
+        @param node: comments node
+        """
+        profile = ISATSession(self.session).profile
+        d = defer.Deferred()
+        self.sat_host.bridge.getGroupBlogComments(service, node, profile, callback=d.callback, errback=d.errback)
+        return d
+
+
     def jsonrpc_getPresenceStatus(self):
         """Get Presence information for connected contacts"""
         profile = ISATSession(self.session).profile