struct Hook *ptr = NULL;
struct Buffer cmd, pattern;
int rc;
- bool not = false, warning = false;
+ bool pat_not = false, warning = false;
regex_t *rx = NULL;
struct PatternHead *pat = NULL;
char path[PATH_MAX];
{
s->dptr++;
SKIPWS(s->dptr);
- not = true;
+ pat_not = true;
}
mutt_extract_token(&pattern, s, MUTT_TOKEN_NO_FLAGS);
return MUTT_CMD_SUCCESS;
}
}
- else if ((ptr->type == data) && (ptr->regex.not == not) &&
+ else if ((ptr->type == data) && (ptr->regex.pat_not == pat_not) &&
(mutt_str_strcmp(pattern.data, ptr->regex.pattern) == 0))
{
if (data & (MUTT_FOLDER_HOOK | MUTT_SEND_HOOK | MUTT_SEND2_HOOK | MUTT_MESSAGE_HOOK |
ptr->pattern = pat;
ptr->regex.pattern = pattern.data;
ptr->regex.regex = rx;
- ptr->regex.not = not;
+ ptr->regex.pat_not = pat_not;
TAILQ_INSERT_TAIL(&Hooks, ptr, entries);
return MUTT_CMD_SUCCESS;
unsigned long data, struct Buffer *err)
{
enum CommandResult rc = MUTT_CMD_ERROR;
- bool not = false;
+ bool pat_not = false;
struct Buffer *name = mutt_buffer_pool_get();
struct Buffer *pattern = mutt_buffer_pool_get();
{
s->dptr++;
SKIPWS(s->dptr);
- not = true;
+ pat_not = true;
}
mutt_extract_token(pattern, s, MUTT_TOKEN_NO_FLAGS);
{
TAILQ_FOREACH(hook, hl, entries)
{
- if ((hook->regex.not == not) &&
+ if ((hook->regex.pat_not == pat_not) &&
(mutt_str_strcmp(mutt_b2s(pattern), hook->regex.pattern) == 0))
{
mutt_str_replace(&hook->command, mutt_b2s(fmtstring));
hook->pattern = pat;
hook->regex.pattern = mutt_str_strdup(mutt_b2s(pattern));
hook->regex.regex = NULL;
- hook->regex.not = not;
+ hook->regex.pat_not = pat_not;
if (!hl)
{
if (!(tmp->type & MUTT_FOLDER_HOOK))
continue;
- if ((path && (regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.not) ||
- (desc && (regexec(tmp->regex.regex, desc, 0, NULL, 0) == 0) ^ tmp->regex.not))
+ if ((path && (regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.pat_not) ||
+ (desc && (regexec(tmp->regex.regex, desc, 0, NULL, 0) == 0) ^ tmp->regex.pat_not))
{
if (mutt_parse_rc_line(tmp->command, token, err) == MUTT_CMD_ERROR)
{
if (hook->type & type)
{
if ((mutt_pattern_exec(SLIST_FIRST(hook->pattern), 0, m, e, &cache) > 0) ^
- hook->regex.not)
+ hook->regex.pat_not)
{
if (mutt_parse_rc_line(hook->command, token, err) == MUTT_CMD_ERROR)
{
{
struct Mailbox *m = ctx ? ctx->mailbox : NULL;
if ((mutt_pattern_exec(SLIST_FIRST(hook->pattern), 0, m, e, &cache) > 0) ^
- hook->regex.not)
+ hook->regex.pat_not)
{
mutt_make_string_flags(path, pathlen, hook->command, ctx, m, e, MUTT_FORMAT_PLAIN);
return 0;
{
if ((tmp->type & hook) &&
((match && (regexec(tmp->regex.regex, match, 0, NULL, 0) == 0)) ^
- tmp->regex.not))
+ tmp->regex.pat_not))
{
mutt_list_insert_tail(matches, mutt_str_strdup(tmp->command));
}
if (!(hook->command && (hook->type & MUTT_ACCOUNT_HOOK)))
continue;
- if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.not)
+ if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.pat_not)
{
inhook = true;
TAILQ_FOREACH(hook, hl, entries)
{
struct Pattern *pat = SLIST_FIRST(hook->pattern);
- if ((mutt_pattern_exec(pat, 0, m, e, &cache) > 0) ^ hook->regex.not)
+ if ((mutt_pattern_exec(pat, 0, m, e, &cache) > 0) ^ hook->regex.pat_not)
{
fmtstring = hook->command;
break;
struct PatternHead *curlist = NULL;
struct PatternHead *tmp = NULL, *tmp2 = NULL;
struct PatternHead *last = NULL;
- bool not = false;
+ bool pat_not = false;
bool alladdr = false;
bool or = false;
bool implicit = true; /* used to detect logical AND operator */
break;
case '!':
ps.dptr++;
- not = !not;
+ pat_not = !pat_not;
break;
case '@':
ps.dptr++;
}
ps.dptr++;
implicit = false;
- not = false;
+ pat_not = false;
alladdr = false;
isalias = false;
break;
else
curlist = tmp;
last = tmp;
- pat->not ^= not;
+ pat->pat_not ^= pat_not;
pat->alladdr |= alladdr;
pat->isalias |= isalias;
- not = false;
+ pat_not = false;
alladdr = false;
isalias = false;
/* compile the sub-expression */
tmp = mutt_pattern_node_new();
pat = SLIST_FIRST(tmp);
- pat->not = not;
+ pat->pat_not = pat_not;
pat->alladdr = alladdr;
pat->isalias = isalias;
pat->stringmatch = (ps.dptr[0] == '=');
pat->groupmatch = (ps.dptr[0] == '%');
- not = false;
+ pat_not = false;
alladdr = false;
isalias = false;
curlist = tmp;
last = tmp;
pat = SLIST_FIRST(tmp);
- pat->not ^= not;
+ pat->pat_not ^= pat_not;
pat->alladdr |= alladdr;
pat->isalias |= isalias;
- not = false;
+ pat_not = false;
alladdr = false;
isalias = false;
ps.dptr = p + 1; /* restore location */
switch (pat->op)
{
case MUTT_PAT_AND:
- return pat->not^(perform_and(pat->child, flags, m, e, cache) > 0);
+ return pat->pat_not ^ (perform_and(pat->child, flags, m, e, cache) > 0);
case MUTT_PAT_OR:
- return pat->not^(perform_or(pat->child, flags, m, e, cache) > 0);
+ return pat->pat_not ^ (perform_or(pat->child, flags, m, e, cache) > 0);
case MUTT_PAT_THREAD:
- return pat->not^match_threadcomplete(pat->child, flags, m, e->thread, 1, 1, 1, 1);
+ return pat->pat_not ^
+ match_threadcomplete(pat->child, flags, m, e->thread, 1, 1, 1, 1);
case MUTT_PAT_PARENT:
- return pat->not^match_threadparent(pat->child, flags, m, e->thread);
+ return pat->pat_not ^ match_threadparent(pat->child, flags, m, e->thread);
case MUTT_PAT_CHILDREN:
- return pat->not^match_threadchildren(pat->child, flags, m, e->thread);
+ return pat->pat_not ^ match_threadchildren(pat->child, flags, m, e->thread);
case MUTT_ALL:
- return !pat->not;
+ return !pat->pat_not;
case MUTT_EXPIRED:
- return pat->not^e->expired;
+ return pat->pat_not ^ e->expired;
case MUTT_SUPERSEDED:
- return pat->not^e->superseded;
+ return pat->pat_not ^ e->superseded;
case MUTT_FLAG:
- return pat->not^e->flagged;
+ return pat->pat_not ^ e->flagged;
case MUTT_TAG:
- return pat->not^e->tagged;
+ return pat->pat_not ^ e->tagged;
case MUTT_NEW:
- return pat->not? e->old || e->read : !(e->old || e->read);
+ return pat->pat_not ? e->old || e->read : !(e->old || e->read);
case MUTT_UNREAD:
- return pat->not? e->read : !e->read;
+ return pat->pat_not ? e->read : !e->read;
case MUTT_REPLIED:
- return pat->not^e->replied;
+ return pat->pat_not ^ e->replied;
case MUTT_OLD:
- return pat->not? (!e->old || e->read) : (e->old && !e->read);
+ return pat->pat_not ? (!e->old || e->read) : (e->old && !e->read);
case MUTT_READ:
- return pat->not^e->read;
+ return pat->pat_not ^ e->read;
case MUTT_DELETED:
- return pat->not^e->deleted;
+ return pat->pat_not ^ e->deleted;
case MUTT_PAT_MESSAGE:
- return pat->not^((EMSG(e) >= pat->min) && (EMSG(e) <= pat->max));
+ return pat->pat_not ^ ((EMSG(e) >= pat->min) && (EMSG(e) <= pat->max));
case MUTT_PAT_DATE:
if (pat->dynamic)
match_update_dynamic_date(pat);
- return pat->not^(e->date_sent >= pat->min && e->date_sent <= pat->max);
+ return pat->pat_not ^ (e->date_sent >= pat->min && e->date_sent <= pat->max);
case MUTT_PAT_DATE_RECEIVED:
if (pat->dynamic)
match_update_dynamic_date(pat);
- return pat->not^(e->received >= pat->min && e->received <= pat->max);
+ return pat->pat_not ^ (e->received >= pat->min && e->received <= pat->max);
case MUTT_PAT_BODY:
case MUTT_PAT_HEADER:
case MUTT_PAT_WHOLE_MSG:
if ((m->magic == MUTT_IMAP) && pat->stringmatch)
return e->matched;
#endif
- return pat->not^msg_search(m, pat, e->msgno);
+ return pat->pat_not ^ msg_search(m, pat, e->msgno);
case MUTT_PAT_SERVERSEARCH:
#ifdef USE_IMAP
if (!m)
case MUTT_PAT_SENDER:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1,
- &e->env->sender);
+ return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS),
+ 1, &e->env->sender);
case MUTT_PAT_FROM:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1,
- &e->env->from);
+ return pat->pat_not ^
+ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->from);
case MUTT_PAT_TO:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1,
- &e->env->to);
+ return pat->pat_not ^
+ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->to);
case MUTT_PAT_CC:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1,
- &e->env->cc);
+ return pat->pat_not ^
+ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 1, &e->env->cc);
case MUTT_PAT_SUBJECT:
if (!e->env)
return 0;
- return pat->not^(e->env->subject &&patmatch(pat, e->env->subject));
+ return pat->pat_not ^ (e->env->subject && patmatch(pat, e->env->subject));
case MUTT_PAT_ID:
case MUTT_PAT_ID_EXTERNAL:
if (!e->env)
return 0;
- return pat->not^(e->env->message_id &&patmatch(pat, e->env->message_id));
+ return pat->pat_not ^ (e->env->message_id && patmatch(pat, e->env->message_id));
case MUTT_PAT_SCORE:
- return pat->not^(e->score >= pat->min &&
- (pat->max == MUTT_MAXRANGE || e->score <= pat->max));
+ return pat->pat_not ^ (e->score >= pat->min &&
+ (pat->max == MUTT_MAXRANGE || e->score <= pat->max));
case MUTT_PAT_SIZE:
- return pat->not^(e->content->length >= pat->min &&
- (pat->max == MUTT_MAXRANGE || e->content->length <= pat->max));
+ return pat->pat_not ^
+ (e->content->length >= pat->min &&
+ (pat->max == MUTT_MAXRANGE || e->content->length <= pat->max));
case MUTT_PAT_REFERENCE:
if (!e->env)
return 0;
- return pat->not^(match_reference(pat, &e->env->references) ||
- match_reference(pat, &e->env->in_reply_to));
+ return pat->pat_not ^ (match_reference(pat, &e->env->references) ||
+ match_reference(pat, &e->env->in_reply_to));
case MUTT_PAT_ADDRESS:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 4,
- &e->env->from, &e->env->sender,
- &e->env->to, &e->env->cc);
+ return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS),
+ 4, &e->env->from, &e->env->sender,
+ &e->env->to, &e->env->cc);
case MUTT_PAT_RECIPIENT:
if (!e->env)
return 0;
- return pat->not^match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS), 2,
- &e->env->to, &e->env->cc);
+ return pat->pat_not ^ match_addrlist(pat, (flags & MUTT_MATCH_FULL_ADDRESS),
+ 2, &e->env->to, &e->env->cc);
case MUTT_PAT_LIST: /* known list, subscribed or not */
{
if (!e->env)
}
else
result = mutt_is_list_recipient(pat->alladdr, e->env);
- return pat->not^result;
+ return pat->pat_not ^ result;
}
case MUTT_PAT_SUBSCRIBED_LIST:
{
}
else
result = mutt_is_subscribed_list_recipient(pat->alladdr, e->env);
- return pat->not^result;
+ return pat->pat_not ^ result;
}
case MUTT_PAT_PERSONAL_RECIP:
{
}
else
result = match_user(pat->alladdr, &e->env->to, &e->env->cc);
- return pat->not^result;
+ return pat->pat_not ^ result;
}
case MUTT_PAT_PERSONAL_FROM:
{
}
else
result = match_user(pat->alladdr, &e->env->from, NULL);
- return pat->not^result;
+ return pat->pat_not ^ result;
}
case MUTT_PAT_COLLAPSED:
- return pat->not^(e->collapsed && e->num_hidden > 1);
+ return pat->pat_not ^ (e->collapsed && e->num_hidden > 1);
case MUTT_PAT_CRYPT_SIGN:
if (!WithCrypto)
break;
- return pat->not^((e->security & SEC_SIGN) ? 1 : 0);
+ return pat->pat_not ^ ((e->security & SEC_SIGN) ? 1 : 0);
case MUTT_PAT_CRYPT_VERIFIED:
if (!WithCrypto)
break;
- return pat->not^((e->security & SEC_GOODSIGN) ? 1 : 0);
+ return pat->pat_not ^ ((e->security & SEC_GOODSIGN) ? 1 : 0);
case MUTT_PAT_CRYPT_ENCRYPT:
if (!WithCrypto)
break;
- return pat->not^((e->security & SEC_ENCRYPT) ? 1 : 0);
+ return pat->pat_not ^ ((e->security & SEC_ENCRYPT) ? 1 : 0);
case MUTT_PAT_PGP_KEY:
if (!(WithCrypto & APPLICATION_PGP))
break;
- return pat->not^((e->security & PGP_KEY) == PGP_KEY);
+ return pat->pat_not ^ ((e->security & PGP_KEY) == PGP_KEY);
case MUTT_PAT_XLABEL:
if (!e->env)
return 0;
- return pat->not^(e->env->x_label &&patmatch(pat, e->env->x_label));
+ return pat->pat_not ^ (e->env->x_label && patmatch(pat, e->env->x_label));
case MUTT_PAT_DRIVER_TAGS:
{
char *tags = driver_tags_get(&e->tags);
- bool rc = (pat->not^(tags &&patmatch(pat, tags)));
+ bool rc = (pat->pat_not ^ (tags && patmatch(pat, tags)));
FREE(&tags);
return rc;
}
case MUTT_PAT_HORMEL:
if (!e->env)
return 0;
- return pat->not^(e->env->spam && e->env->spam->data &&
- patmatch(pat, e->env->spam->data));
+ return pat->pat_not ^ (e->env->spam && e->env->spam->data &&
+ patmatch(pat, e->env->spam->data));
case MUTT_PAT_DUPLICATED:
- return pat->not^(e->thread && e->thread->duplicate_thread);
+ return pat->pat_not ^ (e->thread && e->thread->duplicate_thread);
case MUTT_PAT_MIMEATTACH:
if (!m)
return 0;
{
int count = mutt_count_body_parts(m, e);
- return pat->not^(count >= pat->min &&
- (pat->max == MUTT_MAXRANGE || count <= pat->max));
+ return pat->pat_not ^ (count >= pat->min &&
+ (pat->max == MUTT_MAXRANGE || count <= pat->max));
}
case MUTT_PAT_MIMETYPE:
if (!m)
return 0;
- return pat->not^match_mime_content_type(pat, m, e);
+ return pat->pat_not ^ match_mime_content_type(pat, m, e);
case MUTT_PAT_UNREFERENCED:
- return pat->not^(e->thread && !e->thread->child);
+ return pat->pat_not ^ (e->thread && !e->thread->child);
case MUTT_PAT_BROKEN:
- return pat->not^(e->thread && e->thread->fake_thread);
+ return pat->pat_not ^ (e->thread && e->thread->fake_thread);
#ifdef USE_NNTP
case MUTT_PAT_NEWSGROUPS:
if (!e->env)
return 0;
- return pat->not^(e->env->newsgroups &&patmatch(pat, e->env->newsgroups));
+ return pat->pat_not ^ (e->env->newsgroups && patmatch(pat, e->env->newsgroups));
#endif
}
mutt_error(_("error: unknown op %d (report this error)"), pat->op);
{
p += sprintf(p, "{");
p += sprintf(p, "%d,", e->op);
- p += sprintf(p, "%d,", e->not);
+ p += sprintf(p, "%d,", e->pat_not);
p += sprintf(p, "%d,", e->alladdr);
p += sprintf(p, "%d,", e->stringmatch);
p += sprintf(p, "%d,", e->groupmatch);
if (l->op != r->op)
return 1;
- if (l->not != r->not)
+ if (l->pat_not != r->pat_not)
return 1;
if (l->alladdr != r->alladdr)
return 1;
struct PatternHead expected;
SLIST_INIT(&expected);
struct Pattern e = { .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct PatternHead expected;
SLIST_INIT(&expected);
struct Pattern e = { .op = MUTT_PAT_SUBJECT,
- .not = true,
+ .pat_not = true,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "foo" },
/* root->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "foo" },
/* root->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
- .not = true,
+ .pat_not = true,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "foo" },
/* root->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct Pattern e[4] = { /* root */
{ .op = MUTT_PAT_AND,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "foo" },
/* root->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "bar" },
/* root->child->next->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
struct Pattern e[5] = { /* root */
{ .op = MUTT_PAT_AND,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child */
{ .op = MUTT_PAT_OR,
- .not = true,
+ .pat_not = true,
.alladdr = false,
.stringmatch = false,
.groupmatch = false,
.p.str = NULL },
/* root->child->child */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "foo" },
/* root->child->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,
.p.str = "bar" },
/* root->child->next */
{ .op = MUTT_PAT_SUBJECT,
- .not = false,
+ .pat_not = false,
.alladdr = false,
.stringmatch = true,
.groupmatch = false,