massive refactoring

* primary goal: reduce global vars, slim down main file
  (only do initialization of global stuff here, move everything else to a daemon class)
* properly close all open pop3/imap connections on shutdown
* throw/catch meaningful exceptions
* renamed IdleRunner/Idler run() methods to start() since 'run' suggests a blocking call (as in dialog.run())
This commit is contained in:
Patrick Ulbrich
2014-02-01 21:44:07 +01:00
parent 1c7dcc7aaf
commit 113b3a1506
12 changed files with 405 additions and 224 deletions

View File

@@ -3,7 +3,7 @@
#
# userscriptplugin.py
#
# Copyright 2013 Patrick Ulbrich <zulu99@gmx.net>
# Copyright 2013, 2014 Patrick Ulbrich <zulu99@gmx.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,16 +42,18 @@ class UserscriptPlugin(Plugin):
self._mails_added_hook = mails_added_hook
controller = self.get_mailnag_controller()
hooks = controller.get_hooks()
controller.hooks.register_hook_func(HookTypes.MAILS_ADDED,
hooks.register_hook_func(HookTypes.MAILS_ADDED,
self._mails_added_hook)
def disable(self):
controller = self.get_mailnag_controller()
hooks = controller.get_hooks()
if self._mails_added_hook != None:
controller.hooks.unregister_hook_func(HookTypes.MAILS_ADDED,
hooks.unregister_hook_func(HookTypes.MAILS_ADDED,
self._mails_added_hook)
self._mails_added_hook = None