summaryrefslogtreecommitdiff
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
parent33dbd12738cc42efbdf0442050dd2ddfbff253e0 (diff)
downloadalpine-3a705ccfd0bb4d65d4bc35683726971edfd9309c.tar.xz
* The bounce command adds a subcommand to choose a role.
-rw-r--r--alpine/reply.c2
-rw-r--r--alpine/send.c65
-rw-r--r--alpine/send.h2
-rw-r--r--pith/pine.hlp4
4 files changed, 65 insertions, 8 deletions
diff --git a/alpine/reply.c b/alpine/reply.c
index 1865dcae..d13d041e 100644
--- a/alpine/reply.c
+++ b/alpine/reply.c
@@ -2051,7 +2051,7 @@ bounce_msg(MAILSTREAM *stream,
MESSAGECACHE *mc;
if((errstr = bounce_msg_body(stream, rawno, part, to, subject, &outgoing, &body, &was_seen)) == NULL){
- if(pine_simple_send(outgoing, &body, role, pmt_who, pmt_cnf, to,
+ if(pine_simple_send(outgoing, &body, &role, pmt_who, pmt_cnf, to,
!(to && *to) ? SS_PROMPTFORTO : 0) < 0){
errstr = ""; /* p_s_s() better have explained! */
/* clear seen flag */
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);
diff --git a/alpine/send.h b/alpine/send.h
index 64209931..b6684771 100644
--- a/alpine/send.h
+++ b/alpine/send.h
@@ -38,7 +38,7 @@
void compose_screen(struct pine *);
void alt_compose_screen(struct pine *);
void compose_mail(char *, char *, ACTION_S *, PATMT *, gf_io_t);
-int pine_simple_send(ENVELOPE *, BODY **, ACTION_S *, char *, char *, char **, int);
+int pine_simple_send(ENVELOPE *, BODY **, ACTION_S **, char *, char *, char **, int);
void pine_send(ENVELOPE *, BODY **, char *, ACTION_S *, char *, REPLY_S *,
REDRAFT_POS_S *, char *, PINEFIELD *, int);
int upload_msg_to_pico(char *, size_t, long *);
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 7590d850..f27f71d1 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 163 2016-08-27 09:32:18
+Alpine Commit 164 2016-08-27 10:14:30
============= h_news =================
<HTML>
<HEAD>
@@ -349,6 +349,8 @@ Additions include:
selected will be bounced, or if not all selected messages will be
bounced. Suggested by Ulf-Dietrich Braumann.
+ <LI> The bounce command adds a subcommand to choose a role.
+
<LI> When selecting messages by number, the &quot;.&quot; character can
be used to specify the message on which the cursor is on.