summaryrefslogtreecommitdiff
path: root/alpine/send.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-08-27 10:14:34 -0600
committerEduardo Chappa <chappa@washington.edu>2016-08-27 10:14:34 -0600
commit3a705ccfd0bb4d65d4bc35683726971edfd9309c (patch)
treeec5816e124a212e99254f577f8ef23117cd21c82 /alpine/send.c
parent33dbd12738cc42efbdf0442050dd2ddfbff253e0 (diff)
downloadalpine-3a705ccfd0bb4d65d4bc35683726971edfd9309c.tar.xz
* The bounce command adds a subcommand to choose a role.
Diffstat (limited to 'alpine/send.c')
-rw-r--r--alpine/send.c65
1 files changed, 60 insertions, 5 deletions
diff --git a/alpine/send.c b/alpine/send.c
index 90561345..5b57451f 100644
--- a/alpine/send.c
+++ b/alpine/send.c
@@ -1042,13 +1042,13 @@ Returns 0 on success, -1 on failure.
int
pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
struct mail_bodystruct **body,
- ACTION_S *role,
+ ACTION_S **rolep,
char *prmpt_who,
char *prmpt_cnf,
char **used_tobufval,
int flagsarg)
{
- char **tobufp, *p;
+ char **tobufp, *p, tmp[MAILTMPLEN];
void *messagebuf;
int done = 0, retval = 0, x;
int lastrc, rc = 0, ku, i, resize_len, result, fcc_result;
@@ -1058,6 +1058,8 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
ESCKEY_S ekey[5];
BUILDER_ARG ba_fcc;
METAENV *header;
+ ACTION_S *role = rolep ? *rolep : NULL;
+ PAT_STATE pstate;
dprint((1,"\n === simple send called === \n"));
@@ -1105,6 +1107,13 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
ekey[i++].label = N_("Complete");
}
+ if(nonempty_patterns(ROLE_DO_ROLES, &pstate) && first_pattern(&pstate)){
+ ekey[i].ch = ctrl('R');
+ ekey[i].rval = 15;
+ ekey[i].name = "^R";
+ ekey[i++].label = "Set Role";
+ }
+
ekey[i].ch = KEY_UP;
ekey[i].rval = 30;
ekey[i].name = "";
@@ -1118,6 +1127,9 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
ekey[i].ch = -1;
+ if(outgoing->remail == NULL)
+ strcpy(tmp, _("FORWARD (as e-mail) to : "));
+
/*----------------------------------------------------------------------
Loop editing the "To: " field until everything goes well
----*/
@@ -1126,6 +1138,14 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
while(!done){
int flags;
+ if(outgoing->remail){
+ if(role)
+ snprintf(tmp, sizeof(tmp), _("BOUNCE (redirect) message using role \"%s\" to : "), role->nick);
+ else
+ strncpy(tmp, _("BOUNCE (redirect) message to : "), sizeof(tmp));
+ tmp[sizeof(tmp)-1] = '\0';
+ }
+
if(!og2s_done){
og2s_done++;
outgoing2strings(header, *body, &messagebuf, NULL, 1);
@@ -1158,9 +1178,7 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
0, resize_len,
prmpt_who
? prmpt_who
- : outgoing->remail == NULL
- ? _("FORWARD (as e-mail) to : ")
- : _("BOUNCE (redirect) message to : "),
+ : tmp,
ekey, help, &flags);
}
else
@@ -1174,6 +1192,43 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */
done++;
break;
+ case 15 : /* set a role */
+ {void (*prev_screen)(struct pine *) = NULL, (*redraw)(void) = NULL;
+
+ redraw = ps_global->redrawer;
+ ps_global->redrawer = NULL;
+ prev_screen = ps_global->prev_screen;
+ role = NULL;
+ ps_global->next_screen = SCREEN_FUN_NULL;
+
+ if(role_select_screen(ps_global, &role,
+ outgoing->remail ? MC_BOUNCE : MC_FORWARD) < 0)
+ cmd_cancelled(_("Set Role"));
+ else{
+ if(role)
+ role = combine_inherited_role(role);
+ else{
+ role = (ACTION_S *) fs_get(sizeof(*role));
+ memset((void *) role, 0, sizeof(*role));
+ role->nick = cpystr("Default Role");
+ }
+ }
+
+ if(redraw)
+ (*redraw)();
+
+ ps_global->next_screen = prev_screen;
+ ps_global->redrawer = redraw;
+ ps_global->mangled_screen = 1;
+
+ if(role && role->from && !ps_global->never_allow_changing_from){
+ mail_free_address (&outgoing->from);
+ outgoing->from = copyaddrlist(role->from);
+ }
+ if(rolep) *rolep = role;
+ }
+ break;
+
case 30 :
if((p = get_prev_hist(history, *tobufp, 0, NULL)) != NULL){
strncpy(*tobufp, p, resize_len);