| |   |
| 1 | * Better new messages control |
| 2 | |
| 3 | Right now, the code only counts how many messages are on the |
| 4 | inbox. The logic is simple, and flawed. If you had 4 new messages |
| 5 | and now you have 5, you have a new message. But what happend if you |
| 6 | read one message and a new message arrives? the count will still be |
| 7 | 4 and the system won't report the new message. What should be done |
| 8 | is store the messages id in a <insert data structure> so you can |
| 9 | have a real control of the messages count. |
| 10 | |
| 11 | * See-them-all option |
| 12 | |
| 13 | There should be an option to open all the new messages with a single |
| 14 | click. If you use firefox, you may want to open in new tabs all your |
| 15 | messages, that would be nice. |
| 16 | |
| 17 | * Go to Google Mail homepage option |
| 18 | |
| 19 | The title says all. |
| 20 | |
| 21 | * A plugin system |
| 22 | |
| 23 | Right now gmail-sentinel is a monolithic design. What should be done |
| 24 | is to provide "callbacks" so you can register a plugin. What would |
| 25 | be ideal is to have this hooks |
| 26 | |
| 27 | 1.- Pre-connection (*) |
| 28 | 2.- Pre-parsing (*Before parsing the atom feed) |
| 29 | 3.- New message |
| 30 | 4.- No message |
| 31 | |
| 32 | Ideally, the notifications will use this plugin system. (* allowing |
| 33 | content modification before the parsing could be a security issue, |
| 34 | and pre-connection activities are discussible also. This is a |
| 35 | brainstorm so everything is changeable.) |
| 36 | |
| 37 | * Notification "skins" |
| 38 | |
| 39 | Some ideas |
| 40 | |
| 41 | - "full" see open/next/previous buttons and from/subject/summary data |
| 42 | - "minimal" just -> you have <n> new messages |
| 43 | - "medium" see open/next/previous buttons and from/subject data |
| 44 | - "last" see from/subject/summary data |
| 45 | |
| 46 | and so on |
| toggle raw diff |
--- /dev/null
+++ b/TODO
@@ -0,0 +1,46 @@
+* Better new messages control
+
+ Right now, the code only counts how many messages are on the
+ inbox. The logic is simple, and flawed. If you had 4 new messages
+ and now you have 5, you have a new message. But what happend if you
+ read one message and a new message arrives? the count will still be
+ 4 and the system won't report the new message. What should be done
+ is store the messages id in a <insert data structure> so you can
+ have a real control of the messages count.
+
+* See-them-all option
+
+ There should be an option to open all the new messages with a single
+ click. If you use firefox, you may want to open in new tabs all your
+ messages, that would be nice.
+
+* Go to Google Mail homepage option
+
+ The title says all.
+
+* A plugin system
+
+ Right now gmail-sentinel is a monolithic design. What should be done
+ is to provide "callbacks" so you can register a plugin. What would
+ be ideal is to have this hooks
+
+ 1.- Pre-connection (*)
+ 2.- Pre-parsing (*Before parsing the atom feed)
+ 3.- New message
+ 4.- No message
+
+ Ideally, the notifications will use this plugin system. (* allowing
+ content modification before the parsing could be a security issue,
+ and pre-connection activities are discussible also. This is a
+ brainstorm so everything is changeable.)
+
+* Notification "skins"
+
+ Some ideas
+
+ - "full" see open/next/previous buttons and from/subject/summary data
+ - "minimal" just -> you have <n> new messages
+ - "medium" see open/next/previous buttons and from/subject data
+ - "last" see from/subject/summary data
+
+ and so on |
| |   |
| 217 | 217 | print "login failed, will retry" |
| 218 | 218 | self.status_icon.set_tooltip(_("Connection failed")) |
| 219 | 219 | return False |
| 220 | | self.connection.refreshInfo() |
| 221 | | print "connection successful... continuing" |
| 222 | | self.status_icon.set_tooltip(_("Connected")) |
| 223 | | return True |
| 220 | if self.connection.refreshInfo(): |
| 221 | print "connection successful... continuing" |
| 222 | self.status_icon.set_tooltip(_("Connected")) |
| 223 | return True |
| 224 | else: |
| 225 | print "connection failed" |
| 226 | self.status_icon.set_tooltip(_("Not connected")) |
| 227 | return False |
| 224 | 228 | |
| 225 | 229 | def check_inbox(self): |
| 226 | 230 | """Checks for new mail.""" |
| 227 | | # Revisar si esta el pop up y eliminarlo |
| 228 | | if self.connection is None and self.connect() is False: |
| 231 | if self.connection is None or self.connect() is False: |
| 229 | 232 | # Try again latter |
| 230 | 233 | return True |
| 231 | 234 | print "----------" |
| toggle raw diff |
--- a/gmail-sentinel.py
+++ b/gmail-sentinel.py
@@ -217,15 +217,18 @@ class Gnotify:
print "login failed, will retry"
self.status_icon.set_tooltip(_("Connection failed"))
return False
- self.connection.refreshInfo()
- print "connection successful... continuing"
- self.status_icon.set_tooltip(_("Connected"))
- return True
+ if self.connection.refreshInfo():
+ print "connection successful... continuing"
+ self.status_icon.set_tooltip(_("Connected"))
+ return True
+ else:
+ print "connection failed"
+ self.status_icon.set_tooltip(_("Not connected"))
+ return False
def check_inbox(self):
"""Checks for new mail."""
- # Revisar si esta el pop up y eliminarlo
- if self.connection is None and self.connect() is False:
+ if self.connection is None or self.connect() is False:
# Try again latter
return True
print "----------" |
| |   |
| 161 | 161 | def sendRequest(self): |
| 162 | 162 | """Opens a conection with the remote server""" |
| 163 | 163 | del self.mh.entries[:] |
| 164 | | return urllib2.urlopen(self.url) |
| 164 | return urllib2.urlopen(self.url) |
| 165 | 165 | |
| 166 | 166 | def refreshInfo(self): |
| 167 | 167 | """Requests information from the remote server and parses the |
| 168 | 168 | information retrieved""" |
| 169 | | sax.parseString( self.sendRequest().read(), self.mh) |
| 169 | try: |
| 170 | sax.parseString( self.sendRequest().read(), self.mh) |
| 171 | return True |
| 172 | except urllib2.URLError: |
| 173 | return False |
| 170 | 174 | |
| 171 | 175 | def getMsgList (self): |
| 172 | 176 | """Returns a list containing the new messages or empty. It |
| toggle raw diff |
--- a/gmailatom.py
+++ b/gmailatom.py
@@ -161,12 +161,16 @@ class GmailAtom:
def sendRequest(self):
"""Opens a conection with the remote server"""
del self.mh.entries[:]
- return urllib2.urlopen(self.url)
+ return urllib2.urlopen(self.url)
def refreshInfo(self):
"""Requests information from the remote server and parses the
information retrieved"""
- sax.parseString( self.sendRequest().read(), self.mh)
+ try:
+ sax.parseString( self.sendRequest().read(), self.mh)
+ return True
+ except urllib2.URLError:
+ return False
def getMsgList (self):
"""Returns a list containing the new messages or empty. It |