Just tested it. Working well. Thanks a million. Jess
On Tue, Sep 1, 2015 at 8:41 AM, Oswald Buddenhagen <o...@users.sf.net> wrote: > commit 8979ebbdf221f51290fffbf941f7c517c2bf7ae0 > Author: Oswald Buddenhagen <o...@users.sf.net> > Date: Tue Sep 1 14:21:45 2015 +0200 > > tolerate case changes in X-TUID header name > > it is legal for an email system to simply change the case of rfc2822 > headers, and at least one imap server apparently does just that. > this would lead to us not finding our own header, which is obviously > not > helpful. > > REFMAIL: > ca+fd2u3hjeszmvwbsxeptsawgj2dh373mcesm3m0kg3zway...@mail.gmail.com > > src/common.h | 1 + > src/drv_imap.c | 2 +- > src/sync.c | 2 +- > src/util.c | 16 ++++++++++++++++ > 4 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/src/common.h b/src/common.h > index 238af79..18390f3 100644 > --- a/src/common.h > +++ b/src/common.h > @@ -116,6 +116,7 @@ void *memrchr( const void *s, int c, size_t n ); > #endif > > int starts_with( const char *str, int strl, const char *cmp, int cmpl ); > +int starts_with_upper( const char *str, int strl, const char *cmp, int > cmpl ); > int equals( const char *str, int strl, const char *cmp, int cmpl ); > > #ifndef HAVE_TIMEGM > diff --git a/src/drv_imap.c b/src/drv_imap.c > index a0c13e0..608a2d3 100644 > --- a/src/drv_imap.c > +++ b/src/drv_imap.c > @@ -967,7 +967,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char > *s ATTR_UNUSED ) > tmp = tmp->next; > if (!is_atom( tmp )) > goto bfail; > - if (starts_with( tmp->val, > tmp->len, "X-TUID: ", 8 )) > + if (starts_with_upper( tmp->val, > tmp->len, "X-TUID: ", 8 )) > tuid = tmp->val + 8; > } else { > bfail: > diff --git a/src/sync.c b/src/sync.c > index eb444e0..4fb2026 100644 > --- a/src/sync.c > +++ b/src/sync.c > @@ -338,7 +338,7 @@ msg_fetched( int sts, void *aux ) > if (c == '\r') > lcrs++; > else if (c == '\n') { > - if (starts_with( fmap + > start, len - start, "X-TUID: ", 8 )) { > + if (starts_with_upper( > fmap + start, len - start, "X-TUID: ", 8 )) { > extra = (sbreak = > start) - (ebreak = i); > goto oke; > } > diff --git a/src/util.c b/src/util.c > index 6851c6f..f05eec6 100644 > --- a/src/util.c > +++ b/src/util.c > @@ -27,6 +27,7 @@ > #include <unistd.h> > #include <fcntl.h> > #include <string.h> > +#include <ctype.h> > #include <pwd.h> > > static int need_nl; > @@ -242,6 +243,21 @@ starts_with( const char *str, int strl, const char > *cmp, int cmpl ) > } > > int > +starts_with_upper( const char *str, int strl, const char *cmp, int cmpl ) > +{ > + int i; > + > + if (strl < 0) > + strl = strnlen( str, cmpl + 1 ); > + if (strl < cmpl) > + return 0; > + for (i = 0; i < cmpl; i++) > + if (str[i] != cmp[i] && toupper( str[i] ) != cmp[i]) > + return 0; > + return 1; > +} > + > +int > equals( const char *str, int strl, const char *cmp, int cmpl ) > { > if (strl < 0) > > > ------------------------------------------------------------------------------ > _______________________________________________ > isync-devel mailing list > isync-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/isync-devel >
------------------------------------------------------------------------------
_______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel