From: Luca Falavigna <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: Proxy support
Package: gmail-notify
Version: 1.6.1-3
Severity: normal
Tags: patch

Attached patch provides proxy support. Thank you.
diff -u gmail-notify-1.6.1/debian/changelog gmail-notify-1.6.1/debian/changelog
--- gmail-notify-1.6.1/debian/changelog
+++ gmail-notify-1.6.1/debian/changelog
@@ -1,3 +1,10 @@
+gmail-notify (1.6.1-4) unstable; urgency=low
+
+  * 05_proxy_support.patch: added proxy support
+
+ -- Luca Falavigna <[EMAIL PROTECTED]>  Sat,  9 Jun 2007 15:06:19 +0200
+
 gmail-notify (1.6.1-3) unstable; urgency=low
 
   * Chance default x-www-browser to www-browser (closes: #389532) 
--- gmail-notify-1.6.1.orig/debian/patches/05_proxy_support.patch
+++ gmail-notify-1.6.1/debian/patches/05_proxy_support.patch
@@ -0,0 +1,145 @@
+diff -Nur gmail-notify-1.6.1/gmailatom.py gmail-notify-1.6.1.new/gmailatom.py
+--- gmail-notify-1.6.1/gmailatom.py    2007-06-09 13:41:13.000000000 +0200
++++ gmail-notify-1.6.1.new/gmailatom.py        2007-06-09 18:32:24.000000000 
+0200
+@@ -116,12 +116,17 @@
+       host = "https://mail.google.com";
+       url = host + "/mail/feed/atom"
+ 
+-      def __init__(self, user, pswd):
++      def __init__(self, user, pswd, proxy=None):
+               self.m = MailHandler()
+               # initialize authorization handler
+               auth_handler = urllib2.HTTPBasicAuthHandler()
+               auth_handler.add_password( self.realm, self.host, user, pswd)
+-              opener = urllib2.build_opener(auth_handler)
++              # manage proxy
++              if proxy:
++                      proxy_handler = urllib2.ProxyHandler({'http': proxy})
++                      opener = urllib2.build_opener(proxy_handler, 
auth_handler)
++              else:
++                      opener = urllib2.build_opener(auth_handler)
+               urllib2.install_opener(opener)
+ 
+       def sendRequest(self):
+diff -Nur gmail-notify-1.6.1/GmailConfig.py 
gmail-notify-1.6.1.new/GmailConfig.py
+--- gmail-notify-1.6.1/GmailConfig.py  2007-06-09 18:32:08.000000000 +0200
++++ gmail-notify-1.6.1.new/GmailConfig.py      2007-06-09 18:32:09.000000000 
+0200
+@@ -18,8 +18,8 @@
+       configElements = None 
+ 
+       # Declare global variables for configuration as dictionary
+-      options = { "gmailusername":None, "gmailpassword":None, 
"browserpath":"www-browser", "lang":"English",   
+-                              "voffset":0, "hoffset":0, 
"checkinterval":20000, 
++      options = { "gmailusername":None, "gmailpassword":None, 
"browserpath":"www-browser", "proxy":None,
++                              "lang":"English", "voffset":0, "hoffset":0, 
"checkinterval":20000, 
+                               "animationdelay":15, "popuptimespan":5000}
+                                       
+       config = ConfigParser.RawConfigParser()
+@@ -49,6 +49,7 @@
+                                               ["gmailusername",2,None,None],
+                                               ["gmailpassword",22,None,None],
+                                               ["browserpath",3,None,None],
++                                              ["proxy",35,None,None],
+                                               ["voffset",28,None,None],
+                                               ["hoffset",27,None,None],
+                                               ["checkinterval",31,None,None],
+@@ -57,7 +58,7 @@
+                                       ]
+ 
+               # Create table and attach to window
+-              table = gtk.Table( rows=11, columns=2, homogeneous=gtk.FALSE )
++              table = gtk.Table( rows=12, columns=2, homogeneous=gtk.FALSE )
+ 
+               self.window.add(table)
+ 
+@@ -114,7 +115,7 @@
+                       self.savePassword.set_active( gtk.FALSE )
+                       
+               self.savePassword.show()
+-              table.attach( alignment, 0, 2, 9, 10 )
++              table.attach( alignment, 0, 2, 10, 11 )
+               alignment.show()
+ 
+               # Add combobox to select language 
+@@ -129,14 +130,14 @@
+                                 self.cbo_langs.append_text( 
one_lang.get_name())
+               self.cbo_langs.set_active(0)
+               # Attach combobox and label
+-              table.attach( self.lbl_langs, 0, 1, 8, 9 )
++              table.attach( self.lbl_langs, 0, 1, 9, 10 )
+               self.lbl_langs.show()
+-              table.attach( self.cbo_langs, 1, 2, 8, 9, xpadding=5, 
ypadding=5 )
++              table.attach( self.cbo_langs, 1, 2, 9, 10, xpadding=5, 
ypadding=5 )
+               self.cbo_langs.show()
+               
+               # Add 'Close' button
+               button = gtk.Button( stock=gtk.STOCK_OK )
+-              table.attach( button, 0, 2, 10, 11, xpadding=2, ypadding=2 )
++              table.attach( button, 0, 2, 11, 12, xpadding=2, ypadding=2 )
+               button.connect( "clicked", self.onOkay )
+               button.show()
+ 
+@@ -222,7 +223,7 @@
+ 
+               # Before writing, check for bad values
+               try:
+-                      tempLogin = gmailatom.GmailAtom( 
self.options["gmailusername"], self.options["gmailpassword"] )
++                      tempLogin = gmailatom.GmailAtom( 
self.options["gmailusername"], self.options["gmailpassword"], 
self.options["proxy"])
+                       tempLogin.refreshInfo()
+               except:
+                       print "Unexpected error:", sys.exc_info()[0]
+diff -Nur gmail-notify-1.6.1/langs.xml gmail-notify-1.6.1.new/langs.xml
+--- gmail-notify-1.6.1/langs.xml       2005-09-25 19:41:01.000000000 +0200
++++ gmail-notify-1.6.1.new/langs.xml   2007-06-09 18:32:09.000000000 +0200
+@@ -33,6 +33,7 @@
+               <string id="32">Conns time span</string>
+               <string id="33">Some value is missing</string>
+               <string id="34">Save username and password</string>
++              <string id="35">Proxy</string>
+       </lang>
+       <lang name="Español">
+               <string id="1" >Configuración de Gmail Notifier</string>
+@@ -67,6 +68,7 @@
+               <string id="32">Intervalo e/conexiones</string>
+               <string id="33">Falta completar algún valor</string>
+               <string id="34">Guardar nombre de usuario y contraseña</string>
++              <string id="35">Proxy</string>
+       </lang>
+       <lang name="Svenska">
+               <string id="1" >Gmail Notifier - konfiguration</string>
+@@ -101,6 +103,7 @@
+               <string id="32">Conns time span</string>
+               <string id="33">Några värden fattas</string>
+               <string id="34">Spara användarnamn och lösenord</string>
++              <string id="35">Proxy</string>
+       </lang>
+       <lang name="Italiano">
+               <string id="1">Gmail Notifier Configurazione</string>
+@@ -135,5 +138,6 @@
+               <string id="32">Intervallo Tentativi Connessione: </string>
+               <string id="33">Mancano dei valori</string>
+               <string id="34">Salva nome utente e password</string>
++              <string id="35">Proxy</string>
+       </lang>
+ </langs>
+diff -Nur gmail-notify-1.6.1/notifier.py gmail-notify-1.6.1.new/notifier.py
+--- gmail-notify-1.6.1/notifier.py     2007-06-09 18:32:08.000000000 +0200
++++ gmail-notify-1.6.1.new/notifier.py 2007-06-09 18:32:09.000000000 +0200
+@@ -163,7 +163,7 @@
+                       gtk.main_iteration( gtk.TRUE)
+               # Attemp connection
+               try:
+-                      
self.connection=gmailatom.GmailAtom(self.options['gmailusername'],self.options['gmailpassword'])
++                      
self.connection=gmailatom.GmailAtom(self.options['gmailusername'],self.options['gmailpassword'],self.options['proxy'])
+                       self.connection.refreshInfo()
+                       print "connection successful... continuing"
+                       
self._tooltip.set_tip(self.tray,self.lang.get_string(14))
+@@ -383,7 +383,7 @@
+               self.maintimer = gtk.timeout_add(self.options["checkinterval"], 
self.mail_check )
+ 
+               # Update user/pass
+-              
self.connection=gmailatom.GmailAtom(self.options["gmailusername"],self.options["gmailpassword"])
++              
self.connection=gmailatom.GmailAtom(self.options["gmailusername"],self.options["gmailpassword"],self.options['proxy'])
+               self.connect()
+               self.mail_check()
+ 

Reply via email to