summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-07-13 21:29:39 -0600
committerEduardo Chappa <chappa@washington.edu>2016-07-13 21:29:39 -0600
commitf08bd49ee1346f0db56d1e913f725fce27bdb4df (patch)
treed080506414b8b8c6fb6ffb1eaa4d5a5c792ca684
parented5e72568b40db990bc375aa86f94c35cc8c05cc (diff)
downloadalpine-f08bd49ee1346f0db56d1e913f725fce27bdb4df.tar.xz
* Add the ability to select messages by number and thread-number by
using '.' character to represent the current message/thread, and "$" to represent the last message/thread.
-rw-r--r--alpine/mailcmd.c56
-rw-r--r--pith/pine.hlp14
2 files changed, 57 insertions, 13 deletions
diff --git a/alpine/mailcmd.c b/alpine/mailcmd.c
index 19becd11..d466fc73 100644
--- a/alpine/mailcmd.c
+++ b/alpine/mailcmd.c
@@ -7534,7 +7534,7 @@ apply_command(struct pine *state, MAILSTREAM *stream, MSGNO_S *msgmap,
int
select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
{
- int r, end;
+ int r, end, cur;
long n1, n2, raw;
char number1[16], number2[16], numbers[80], *p, *t;
HelpType help;
@@ -7581,7 +7581,7 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
*t = '\0';
- end = 0;
+ end = cur = 0;
if(number1[0] == '\0'){
if(*p == '-'){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
@@ -7593,6 +7593,14 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
end = 1;
p += strlen("end");
}
+ else if(!strucmp("$", p)){
+ end = 1;
+ p++;
+ }
+ else if(*p == '.'){
+ cur = 1;
+ p++;
+ }
else{
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("Invalid message number: %s"), numbers);
@@ -7602,6 +7610,8 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
if(end)
n1 = mn_get_total(msgmap);
+ else if(cur)
+ n1 = mn_get_cur(msgmap);
else if((n1 = atol(number1)) < 1L || n1 > mn_get_total(msgmap)){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("\"%s\" out of message number range"),
@@ -7616,12 +7626,20 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
*t = '\0';
- end = 0;
+ end = cur = 0;
if(number2[0] == '\0'){
if(!strucmp("end", p)){
end = 1;
p += strlen("end");
}
+ else if(!strucmp(p, "$")){
+ end = 1;
+ p++;
+ }
+ else if(*p == '.'){
+ cur = 1;
+ p++;
+ }
else{
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("Invalid number range, missing number after \"-\": %s"),
@@ -7632,6 +7650,8 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
if(end)
n2 = mn_get_total(msgmap);
+ else if(cur)
+ n2 = mn_get_cur(msgmap);
else if((n2 = atol(number2)) < 1L || n2 > mn_get_total(msgmap)){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("\"%s\" out of message number range"),
@@ -7685,11 +7705,11 @@ select_by_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **limitsrch)
int
select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
{
- int r, end;
+ int r, end, cur;
long n1, n2;
char number1[16], number2[16], numbers[80], *p, *t;
HelpType help;
- PINETHRD_S *thrd = NULL;
+ PINETHRD_S *thrd = NULL, *th;
MESSAGECACHE *mc;
numbers[0] = '\0';
@@ -7733,7 +7753,7 @@ select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
*t = '\0';
- end = 0;
+ end = cur = 0;
if(number1[0] == '\0'){
if(*p == '-'){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
@@ -7745,6 +7765,14 @@ select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
end = 1;
p += strlen("end");
}
+ else if(!strucmp(p, "$")){
+ end = 1;
+ p++;
+ }
+ else if(*p == '.'){
+ cur = 1;
+ p++;
+ }
else{
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("Invalid thread number: %s"), numbers);
@@ -7754,6 +7782,10 @@ select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
if(end)
n1 = msgmap->max_thrdno;
+ else if(cur){
+ th = fetch_thread(stream, mn_m2raw(msgmap, mn_get_cur(msgmap)));
+ n1 = th->thrdno;
+ }
else if((n1 = atol(number1)) < 1L || n1 > msgmap->max_thrdno){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("\"%s\" out of thread number range"),
@@ -7775,6 +7807,14 @@ select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
end = 1;
p += strlen("end");
}
+ else if(!strucmp("$", p)){
+ end = 1;
+ p++;
+ }
+ else if(*p == '.'){
+ cur = 1;
+ p++;
+ }
else{
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("Invalid number range, missing number after \"-\": %s"),
@@ -7785,6 +7825,10 @@ select_by_thrd_number(MAILSTREAM *stream, MSGNO_S *msgmap, SEARCHSET **msgset)
if(end)
n2 = msgmap->max_thrdno;
+ else if(cur){
+ th = fetch_thread(stream, mn_m2raw(msgmap, mn_get_cur(msgmap)));
+ n2 = th->thrdno;
+ }
else if((n2 = atol(number2)) < 1L || n2 > msgmap->max_thrdno){
q_status_message1(SM_ORDER | SM_DING, 0, 2,
_("\"%s\" out of thread number range"),
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 9629ef6e..4af43ec8 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -338,6 +338,9 @@ Additions include:
<LI> When messages are selected, warn the user if a message that is not
selected will be bounced, or if not all selected messages will be
bounced. Suggested by Ulf-Dietrich Braumann.
+
+ <LI> When selecting messages by number, the &quot;.&quot; character can
+ be used to specify the message on which the cursor is on.
</UL>
@@ -373,9 +376,6 @@ Bugs that have been addressed include:
of the certificate to lowercase, which may make Alpine not be able
to read such certificate. Reported by Dennis Davis.
- <LI> Unix Alpine: First time users would not get their .pinerc file
- created when starting Alpine.
-
<LI> Work in progress: Avoid calling non-safe functions when Alpine
receives a signal. See bug report
<A HREF="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825772">here.</A>
@@ -36523,11 +36523,11 @@ message, or ^C to cancel.
Enter the name of the Unix command to which you wish to send this
attachment, or ^C to cancel.
========== h_select_by_num ==========
-Enter a list of message numbers (or number ranges), or ^C to cancel. The word
-"end" represents the last message. Example: 2-5,7-9,11,19,35-end
+Enter a list of message numbers (or number ranges), or ^C to cancel. "end"
+is the last message. "." is the current message. Example: 1-.,7-9,11,19,35-end
========== h_select_by_thrdnum ==========
-Enter a list of thread numbers (or number ranges), or ^C to cancel. The word
-"end" represents the last thread. Example: 2-5,7-9,11,19,35-end
+Enter a list of message numbers (or number ranges), or ^C to cancel. "end"
+is the last message. "." is the current message. Example: 1-.,7-9,11,19,35-end
========== h_select_txt_from ==========
Messages with From: headers containing the entered string will be selected.
^C to cancel. ^G again to see original options.