This commit is contained in:
Kovid Goyal 2010-11-25 14:03:38 -07:00
parent 0b24aeb77f
commit 36bae4bc7b
2 changed files with 9 additions and 2 deletions

View File

@ -73,6 +73,11 @@ class Emailer(Thread): # {{{
self.jobs = Queue()
self.job_manager = job_manager
self._run = True
self.calculate_rate_limit()
self.last_send_time = time.time() - self.rate_limit
def calculate_rate_limit(self):
self.rate_limit = 1
opts = email_config().parse()
rh = opts.relay_host
@ -80,8 +85,6 @@ class Emailer(Thread): # {{{
'gmail.com' in rh or 'live.com' in rh):
self.rate_limit = 301
self.last_send_time = time.time() - self.rate_limit
def stop(self):
self._run = False
self.jobs.put(None)

View File

@ -170,6 +170,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
if not self.send_email_widget.set_email_settings(to_set):
raise AbortCommit('abort')
self.proxy['accounts'] = self._email_accounts.accounts
return ConfigWidgetBase.commit(self)
def make_default(self, *args):
@ -188,6 +189,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
self._email_accounts.remove(idx)
self.changed_signal.emit()
def refresh_gui(self, gui):
gui.emailer.calculate_rate_limit()
if __name__ == '__main__':
from PyQt4.Qt import QApplication