Permalink
Browse files

Merge pull request #190 from zhanleewo/patch-1

Implemented workaround for 163.com servers.
  • Loading branch information...
dinhviethoa committed Mar 24, 2015
2 parents 36581ed + d3770a9 commit 050f15f30ce40c02d4cf0a9389baca77dec19230
Showing with 25 additions and 2 deletions.
  1. +17 −2 src/low-level/imap/mailimap.c
  2. +6 −0 src/low-level/imap/mailimap.h
  3. +2 −0 src/low-level/imap/mailimap_types.h
@@ -2309,7 +2309,12 @@ int mailimap_send_current_tag(mailimap * session)
int r;
session->imap_tag ++;
- snprintf(tag_str, 15, "%i", session->imap_tag);
+
+ if(mailimap_is_163_workaround_enabled(session))
+ snprintf(tag_str, 15, "C%i", session->imap_tag);
+ else
+ snprintf(tag_str, 15, "%i", session->imap_tag);
+
r = mailimap_tag_send(session->imap_stream, tag_str);
if (r != MAILIMAP_NO_ERROR)
@@ -2502,7 +2507,7 @@ mailimap * mailimap_new(size_t imap_progr_rate,
f->imap_logger = NULL;
f->imap_logger_context = NULL;
-
+ f->is_163_workaround_enabled = 0;
return f;
free_stream_buffer:
@@ -2590,3 +2595,13 @@ void mailimap_set_logger(mailimap * session, void (* logger)(mailimap * session,
session->imap_logger = logger;
session->imap_logger_context = logger_context;
}
+
+LIBETPAN_EXPORT
+void mailimap_set_163_workaround_enabled(mailimap * session, int enabled) {
+ session->is_163_workaround_enabled = enabled;
+}
+
+LIBETPAN_EXPORT
+int mailimap_is_163_workaround_enabled(mailimap * session) {
+ return session->is_163_workaround_enabled;
+}
@@ -803,6 +803,12 @@ LIBETPAN_EXPORT
void mailimap_set_logger(mailimap * session, void (* logger)(mailimap * session, int log_type,
const char * str, size_t size, void * context), void * logger_context);
+LIBETPAN_EXPORT
+int mailimap_is_163_workaround_enabled(mailimap * session);
+
+LIBETPAN_EXPORT
+void mailimap_set_163_workaround_enabled(mailimap * session, int enabled);
+
#ifdef __cplusplus
}
#endif
@@ -3385,6 +3385,8 @@ struct mailimap {
void (* imap_logger)(mailimap * session, int log_type, const char * str, size_t size, void * context);
void * imap_logger_context;
+
+ int is_163_workaround_enabled;
};

1 comment on commit 050f15f

@buaabyl

This comment has been minimized.

Show comment
Hide comment
@buaabyl

buaabyl Dec 13, 2016

thanks, it works!

thanks, it works!

Please sign in to comment.