diff --git a/cmdline/main.c b/cmdline/main.c index e93f173b..bc48525d 100644 --- a/cmdline/main.c +++ b/cmdline/main.c @@ -59,9 +59,6 @@ static uintptr_t receive_event(mrmailbox_t* mailbox, int event, uintptr_t data1, case MR_EVENT_WAKE_LOCK: break; /* do not show the event as this would fill the screen */ - case MR_EVENT_IS_ONLINE: - return 1; - case MR_EVENT_INFO: printf("%s\n", (char*)data2); break; diff --git a/src/mrevent.h b/src/mrevent.h index 1b8bcbe7..d935551e 100644 --- a/src/mrevent.h +++ b/src/mrevent.h @@ -171,9 +171,18 @@ services. data1=file name, data2=mime type */ /* The following events are functions that should be provided by the frontends */ -/** check, if the system is online currently -ret=0: not online, ret=1: online */ -#define MR_EVENT_IS_ONLINE 2080 +/** + * Ask the frontend about the offline state. + * This function may be provided by the frontend. If we already know, that we're + * offline, eg. there is no need to try to connect and things will speed up. + * + * @param data1 0 + * + * @param data2 0 + * + * @return 0=online, 1=offline + */ +#define MR_EVENT_IS_OFFLINE 2081 /** get a string from the frontend, data1=MR_STR_*, ret=string which will be diff --git a/src/mrimap.c b/src/mrimap.c index dd69e0c8..833dae35 100644 --- a/src/mrimap.c +++ b/src/mrimap.c @@ -1083,7 +1083,7 @@ static int setup_handle_if_needed__(mrimap_t* ths) goto cleanup; } - if( ths->m_mailbox->m_cb(ths->m_mailbox, MR_EVENT_IS_ONLINE, 0, 0)!=1 ) { + if( ths->m_mailbox->m_cb(ths->m_mailbox, MR_EVENT_IS_OFFLINE, 0, 0)!=0 ) { mrmailbox_log_error_if(&ths->m_log_connect_errors, ths->m_mailbox, MR_ERR_NONETWORK, NULL); goto cleanup; } diff --git a/src/mrmailbox_configure.c b/src/mrmailbox_configure.c index 75a761fc..51d5a325 100644 --- a/src/mrmailbox_configure.c +++ b/src/mrmailbox_configure.c @@ -384,7 +384,7 @@ static void* configure_thread_entry_point(void* entry_arg) PROGRESS(0) - if( mailbox->m_cb(mailbox, MR_EVENT_IS_ONLINE, 0, 0)!=1 ) { + if( mailbox->m_cb(mailbox, MR_EVENT_IS_OFFLINE, 0, 0)!=0 ) { mrmailbox_log_error(mailbox, MR_ERR_NONETWORK, NULL); goto exit_; } diff --git a/src/mrmailbox_log.c b/src/mrmailbox_log.c index c644516a..dbd96cfa 100644 --- a/src/mrmailbox_log.c +++ b/src/mrmailbox_log.c @@ -171,7 +171,7 @@ void mrmailbox_log_error_if(int* condition, mrmailbox_t* mailbox, int code, cons va_start(va, msg); if( *condition ) { /* pop-up error, if we're offline, force a "not connected" error (the function is not used for other cases) */ - if( mailbox->m_cb(mailbox, MR_EVENT_IS_ONLINE, 0, 0)!=1 ) { + if( mailbox->m_cb(mailbox, MR_EVENT_IS_OFFLINE, 0, 0)!=0 ) { mrmailbox_log_vprintf(mailbox, MR_EVENT_ERROR, MR_ERR_NONETWORK, NULL, va); } else { diff --git a/src/mrsmtp.c b/src/mrsmtp.c index cd9c44bf..89965836 100644 --- a/src/mrsmtp.c +++ b/src/mrsmtp.c @@ -107,7 +107,7 @@ int mrsmtp_connect(mrsmtp_t* ths, const mrloginparam_t* lp) LOCK_SMTP - if( ths->m_mailbox->m_cb(ths->m_mailbox, MR_EVENT_IS_ONLINE, 0, 0)!=1 ) { + if( ths->m_mailbox->m_cb(ths->m_mailbox, MR_EVENT_IS_OFFLINE, 0, 0)!=0 ) { mrmailbox_log_error_if(&ths->m_log_connect_errors, ths->m_mailbox, MR_ERR_NONETWORK, NULL); goto cleanup; }