1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-04 18:29:19 +02:00

Move from MR_EVENT_IS_ONLINE to MR_EVENT_IS_OFFLINE to allow passing 0 as the default parameter and keep the stuff running.

This commit is contained in:
B. Petersen 2017-11-15 11:38:10 +01:00
parent 58833040f2
commit cc317f8ce4
6 changed files with 16 additions and 10 deletions

View file

@ -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;

View file

@ -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

View file

@ -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;
}

View file

@ -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_;
}

View file

@ -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 {

View file

@ -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;
}