Added friendfeed public timeline support
authorDarren Worrall <daz@dwuk.net>
Tue, 16 Jun 2009 18:17:22 +0000 (19:17 +0100)
committerDarren Worrall <daz@dwuk.net>
Tue, 16 Jun 2009 18:17:22 +0000 (19:17 +0100)
gwibber/microblog/friendfeed.py
ui/preferences.glade

index 4bbcec7..358c6a1 100644 (file)
@@ -23,6 +23,7 @@ PROTOCOL_INFO = {
     "send_enabled",
     "search_enabled",
     "receive_count",
+    "public_enabled",
   ],
 
   "features": [
@@ -37,6 +38,7 @@ PROTOCOL_INFO = {
     can.DELETE,
     can.SEARCH_URL,
     can.USER_MESSAGES,
+    can.PUBLIC,
   ],
 }
 
@@ -135,6 +137,11 @@ class Client:
     return self.account["receive_enabled"] and \
       self.account["username"] != None and \
       self.account["private:password"] != None
+      
+  def public_enabled(self):
+    return self.account["public_enabled"] and \
+      self.account["username"] != None and \
+      self.account["private:password"] != None
 
   def get_auth(self):
     return "Basic %s" % base64.encodestring(
@@ -148,6 +155,15 @@ class Client:
     return simplejson.loads(self.connect(
       "https://friendfeed.com/api/feed/home?" +
       urllib.urlencode({"num": self.account["receive_count"] or "80"})))["entries"]
+      
+  def get_public_timeline(self):
+    return simplejson.loads(self.connect(
+      "http://friendfeed.com/api/feed/public" +'?'+
+      urllib.urlencode({"num": self.account["receive_count"] or "20"})))["entries"]
+
+  def public_timeline(self):
+      for data in self.get_public_timeline():
+          yield Message(self, data) 
 
   def get_user_messages(self, screen_name):
     try:
index 8d1b239..3b0940b 100644 (file)
@@ -1551,6 +1551,19 @@ Greg Grossmeier</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="friendfeed_public_enabled">
+                            <property name="label" translatable="yes">_Public Timeline</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>