/offlineimap/head: changeset 458
autorefresh may now be a floating-point value. Closes: #190060.
This commit is contained in:
parent
56ac894f41
commit
ce12331573
@ -13,6 +13,7 @@ offlineimap (3.99.15) unstable; urgency=low
|
||||
* Made OfflineIMAP IPv6-aware. Used the short patch from
|
||||
Adriaan Peeters <apeeters@lashout.net> in Debian bug report 186636.
|
||||
Closes: #186636.
|
||||
* autorefresh may now be a floating-point value. Closes: #190060.
|
||||
|
||||
-- John Goerzen <jgoerzen@complete.org> Mon, 28 Apr 2003 14:00:32 -0500
|
||||
|
||||
|
@ -160,7 +160,8 @@ remoterepository = RemoteExample
|
||||
|
||||
# You can have offlineimap continue running indefinately, automatically
|
||||
# syncing your mail periodically. If you want that, specify how
|
||||
# frequently to do that (in minutes) here.
|
||||
# frequently to do that (in minutes) here. You can also specify
|
||||
# fractional minutes (ie, 3.25).
|
||||
|
||||
# autorefresh = 5
|
||||
|
||||
|
@ -34,6 +34,12 @@ class CustomConfigParser(ConfigParser):
|
||||
else:
|
||||
return default
|
||||
|
||||
def getdefaultfloat(self, section, option, default, *args, **kwargs):
|
||||
if self.has_option(section, option):
|
||||
return apply(self.getfloat, [section, option] + list(args), kwargs)
|
||||
else:
|
||||
return default
|
||||
|
||||
def getdefaultboolean(self, section, option, default, *args, **kwargs):
|
||||
if self.has_option(section, option):
|
||||
return apply(self.getboolean, [section, option] + list(args),
|
||||
@ -91,3 +97,8 @@ class ConfigHelperMixin:
|
||||
self.getconfig().getdefaultint,
|
||||
self.getconfig().getint)
|
||||
|
||||
def getconffloat(self, option, default = CustomConfigDefault):
|
||||
return self._confighelper_runner(option, default,
|
||||
self.getconfig().getdefaultfloat,
|
||||
self.getconfig().getfloat)
|
||||
|
||||
|
@ -43,8 +43,8 @@ class Account(CustomConfig.ConfigHelperMixin):
|
||||
self.metadatadir = config.getmetadatadir()
|
||||
self.localeval = config.getlocaleval()
|
||||
self.ui = UIBase.getglobalui()
|
||||
self.refreshperiod = self.getconfint('autorefresh', 0)
|
||||
if self.refreshperiod == 0:
|
||||
self.refreshperiod = self.getconffloat('autorefresh', 0.0)
|
||||
if self.refreshperiod == 0.0:
|
||||
self.refreshperiod = None
|
||||
|
||||
def getlocaleval(self):
|
||||
@ -79,7 +79,7 @@ class Account(CustomConfig.ConfigHelperMixin):
|
||||
for item in kaobjs:
|
||||
item.startkeepalive()
|
||||
|
||||
refreshperiod = self.refreshperiod * 60
|
||||
refreshperiod = int(self.refreshperiod * 60)
|
||||
sleepresult = self.ui.sleep(refreshperiod)
|
||||
if sleepresult == 2:
|
||||
# Cancel keep-alive, but don't bother terminating threads
|
||||
|
Loading…
Reference in New Issue
Block a user