identi.ca public timeline
authorDarren Worrall <daz@dwuk.net>
Wed, 17 Jun 2009 18:20:50 +0000 (19:20 +0100)
committerDarren Worrall <daz@dwuk.net>
Wed, 17 Jun 2009 18:20:50 +0000 (19:20 +0100)
gwibber/microblog/friendfeed.py
gwibber/microblog/identica.py
ui/preferences.glade

index 358c6a1..219e8da 100644 (file)
@@ -139,9 +139,7 @@ class Client:
       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
+    return self.account["public_enabled"]
 
   def get_auth(self):
     return "Basic %s" % base64.encodestring(
index 7658d3e..cb6f465 100644 (file)
@@ -21,6 +21,7 @@ PROTOCOL_INFO = {
     "send_enabled",
     "search_enabled",
     "receive_count",
+    "public_enabled",
   ],
 
   "features": [
@@ -37,6 +38,7 @@ PROTOCOL_INFO = {
     #can.THREAD,
     can.THREAD_REPLY,
     can.USER_MESSAGES,
+    can.PUBLIC,
   ],
 }
 
@@ -122,6 +124,9 @@ class Client:
     return "Basic %s" % base64.encodestring(
       ("%s:%s" % (self.account["username"], self.account["private:password"]))).strip()
 
+  def public_enabled(self):
+    return self.account["public_enabled"]
+
   def connect(self, url, data = None):
     return urllib2.urlopen(urllib2.Request(
       url, data, {"Authorization": self.get_auth()})).read()
@@ -140,6 +145,15 @@ class Client:
       profile = [simplejson.loads(self.connect(
         "https://identi.ca/api/users/show/"+ screen_name +".json"))]
       return profile
+  
+  def get_public_timeline(self):
+    return simplejson.loads(self.connect(
+      "https://identi.ca/api/statuses/public_timeline.json",
+      urllib.urlencode({"num": self.account["receive_count"] or "20"})))
+
+  def public_timeline(self):
+      for data in self.get_public_timeline():
+          yield Message(self, data) 
 
   def get_responses(self):
     return simplejson.loads(self.connect(
index 3b0940b..7fe3f00 100644 (file)
@@ -2372,6 +2372,19 @@ Greg Grossmeier</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="identica_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>