* selection options. Extract their exact position, and then modify our
* expectation of where the root folder will be specified.
*/
- if (Params[2].Key[0] == '(') {
+ if (Params[2].len && (Params[2].Key[0] == '(')) {
extended_list_in_use = 1;
selection_left = 2;
paren_nest = 0;
for (i=2; i<num_parms; ++i) {
- for (j=0; Params[i].Key[j]; ++j) {
- if (Params[i].Key[j] == '(') ++paren_nest;
- if (Params[i].Key[j] == ')') --paren_nest;
+ if (Params[i].len) {
+ for (j=0; Params[i].Key[j]; ++j) {
+ if (Params[i].Key[j] == '(') ++paren_nest;
+ if (Params[i].Key[j] == ')') --paren_nest;
+ }
}
if (paren_nest == 0) {
selection_right = i; /* found end of selection options */
if ((selection_left > 0) && (selection_right >= selection_left)) {
/* Strip off the outer parentheses */
- if (Params[selection_left].Key[0] == '(') {
+ if (Params[selection_left].len && (Params[selection_left].Key[0] == '(')) {
TokenCutLeft(&Imap->Cmd,
&Params[selection_left],
1);
}
- if (Params[selection_right].Key[Params[selection_right].len-1] == ')') {
+ if (Params[selection_right].len && (Params[selection_right].Key[Params[selection_right].len-1] == ')')) {
TokenCutRight(&Imap->Cmd,
&Params[selection_right],
1);
patterns_left = root_pos + 1;
patterns_right = root_pos + 1;
- if (Params[patterns_left].Key[0] == '(') {
+ if (Params[patterns_left].len && (Params[patterns_left].Key[0] == '(')) {
extended_list_in_use = 1;
paren_nest = 0;
for (i=patterns_left; i<num_parms; ++i) {
- for (j=0; &Params[i].Key[j]; ++j) {
- if (Params[i].Key[j] == '(') ++paren_nest;
- if (Params[i].Key[j] == ')') --paren_nest;
+ if (Params[i].len) {
+ for (j=0; Params[i].Key[j]; ++j) {
+ if (Params[i].Key[j] == '(') ++paren_nest;
+ if (Params[i].Key[j] == ')') --paren_nest;
+ }
}
if (paren_nest == 0) {
patterns_right = i; /* found end of patterns */
extended_list_in_use = 1;
paren_nest = 0;
for (i=return_left; i<num_parms; ++i) {
- for (j=0; Params[i].Key[j]; ++j) {
- if (Params[i].Key[j] == '(') ++paren_nest;
- if (Params[i].Key[j] == ')') --paren_nest;
- }
+ if (Params[i].len) {
+ for (j=0; Params[i].Key[j]; ++j) {
+ if (Params[i].Key[j] == '(') ++paren_nest;
+ if (Params[i].Key[j] == ')') --paren_nest;
+ }
- /* Might as well look for these while we're in here... */
- if (Params[i].Key[0] == '(')
- TokenCutLeft(&Imap->Cmd,
- &Params[i],
- 1);
- if (Params[i].Key[Params[i].len-1] == ')')
- TokenCutRight(&Imap->Cmd,
- &Params[i],
- 1);
+ /* Might as well look for these while we're in here... */
+ if (Params[i].Key[0] == '(')
+ TokenCutLeft(&Imap->Cmd,
+ &Params[i],
+ 1);
+ if (Params[i].len && (Params[i].Key[Params[i].len-1] == ')'))
+ TokenCutRight(&Imap->Cmd,
+ &Params[i],
+ 1);
- syslog(LOG_DEBUG, "evaluating <%s>", Params[i].Key);
+ syslog(LOG_DEBUG, "evaluating <%s>", Params[i].Key);
- if (!strcasecmp(Params[i].Key, "SUBSCRIBED")) {
- ImapFilter.return_subscribed = 1;
- }
+ if (!strcasecmp(Params[i].Key, "SUBSCRIBED")) {
+ ImapFilter.return_subscribed = 1;
+ }
- else if (!strcasecmp(Params[i].Key, "CHILDREN")) {
- ImapFilter.return_children = 1;
+ else if (!strcasecmp(Params[i].Key, "CHILDREN")) {
+ ImapFilter.return_children = 1;
+ }
}
if (paren_nest == 0) {