Skip to content

Application exit on connection failure #28

@IngoMeyer441

Description

@IngoMeyer441

Currently, the application exits when one account could not connect to the mail server. Wouldn't it be better to run another connection attempt after a short time period?

I think of these kind of changes:

diff --git a/ayatanawebmail/application.py b/ayatanawebmail/application.py
index 917fb3b..c17c4c8 100755
--- a/ayatanawebmail/application.py
+++ b/ayatanawebmail/application.py
@@ -1102,12 +1102,15 @@ class AyatanaWebmail(object):
 
                     logger.error('"{0}:{1}" could not connect: {2}'.format(oConnection.strLogin, oConnection.strFolder, str(oException)))
 
+                    oConnection.bConnecting = True
+                    GLib.timeout_add_seconds(1, oConnection.close)
+                    logger.info('"{0}:{1}" will try to reconnect in 1 minute.'.format(oConnection.strLogin, oConnection.strFolder))
+                    GLib.timeout_add_seconds(60, self.connect, [oConnection])
+
                     oNotification = Notify.Notification.new(_('Connection error'), '', APPNAME)
-                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", the application will now exit.').format(accountName=oConnection.strLogin))
+                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", will try to reconnect in 1 minute.').format(accountName=oConnection.strLogin))
                     oNotification.set_hint('desktop-entry', GLib.Variant.new_string(APPNAME))
-                    oNotification.set_timeout(Notify.EXPIRES_NEVER)
                     oNotification.show()
-                    self.close(1)
 
         return False
 

What do you think about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions