diff options
-rwxr-xr-x | email-common-use/include/email-internal-types.h | 2 | ||||
-rwxr-xr-x | email-core/email-core-imap-idle.c | 39 |
2 files changed, 22 insertions, 19 deletions
diff --git a/email-common-use/include/email-internal-types.h b/email-common-use/include/email-internal-types.h index 98620b9..a009db3 100755 --- a/email-common-use/include/email-internal-types.h +++ b/email-common-use/include/email-internal-types.h @@ -240,7 +240,7 @@ typedef pthread_t thread_t; #define INLINE_ATTACHMENT 1 #define ATTACHMENT 2 -#define EVENT_QUEUE_MAX 32 +#define EVENT_QUEUE_MAX 64 #define EMAIL_LAUNCHED_BY_UNKNOWN_METHOD 0 #define EMAIL_LAUNCHED_BY_DBUS_ACTIVATION 1 diff --git a/email-core/email-core-imap-idle.c b/email-core/email-core-imap-idle.c index 50f45a1..3d97cb3 100755 --- a/email-core/email-core-imap-idle.c +++ b/email-core/email-core-imap-idle.c @@ -340,7 +340,7 @@ static int emcore_connect_and_idle_on_mailbox(char *multi_user_name, /* Send IDLE command */ if (!imap_local->netstream || !net_sout(imap_local->netstream, cmd, (int)EM_SAFE_STRLEN(cmd))) { - EM_DEBUG_EXCEPTION_SEC("network error - failed to IDLE on Mailbox - %s ", input_mailbox->mailbox_name); + EM_DEBUG_EXCEPTION("network error - failed to IDLE on Mailbox - [%d]", input_mailbox->mailbox_id); err = EMAIL_ERROR_IMAP4_IDLE_FAILURE; goto FINISH_OFF; } @@ -349,36 +349,39 @@ static int emcore_connect_and_idle_on_mailbox(char *multi_user_name, while (imap_local->netstream) { p = net_getline(imap_local->netstream); - EM_DEBUG_LOG("p =[%s]", p); + EM_DEBUG_LOG("IDLE command response: [%s]", p); - if (p && !strncmp(p, "+", 1)) { + if (p && '+' == *p) { EM_DEBUG_LOG("OK. Go."); break; - } else if (p && !strncmp(p, "*", 1)) { + } else if (p && '*' == *p) { EM_SAFE_FREE(p); continue; } else { - EM_DEBUG_LOG("Unsuspected response."); + EM_DEBUG_EXCEPTION("Unsuspected response: [%s]", p); err = EMAIL_ERROR_IMAP4_IDLE_FAILURE; break; } - } + } + EM_SAFE_FREE(p); - connection_info = em_malloc(sizeof(email_imap_idle_connection_info_t)); - if (connection_info == NULL) { - EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY"); - err = EMAIL_ERROR_OUT_OF_MEMORY; - goto FINISH_OFF; - } + if (err == EMAIL_ERROR_NONE) { + connection_info = em_malloc(sizeof(email_imap_idle_connection_info_t)); + if (connection_info == NULL) { + EM_DEBUG_EXCEPTION("EMAIL_ERROR_OUT_OF_MEMORY"); + err = EMAIL_ERROR_OUT_OF_MEMORY; + goto FINISH_OFF; + } - connection_info->account_id = input_account->account_id; - connection_info->mailbox_id = input_mailbox->mailbox_id; - connection_info->mail_stream = mail_stream; - connection_info->socket_fd = socket_fd; - connection_info->multi_user_name = EM_SAFE_STRDUP(multi_user_name); + connection_info->account_id = input_account->account_id; + connection_info->mailbox_id = input_mailbox->mailbox_id; + connection_info->mail_stream = mail_stream; + connection_info->socket_fd = socket_fd; + connection_info->multi_user_name = EM_SAFE_STRDUP(multi_user_name); - imap_idle_connection_list = g_list_append(imap_idle_connection_list, (gpointer)connection_info); + imap_idle_connection_list = g_list_append(imap_idle_connection_list, (gpointer)connection_info); + } FINISH_OFF: |