this change makes code more readable
old 'if'
if (is_atom( tmp )) {
....
}
was inverted to
if (!is_atom(tmp))
continue;
and code is now correctly indented.
Signed-off-by: Nikola Pajkovsky <[email protected]>
---
src/drv_imap.c | 115 +++++++++++++++++++++++++++++----------------------------
1 file changed, 58 insertions(+), 57 deletions(-)
diff --git a/src/drv_imap.c b/src/drv_imap.c
index e4dd74c..4688cb6 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -668,67 +668,68 @@ parse_fetch( imap_store_t *ctx, list_t *list )
}
for (tmp = list->child; tmp; tmp = tmp->next) {
- if (is_atom( tmp )) {
- if (!strcmp( "UID", tmp->val )) {
- tmp = tmp->next;
- if (is_atom( tmp ))
- uid = atoi( tmp->val );
- else
- error( "IMAP error: unable to parse
UID\n" );
- } else if (!strcmp( "FLAGS", tmp->val )) {
- tmp = tmp->next;
- if (is_list( tmp )) {
- for (flags = tmp->child; flags; flags =
flags->next) {
- if (is_atom( flags )) {
- if (flags->val[0] ==
'\\') { /* ignore user-defined flags for now */
- if (!strcmp(
"Recent", flags->val + 1)) {
- status
|= M_RECENT;
+ if (!is_atom( tmp ))
+ continue;
+
+ if (!strcmp( "UID", tmp->val )) {
+ tmp = tmp->next;
+ if (is_atom( tmp ))
+ uid = atoi( tmp->val );
+ else
+ error( "IMAP error: unable to parse UID\n" );
+ } else if (!strcmp( "FLAGS", tmp->val )) {
+ tmp = tmp->next;
+ if (is_list( tmp )) {
+ for (flags = tmp->child; flags; flags =
flags->next) {
+ if (is_atom( flags )) {
+ if (flags->val[0] == '\\') { /*
ignore user-defined flags for now */
+ if (!strcmp( "Recent",
flags->val + 1)) {
+ status |=
M_RECENT;
+ goto flagok;
+ }
+ for (i = 0; i <
ARRAY_SIZE(Flags); i++)
+ if (!strcmp(
Flags[i], flags->val + 1 )) {
+ mask |=
1 << i;
goto
flagok;
}
- for (i = 0; i <
ARRAY_SIZE(Flags); i++)
- if
(!strcmp( Flags[i], flags->val + 1 )) {
-
mask |= 1 << i;
-
goto flagok;
- }
- if
(flags->val[1] == 'X' && flags->val[2] == '-')
- goto
flagok; /* ignore system flag extensions */
- error( "IMAP
warning: unknown system flag %s\n", flags->val );
- }
- flagok: ;
- } else
- error( "IMAP error:
unable to parse FLAGS list\n" );
- }
- status |= M_FLAGS;
- } else
- error( "IMAP error: unable to parse
FLAGS\n" );
- } else if (!strcmp( "RFC822.SIZE", tmp->val )) {
- tmp = tmp->next;
- if (is_atom( tmp ))
- size = atoi( tmp->val );
- else
- error( "IMAP error: unable to parse
RFC822.SIZE\n" );
- } else if (!strcmp( "BODY[]", tmp->val )) {
+ if (flags->val[1] ==
'X' && flags->val[2] == '-')
+ goto flagok; /*
ignore system flag extensions */
+ error( "IMAP warning:
unknown system flag %s\n", flags->val );
+ }
+ flagok: ;
+ } else
+ error( "IMAP error: unable to
parse FLAGS list\n" );
+ }
+ status |= M_FLAGS;
+ } else
+ error( "IMAP error: unable to parse FLAGS\n" );
+ } else if (!strcmp( "RFC822.SIZE", tmp->val )) {
+ tmp = tmp->next;
+ if (is_atom( tmp ))
+ size = atoi( tmp->val );
+ else
+ error( "IMAP error: unable to parse
RFC822.SIZE\n" );
+ } else if (!strcmp( "BODY[]", tmp->val )) {
+ tmp = tmp->next;
+ if (is_atom( tmp )) {
+ body = tmp->val;
+ tmp->val = 0; /* don't free together with
list */
+ size = tmp->len;
+ } else
+ error( "IMAP error: unable to parse BODY[]\n" );
+ } else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) {
+ tmp = tmp->next;
+ if (is_list( tmp )) {
tmp = tmp->next;
- if (is_atom( tmp )) {
- body = tmp->val;
- tmp->val = 0; /* don't free
together with list */
- size = tmp->len;
- } else
- error( "IMAP error: unable to parse
BODY[]\n" );
- } else if (!strcmp( "BODY[HEADER.FIELDS", tmp->val )) {
+ if (!is_atom( tmp ) || strcmp( tmp->val, "]" ))
+ goto bfail;
tmp = tmp->next;
- if (is_list( tmp )) {
- tmp = tmp->next;
- if (!is_atom( tmp ) || strcmp(
tmp->val, "]" ))
- goto bfail;
- tmp = tmp->next;
- if (!is_atom( tmp ) || memcmp(
tmp->val, "X-TUID: ", 8 ))
- goto bfail;
- tuid = tmp->val + 8;
- } else {
- bfail:
- error( "IMAP error: unable to parse
BODY[HEADER.FIELDS ...]\n" );
- }
+ if (!is_atom( tmp ) || memcmp( tmp->val,
"X-TUID: ", 8 ))
+ goto bfail;
+ tuid = tmp->val + 8;
+ } else {
+ bfail:
+ error( "IMAP error: unable to parse
BODY[HEADER.FIELDS ...]\n" );
}
}
}
--
1.8.0.2
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel