*buf = 0;
}
-int mutt_user_is_recipient (ADDRESS *a)
+static int user_in_addr (ADDRESS *a)
{
for (; a; a = a->next)
if (mutt_addr_is_user (a))
* 3: user is in the CC list
* 4: user is originator
*/
-static int user_is_recipient (ENVELOPE *hdr)
+static int user_is_recipient (HEADER *h)
{
- if (mutt_addr_is_user (hdr->from))
- return 4;
+ ENVELOPE *hdr = h->env;
- if (mutt_user_is_recipient (hdr->to))
+ if(!h->recip_valid)
{
- if (hdr->to->next || hdr->cc)
- return 2; /* non-unique recipient */
- else
- return 1; /* unique recipient */
- }
-
- if (mutt_user_is_recipient (hdr->cc))
- return 3;
+ h->recip_valid = 1;
+
+ if (mutt_addr_is_user (hdr->from))
+ h->recipient = 4;
- return (0);
+ if (user_in_addr (hdr->to))
+ {
+ if (hdr->to->next || hdr->cc)
+ h->recipient = 2; /* non-unique recipient */
+ else
+ h->recipient = 1; /* unique recipient */
+ }
+
+ if (user_in_addr (hdr->cc))
+ h->recipient = 3;
+
+ h->recipient = 0;
+ }
+
+ return h->recipient;
}
/* %a = address of author
case 'T':
snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
snprintf (dest, destlen, fmt,
- (Tochars && ((i = user_is_recipient (hdr->env))) < strlen (Tochars)) ? Tochars[i] : ' ');
+ (Tochars && ((i = user_is_recipient (hdr))) < strlen (Tochars)) ? Tochars[i] : ' ');
break;
case 'u':
hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch),
hdr->tagged ? '*' :
(hdr->flagged ? '!' :
- (Tochars && ((i = user_is_recipient (hdr->env)) < strlen (Tochars)) ? Tochars[user_is_recipient (hdr->env)] : ' ')));
+ (Tochars && ((i = user_is_recipient (hdr)) < strlen (Tochars)) ? Tochars[i] : ' ')));
snprintf (dest, destlen, fmt, buf2);
break;
break;
}
+ if (option(OPTATTACHMSG) && (!strcmp(MuttVars[idx].option, "alternates")
+ || !strcmp(MuttVars[idx].option, "reply_regexp")))
+ {
+ snprintf (err->data, err->dsize, "Operation not permitted when in attach-message mode.");
+ r = -1;
+ break;
+ }
+
s->dptr++;
/* copy the value of the string */
ptr->rx = rx;
ptr->not = not;
- /* $reply_regexp requires special treatment */
+ /* $reply_regexp and $alterantes require special treatment */
+
if (Context && Context->msgcount &&
strcmp (MuttVars[idx].option, "reply_regexp") == 0)
{
}
#undef CUR_ENV
}
+
+ if(Context && Context->msgcount &&
+ strcmp(MuttVars[idx].option, "alternates") == 0)
+ {
+ int i;
+
+ for(i = 0; i < Context->msgcount; i++)
+ Context->hdrs[i]->recip_valid = 0;
+ }
}
}
else if (DTYPE(MuttVars[idx].type) == DT_MAGIC)
unsigned int display_subject : 1; /* used for threading */
unsigned int fake_thread : 1; /* no ref matched, but subject did */
unsigned int threaded : 1; /* message has been threaded */
-
- unsigned int active : 1;
+ unsigned int recip_valid : 1; /* is_recipient is valid */
+ unsigned int active : 1; /* message is not to be removed */
/* timezone of the sender of this message */
unsigned int zhours : 5;
unsigned int limited : 1; /* is this message in a limited view? */
size_t num_hidden; /* number of hidden messages in this view */
+ short recipient; /* user_is_recipient()'s return value, cached */
+
int pair; /* color-pair to use when displaying in the index */
time_t date_sent; /* time when the message was sent (UTC) */