Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Store the last identica/twitter id

  • Loading branch information...
commit 08ad0e0c12f468c7b210da5e4b5b79c40019621f 1 parent d1b497c
Jesús Barbero Rodríguez authored December 27, 2010
2  cloudsn
... ...
@@ -1,4 +1,4 @@
1  
-#!/usr/bin/python2
  1
+#!/usr/bin/python
2 2
 
3 3
 from cloudsn import cloudsn
4 4
 
10  cloudsn-local
... ...
@@ -0,0 +1,10 @@
  1
+#!/usr/bin/python
  2
+import os, sys
  3
+srcpath = os.path.abspath("src")
  4
+sys.path.insert(0,srcpath)
  5
+
  6
+from cloudsn import cloudsn
  7
+
  8
+if __name__ == "__main__":
  9
+    cloudsn.start()
  10
+    
1  cloudsn-local.sh
... ...
@@ -1 +0,0 @@
1  
-PYTHONPATH=$PYTHONPATH:src/ ./cloudsn
1  src/cloudsn/providers/greaderprovider.py
@@ -3,7 +3,6 @@
3 3
 from cloudsn.providers.providersbase import ProviderUtilsBuilder
4 4
 from cloudsn.core.keyring import Credentials
5 5
 from cloudsn.core import utils
6  
-from cloudsn.core import config
7 6
 import urllib2
8 7
 import re
9 8
 import urllib
20  src/cloudsn/providers/identicaprovider.py
@@ -4,7 +4,7 @@
4 4
 from cloudsn.core.keyring import Credentials
5 5
 from cloudsn.core.provider import Provider
6 6
 from cloudsn.core import utils
7  
-from cloudsn.core import config
  7
+import gobject
8 8
 import gtk
9 9
 
10 10
 class IdenticaProvider(ProviderUtilsBuilder):
@@ -24,7 +24,8 @@ def get_instance():
24 24
     def load_account(self, props):
25 25
         acc = IdenticaAccount(props, self)
26 26
         acc.properties["activate_url"] = self.activate_url
27  
-        acc.last_id = -1
  27
+        if not "since_id" in acc:
  28
+            acc["since_id"] = -1
28 29
         return acc
29 30
 
30 31
     def get_dialog_def (self):
@@ -61,17 +62,17 @@ def update_account (self, account):
61 62
         api = self.get_api(account)
62 63
         
63 64
         since_id = None
64  
-        if account.last_id != -1:
65  
-            since_id = account.last_id
  65
+        if account["since_id"] != -1:
  66
+            since_id = account["since_id"]
66 67
 
67  
-        messages = api.home_timeline()
  68
+        messages = api.home_timeline(since_id=since_id)
68 69
 
69 70
         if len(messages) < 1:
70 71
             account.new_unread = []
71 72
             return
72 73
 
73 74
         news = []
74  
-        if account.last_id != -1:
  75
+        if since_id:
75 76
             for m in messages:
76 77
                 if m.id not in account.notifications:
77 78
                     account.notifications[m.id] = m.id
@@ -85,7 +86,12 @@ def update_account (self, account):
85 86
                          self.get_message_icon(messages[0])))
86 87
 
87 88
         account.new_unread = news;
88  
-        account.last_id = messages[0].id
  89
+        account["since_id"] = messages[0].id
  90
+        gobject.idle_add(self.__save_account, account)
  91
+        
  92
+    def __save_account(self, account):
  93
+        AccountManager.get_instance().save_account(account)
  94
+        return False
89 95
         
90 96
     def get_message_icon(self,m):
91 97
         icon = None
1  src/cloudsn/providers/pop3provider.py
@@ -9,7 +9,6 @@
9 9
 from cloudsn.providers.providersbase import ProviderUtilsBuilder
10 10
 from cloudsn.core.account import AccountCacheMails, AccountManager, Notification
11 11
 from cloudsn.core.keyring import Credentials
12  
-from cloudsn.core import config
13 12
 from cloudsn.core import utils
14 13
 from cloudsn import logger
15 14
 

0 notes on commit 08ad0e0

Please sign in to comment.
Something went wrong with that request. Please try again.