text stringlengths 0 357 |
|---|
dc_log_warning(imap->context, 0, "IMAP-IDLE returns unknown value r=%i, r2=%i.", r, r2); |
} |
} |
else |
{ |
fake_idle(imap); |
} |
cleanup: |
; |
} |
void dc_imap_interrupt_idle(dc_imap_t* imap) |
{ |
if (imap==NULL) { |
return; |
} |
if (imap->can_idle) |
{ |
if (imap->etpan && imap->etpan->imap_stream) { |
mailstream_interrupt_idle(imap->etpan->imap_stream); |
} |
} |
// always signal the fake-idle as it may be used if the real-idle is not available for any reasons (no network ...) |
pthread_mutex_lock(&imap->watch_condmutex); |
imap->watch_condflag = 1; |
pthread_cond_signal(&imap->watch_cond); |
pthread_mutex_unlock(&imap->watch_condmutex); |
} |
/******************************************************************************* |
* Setup handle |
******************************************************************************/ |
static int setup_handle_if_needed(dc_imap_t* imap) |
{ |
int r = 0; |
int success = 0; |
if (imap==NULL || imap->imap_server==NULL) { |
goto cleanup; |
} |
if (imap->should_reconnect) { |
unsetup_handle(imap); |
} |
if (imap->etpan) { |
success = 1; |
goto cleanup; |
} |
imap->etpan = mailimap_new(0, NULL); |
mailimap_set_timeout(imap->etpan, DC_IMAP_TIMEOUT_SEC); |
if (imap->server_flags&(DC_LP_IMAP_SOCKET_STARTTLS|DC_LP_IMAP_SOCKET_PLAIN)) |
{ |
r = mailimap_socket_connect(imap->etpan, imap->imap_server, imap->imap_port); |
if (dc_imap_is_error(imap, r)) { |
dc_log_event_seq(imap->context, DC_EVENT_ERROR_NETWORK, &imap->log_connect_errors, |
"Could not connect to IMAP-server %s:%i. (Error #%i)", imap->imap_server, (int)imap->imap_port, (int)r); |
goto cleanup; |
} |
if (imap->server_flags&DC_LP_IMAP_SOCKET_STARTTLS) |
{ |
r = mailimap_socket_starttls(imap->etpan); |
if (dc_imap_is_error(imap, r)) { |
dc_log_event_seq(imap->context, DC_EVENT_ERROR_NETWORK, &imap->log_connect_errors, |
"Could not connect to IMAP-server %s:%i using STARTTLS. (Error #%i)", imap->imap_server, (int)imap->imap_port, (int)r); |
goto cleanup; |
} |
dc_log_info(imap->context, 0, "IMAP-server %s:%i STARTTLS-connected.", imap->imap_server, (int)imap->imap_port); |
} |
else |
{ |
dc_log_info(imap->context, 0, "IMAP-server %s:%i connected.", imap->imap_server, (int)imap->imap_port); |
} |
} |
else |
{ |
r = mailimap_ssl_connect(imap->etpan, imap->imap_server, imap->imap_port); |
if (dc_imap_is_error(imap, r)) { |
dc_log_event_seq(imap->context, DC_EVENT_ERROR_NETWORK, &imap->log_connect_errors, |
"Could not connect to IMAP-server %s:%i using SSL. (Error #%i)", imap->imap_server, (int)imap->imap_port, (int)r); |
goto cleanup; |
} |
dc_log_info(imap->context, 0, "IMAP-server %s:%i SSL-connected.", imap->imap_server, (int)imap->imap_port); |
} |
/* from mailcore2/MCIMAPSession.cpp */ |
if (imap->server_flags&DC_LP_AUTH_OAUTH2) |
{ |
// for DC_LP_AUTH_OAUTH2, user_pw is assumed to be the oauth_token |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.