summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-07-20 09:38:07 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-07-20 09:38:07 +0000
commita71df9dc6c7ee61b7259ec7ab3b50787f96d90b4 (patch)
tree6c6283135ea82cfdd7d25c9a1a0a000ade83249c /init.c
parentd0b3c76ae7658317eefe99de8b281d80ad36bc02 (diff)
As Aaron Schrab noted, patch-0.95.6.tlr.reverse_name.1 broke the use
of my_hdr from send-hooks. This patch introduces a new variable $from which can be used to use a default sender address; to make this possible, a new variable class DT_ADDR is defined. We now have the following algorithm for determining the from address: - $from is used as the default from address, if defined. Otherwise, the local user name and (if the user wishes so) the local domain are used. - This address can be overridden by $reverse_name, if set. - Now, send-hooks are evaluated. - Afterwards, user headers are evaluated. In this step, the from header can be overridden using my_hdr From:. - When there is no real name, $realname is used for it. Note that, when the default from header is used and $from defines a real name, it takes precedence over $realname.
Diffstat (limited to 'init.c')
-rw-r--r--init.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/init.c b/init.c
index 17405b8e..84aa95aa 100644
--- a/init.c
+++ b/init.c
@@ -646,6 +646,13 @@ static void mutt_restore_default (struct option_t *p)
*((char **) p->data) = safe_strdup (path);
}
break;
+ case DT_ADDR:
+ if (p->init)
+ {
+ rfc822_free_address ((ADDRESS **) p->data);
+ *((ADDRESS **) p->data) = rfc822_parse_adrlist (NULL, (char *) p->init);
+ }
+ break;
case DT_BOOL:
if (p->init)
set_option (p->data);
@@ -814,7 +821,8 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
set_option (MuttVars[idx].data);
}
else if (DTYPE (MuttVars[idx].type) == DT_STR ||
- DTYPE (MuttVars[idx].type) == DT_PATH)
+ DTYPE (MuttVars[idx].type) == DT_PATH ||
+ DTYPE (MuttVars[idx].type) == DT_ADDR)
{
if (query || *s->dptr != '=')
{
@@ -827,18 +835,26 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
s->dptr++;
/* copy the value of the string */
- FREE (MuttVars[idx].data);
+ if (DTYPE (MuttVars[idx].type) == DT_ADDR)
+ rfc822_free_address ((ADDRESS **) MuttVars[idx].data);
+ else
+ FREE (MuttVars[idx].data);
+
mutt_extract_token (tmp, s, 0);
- if (MuttVars[idx].type == DT_PATH)
+ if (DTYPE (MuttVars[idx].type) == DT_PATH)
{
strfcpy (scratch, tmp->data, sizeof (scratch));
mutt_expand_path (scratch, sizeof (scratch));
*((char **) MuttVars[idx].data) = safe_strdup (scratch);
}
- else
+ else if (DTYPE (MuttVars[idx].type) == DT_STR)
{
*((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
}
+ else
+ {
+ *((ADDRESS **) MuttVars[idx].data) = rfc822_parse_adrlist (NULL, tmp->data);
+ }
}
else if (DTYPE(MuttVars[idx].type) == DT_RX)
{
@@ -1442,6 +1458,11 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
(DTYPE(MuttVars[idx].type) == DT_RX))
snprintf(pt, dlen, "%s\"%s\"", tmp,
NONULL (*((char **) MuttVars[idx].data)));
+ else if (DTYPE (MuttVars[idx].type) == DT_ADDR)
+ {
+ *pt = '\0';
+ rfc822_write_address (pt, dlen, *((ADDRESS **) MuttVars[idx].data));
+ }
else if (DTYPE (MuttVars[idx].type) == DT_QUAD)
snprintf(pt, dlen, "%s%s", tmp, vals[quadoption (MuttVars[idx].data)]);
else if (DTYPE (MuttVars[idx].type) == DT_NUM)