chk new version commit: fixing a bug introduced by tab when he changed the names of the var in config and adding a timeout

This commit is contained in:
Nikos Kouremenos 2005-05-08 15:06:24 +00:00
parent 58e7da6d54
commit 4a90f80cfa
2 changed files with 41 additions and 37 deletions

View File

@ -33,10 +33,7 @@ GTKGUI_GLADE='gtkgui.glade'
class Check_for_new_version_dialog:
def __init__(self, plugin):
self.plugin = plugin
try:
self.check_for_new_version()
except:
pass
def parse_glade(self):
xml = gtk.glade.XML(GTKGUI_GLADE, 'new_version_available_dialog', APP)
@ -56,13 +53,20 @@ class Check_for_new_version_dialog:
def check_for_new_version(self):
'''parse online Changelog to find out last version
and the changes for that latest version'''
check_for_new_version_available = True # Why that ?
if check_for_new_version_available:
import urllib
import urllib2
import socket
dto = socket.getdefaulttimeout()
socket.setdefaulttimeout(5)
url = 'http://trac.gajim.org/file/trunk/Changelog?rev=latest&format=txt'
changelog = urllib.urlopen(url)
# format is Gajim version (date)
try:
changelog = urllib2.urlopen(url)
except:
pass
socket.setdefaulttimeout(dto)
# format is 'Gajim version (date)'
first_line = changelog.readline()
finish_version = first_line.find(' ', 6) # start search after 'Gajim'
latest_version = first_line[6:finish_version]

View File

@ -696,7 +696,7 @@ class Interface:
if self.systray_capabilities:
self.show_systray()
if not gajim.config.get('check_for_new_version'):
if gajim.config.get('check_for_new_version'):
check_for_new_version.Check_for_new_version_dialog(self)
self.init_regexp()