diff -rc pine4.52/build pine4.52.I.USE/build *** pine4.52/build Mon Dec 9 09:54:38 2002 --- pine4.52.I.USE/build Tue Jan 14 13:13:37 2003 *************** *** 146,151 **** --- 146,200 ---- done + if [ ! -r pine/rules.c ] || [ ! -r pine/rules.h ]; then + echo "####################################################################" + echo "" + echo " In order to compile this new version of Pine you" + echo " need two more files, \"pine/rules.c\" and \"pine/rules.h\"" + echo "" + echo " Pressing \"y\" and will download those files " + echo " automatically, now. Press \"N\" or ^C to cancel " + echo "" + echo "####################################################################" + echo "" + echo "If you want we can download them now ([y]/n): " + readchar=`dd if=/dev/tty bs=0 count=1 2>/dev/null` + if [ "$readchar" = "n" ] || [ "$readchar" = "N" ]; then + echo "Ok, we can't compile Pine now. Please remember to do it later" + exit + else + echo Downloading rules.c, wait..... + echo "lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.c.gz > pine/rules.c" + lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.c.gz > pine/rules.c + if [ -s pine/rules.c ]; then + echo File rules.c successfully downloaded + else + echo Hmm something went wrong, we could not download the file + echo Exiting... + exit + fi + echo Downloading rules.h, wait... + echo "lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.h.gz > pine/rules.h" + lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.h.gz > pine/rules.h + if [ -s pine/rules.h ]; then + echo File rules.h successfully downloaded + else + echo Hmm something went wrong, we could not download the file + echo Exiting... + exit + fi + TYPE1=`file pine/rules.c | awk '{printf $2}'` + TYPE2=`file pine/rules.h | awk '{printf $2}'` + if [ "$TYPE1" = "gzip" ]; then + gunzip pine/rules.c.gz + fi + if [ "$TYPE2" = "gzip" ]; then + gunzip pine/rules.h.gz + fi + echo "Done!" + fi + fi + if [ $# -ne 0 ] then case $maketarg in diff -rc pine4.52/buildcyg pine4.52.I.USE/buildcyg *** pine4.52/buildcyg Mon Dec 9 09:54:38 2002 --- pine4.52.I.USE/buildcyg Tue Jan 14 13:13:37 2003 *************** *** 147,152 **** --- 147,204 ---- esac done + if [ ! -r pine/rules.c ] || [ ! -r pine/rules.h ]; then + echo "####################################################################" + echo "" + echo " In order to compile this new version of Pine you" + echo " need two more files, \"pine/rules.c\" and \"pine/rules.h\"" + echo "" + echo " Pressing \"y\" and will download those files " + echo " automatically, now. Press \"N\" or ^C to cancel " + echo "" + echo "####################################################################" + echo "" + echo "If you want we can download them now ([y]/n): " + readchar=`dd if=/dev/tty bs=0 count=1 2>/dev/null` + if [ "$readchar" = "n" ] || [ "$readchar" = "N" ]; then + echo "Ok, we can't compile Pine now. Please remember to do it later" + exit + else + echo Downloading rules.c, wait..... + echo "lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.c.gz > pine/rules.c" + lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.c.gz > pine/rules.c + if [ -s pine/rules.c ]; then + echo File rules.c successfully downloaded + else + echo Hmm something went wrong, we could not download the file + echo Exiting... + exit + fi + echo Downloading rules.h, wait... + echo "lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.h.gz > pine/rules.h" + lynx -dump -width=1000 http://www.math.washington.edu/~chappa/pine/patches/pine4.44/rules.h.gz > pine/rules.h + if [ -s pine/rules.h ]; then + echo File rules.h successfully downloaded + else + echo Hmm something went wrong, we could not download the file + echo Exiting... + exit + fi + TYPE1=`file pine/rules.c | awk '{printf $2}'` + TYPE2=`file pine/rules.h | awk '{printf $2}'` + if [ "$TYPE1" = "gzip" ]; then + gunzip pine/rules.c.gz + fi + if [ "$TYPE2" = "gzip" ]; then + gunzip pine/rules.h.gz + fi + echo "Done!" + fi + fi + + + + if [ $# -ne 0 ] then diff -rc pine4.52/pico/basic.c pine4.52.I.USE/pico/basic.c *** pine4.52/pico/basic.c Mon Dec 2 22:31:46 2002 --- pine4.52.I.USE/pico/basic.c Tue Jan 14 13:13:38 2003 *************** *** 326,340 **** return(TRUE); } /* ! * go forword to the end of the current paragraph * here we look for a or or * combination to delimit the begining of a paragraph */ gotoeop(f, n) int f, n; /* default Flag & Numeric argument */ - { int quoted, qlen; char qstr[NLINE], qstr2[NLINE]; --- 326,522 ---- return(TRUE); } + GetAccent() + { + char c,d; + c = (char) GetKey(); + if ((c == '?') || (c == '!')) { + d = c; + c = '\\'; + } + else + if ((c == 's') || (c == 'S')){ + c = d = 's'; + } + else + if ((c == 'l') || (c == 'L')){ + c = d = 'l'; + } + else + d = (char) GetKey(); + return (int) accent(c,d); + } + pineaccent(f,n) + int f,n; + { int e; + + if (e = GetAccent()) + execute(e,0,1); + return 1; + } + + unsigned char accent(f,n) + int f,n; + { char c,d; + + c = (char) f; + d = (char) n; + switch(c){ + case '~' : + switch(d){ + case 'a' : return '\343'; + case 'n' : return '\361'; + case 'o' : return '\365'; + case 'A' : return '\303'; + case 'N' : return '\321'; + case 'O' : return '\325'; + } + break; + case '\047' : + switch(d){ + case 'a' : return '\341'; + case 'e' : return '\351'; + case 'i' : return '\355'; + case 'o' : return '\363'; + case 'u' : return '\372'; + case 'y' : return '\375'; + case 'A' : return '\301'; + case 'E' : return '\311'; + case 'I' : return '\315'; + case 'O' : return '\323'; + case 'U' : return '\332'; + case 'Y' : return '\335'; + } + break; + case '"' : + switch(d){ + case 'a' : return '\344'; + case 'e' : return '\353'; + case 'i' : return '\357'; + case 'o' : return '\366'; + case 'u' : return '\374'; + case 'y' : return '\377'; + case 'A' : return '\304'; + case 'E' : return '\313'; + case 'I' : return '\317'; + case 'O' : return '\326'; + case 'U' : return '\334'; + } + break; + case '^' : + switch(d){ + case 'a' : return '\342'; + case 'e' : return '\352'; + case 'i' : return '\356'; + case 'o' : return '\364'; + case 'u' : return '\373'; + case 'A' : return '\302'; + case 'E' : return '\312'; + case 'I' : return '\316'; + case 'O' : return '\324'; + case 'U' : return '\333'; + case '0' : return '\260'; + case '1' : return '\271'; + case '2' : return '\262'; + case '3' : return '\263'; + } + break; + case '`' : + switch(d){ + case 'a' : return '\340'; + case 'e' : return '\350'; + case 'i' : return '\354'; + case 'o' : return '\362'; + case 'u' : return '\371'; + case 'A' : return '\300'; + case 'E' : return '\310'; + case 'I' : return '\314'; + case 'O' : return '\322'; + case 'U' : return '\331'; + } + break; + case 'o' : + switch(d){ + case 'a' : return '\345'; + case 'A' : return '\305'; + case '/' : return '\370'; + case 'r' : return '\256'; + case 'R' : return '\256'; + case 'c' : return '\251'; + case 'C' : return '\251'; + } + break; + case '-' : + switch(d){ + case 'o' : return '\272'; + case 'O' : return '\272'; + case '0' : return '\272'; + case 'a' : return '\252'; + case 'A' : return '\252'; + case 'l' : return '\243'; + case 'L' : return '\243'; + } + break; + case 'O' : + switch(d){ + case '/' : return '\330'; + case 'r' : return '\256'; + case 'R' : return '\256'; + case 'c' : return '\251'; + case 'C' : return '\251'; + } + case '/' : + switch(d){ + case 'o' : return '\370'; + case 'O' : return '\330'; + } + break; + case 'a' : + switch(d){ + case 'e' : return '\346'; + case 'E' : return '\346'; + } + break; + case 'A' : + switch(d){ + case 'E' : return '\306'; + case 'e' : return '\306'; + } + break; + case ',' : + switch(d){ + case 'c' : return '\347'; + case 'C' : return '\307'; + } + break; + case '\\' : + switch(d){ + case '?' : return '\277'; + case '!' : return '\241'; + } + break; + case 's' : + switch(d){ + case 's' : return '\337'; + } + break; + case 'l' : + switch(d){ + case 'l' : return '\243'; + } + break; + } + return '\0'; + } + /* ! * go forward to the end of the current paragraph * here we look for a or or * combination to delimit the begining of a paragraph */ gotoeop(f, n) int f, n; /* default Flag & Numeric argument */ { int quoted, qlen; char qstr[NLINE], qstr2[NLINE]; diff -rc pine4.52/pico/composer.c pine4.52.I.USE/pico/composer.c *** pine4.52/pico/composer.c Mon Dec 2 22:31:48 2002 --- pine4.52.I.USE/pico/composer.c Tue Jan 14 13:13:38 2003 *************** *** 1615,1621 **** } if(VALID_KEY(ch)){ /* char input */ ! /* * if we are allowing editing, insert the new char * end up leaving tbufp pointing to newly * inserted character in string, and offset to the --- 1615,1621 ---- } if(VALID_KEY(ch)){ /* char input */ ! insert_char:/* * if we are allowing editing, insert the new char * end up leaving tbufp pointing to newly * inserted character in string, and offset to the *************** *** 1699,1704 **** --- 1699,1711 ---- } else { /* interpret ch as a command */ switch (ch = normalize_cmd(ch, ckm, 2)) { + case (CTRL|'\\') : + if (ch = GetAccent()) + goto insert_char; + else + clearcursor(); + break; + case (CTRL|'@') : /* word skip */ while(strng[ods.p_off] && isalnum((unsigned char)strng[ods.p_off])) diff -rc pine4.52/pico/display.c pine4.52.I.USE/pico/display.c *** pine4.52/pico/display.c Tue Dec 3 17:15:20 2002 --- pine4.52.I.USE/pico/display.c Tue Jan 14 13:13:38 2003 *************** *** 1454,1459 **** --- 1454,1472 ---- b++; continue; + case (CTRL|'N'): /* Insert pattern */ + if (pat[0] != '\0'){ + strcat(buf,pat); + pputs(pat,1); + b += strlen(pat); + changed = TRUE; + } + else + (*term.t_beep)(); + continue; + + + case (CTRL|'G') : /* CTRL-G help */ if(term.t_mrow == 0 && km_popped == 0){ movecursor(term.t_nrow-2, 0); *************** *** 1509,1514 **** --- 1522,1532 ---- b--; continue; + case (CTRL|'\\'): + if (c = GetAccent()) + goto text; + continue; + case KEY_RIGHT: if(*b != '\0') b++; *************** *** 1560,1565 **** --- 1578,1584 ---- #endif default : + text: if(strlen(buf) >= maxl){ /* contain the text */ (*term.t_beep)(); continue; diff -rc pine4.52/pico/ebind.h pine4.52.I.USE/pico/ebind.h *** pine4.52/pico/ebind.h Tue Dec 3 17:15:20 2002 --- pine4.52.I.USE/pico/ebind.h Tue Jan 14 13:13:38 2003 *************** *** 105,111 **** {CTRL|'^', setmark}, {CTRL|'_', alt_editor}, {0x7F, backdel}, ! {0, NULL} }; --- 105,113 ---- {CTRL|'^', setmark}, {CTRL|'_', alt_editor}, {0x7F, backdel}, ! {CTRL|'\\', pineaccent}, ! {0, ! NULL} }; diff -rc pine4.52/pico/efunc.h pine4.52.I.USE/pico/efunc.h *** pine4.52/pico/efunc.h Tue Dec 3 17:15:20 2002 --- pine4.52.I.USE/pico/efunc.h Tue Jan 14 13:26:07 2003 *************** *** 73,78 **** --- 73,81 ---- extern int setimark PROTO((int, int)); extern int swapimark PROTO((int, int)); extern int mousepress PROTO((int, int)); + extern unsigned char accent PROTO((int, int)); + extern int pineaccent PROTO((int, int)); + extern int GetAccent PROTO((void)); /* bind.c */ extern int whelp PROTO((int, int)); *************** *** 337,341 **** --- 340,348 ---- extern int fillpara PROTO((int, int)); extern int inword PROTO((void)); extern int quote_match PROTO((char *, LINE *, char *, int)); + extern char *flatten_qstring PROTO((QSTRING_S *, char *, int *, int)); + extern void free_qs PROTO((QSTRING_S **)); + extern QSTRING_S *do_quote_match PROTO((char *, int[], int[], int[])); + extern QSTRING_S *copy_qs PROTO((QSTRING_S *)); #endif /* EFUNC_H */ diff -rc pine4.52/pico/main.c pine4.52.I.USE/pico/main.c *** pine4.52/pico/main.c Mon Dec 2 22:31:52 2002 --- pine4.52.I.USE/pico/main.c Tue Jan 14 13:13:38 2003 *************** *** 142,147 **** --- 142,148 ---- int starton = 0; /* where's dot to begin with? */ char bname[NBUFN]; /* buffer name of file to read */ char *file_to_edit = NULL; + int line_information_on = FALSE; timeo = 600; Pmaster = NULL; /* turn OFF composer functionality */ *************** *** 295,300 **** --- 296,307 ---- emlwrite("You may possibly have new mail.", NULL); } + if (c == (CTRL|'\\')){ + c = GetAccent(); + if (!c) + c = NODATA; + } + if(km_popped) switch(c){ case NODATA: *************** *** 316,323 **** mlerase(); } ! f = FALSE; n = 1; #ifdef MOUSE clear_mfunc(mouse_in_content); --- 323,342 ---- mlerase(); } ! f = (c == (CTRL|'J')); n = 1; + if (!line_information_on) + line_information_on = (c == (CTRL|'C')); + else + line_information_on = ((c == KEY_DOWN) || (c == KEY_UP) || + (c == KEY_RIGHT) || (c == KEY_LEFT) || + (c == (CTRL|'V')) || (c == (CTRL|'Y')) || + (c == (CTRL|'K')) || (c == (CTRL|'D')) || + (c == (CTRL|'F')) || (c == (CTRL|'B')) || + (c == (CTRL|'N')) || (c == (CTRL|'P')) || + (c == (CTRL|'A')) || (c == (CTRL|'E')) || + (c == (CTRL|'U')) || (c == (CTRL|'^'))) + && (c != (CTRL|'C')); #ifdef MOUSE clear_mfunc(mouse_in_content); *************** *** 324,329 **** --- 343,352 ---- #endif /* Do it. */ execute(normalize_cmd(c, fkm, 1), f, n); + if (line_information_on){ + c = (CTRL|'C'); + execute(normalize_cmd(c, fkm, 1), f, n); + } } } diff -rc pine4.52/pico/pico.c pine4.52.I.USE/pico/pico.c *** pine4.52/pico/pico.c Wed Dec 11 23:15:20 2002 --- pine4.52.I.USE/pico/pico.c Tue Jan 14 13:13:38 2003 *************** *** 138,143 **** --- 138,153 ---- pico_all_done = 0; km_popped = 0; + if (pm->auto_cmds){ + int i = 0; + #define CTRL_X 24 + while (pm->auto_cmds[i]) + i++; + if ((i > 1) && (pm->auto_cmds[i - 2] == CTRL_X) && + (pm->auto_cmds[i - 1] == 'y')) + return (1); + } + if(!vtinit()) /* Init Displays. */ return(COMP_CANCEL); diff -rc pine4.52/pico/pico.h pine4.52.I.USE/pico/pico.h *** pine4.52/pico/pico.h Fri Dec 6 14:03:20 2002 --- pine4.52.I.USE/pico/pico.h Tue Jan 14 13:26:07 2003 *************** *** 215,220 **** --- 215,221 ---- void (*resize)(); /* callback handling screen resize */ void (*winch_cleanup)(); /* callback handling screen resize */ int arm_winch_cleanup; /* do the winch_cleanup if resized */ + int *auto_cmds; /* Initial keystroke commands */ HELP_T search_help; HELP_T ins_help; HELP_T ins_m_help; *************** *** 337,342 **** --- 338,359 ---- struct KBSTREE *down; struct KBSTREE *left; } KBESC_T; + + /* + * struct that will help us determine what the quote string of a line + * is. The "next" field indicates the presence of a possible continuation. + * The idea is that if a continuation fails, we free it and check for the + * remaining structure left + */ + + typedef enum {qsNormal, qsString, qsChar} QStrType; + + typedef struct QSTRING { + char *value; /* possible quote string */ + QStrType qstype; /* type of quote string */ + struct QSTRING *next; /* possible continuation */ + } QSTRING_S; + /* * Protos for functions used to manage keyboard escape sequences diff -rc pine4.52/pico/random.c pine4.52.I.USE/pico/random.c *** pine4.52/pico/random.c Thu Dec 12 14:24:48 2002 --- pine4.52.I.USE/pico/random.c Tue Jan 14 13:26:08 2003 *************** *** 340,346 **** backchar(FALSE, 1); dotp = curwp->w_dotp; ! gotobop(FALSE, 1); /* then go to the top of the para */ curwp->w_doto = 0; getregion(®ion, dotp, llength(dotp)); --- 340,347 ---- backchar(FALSE, 1); dotp = curwp->w_dotp; ! swapimark(FALSE, 1); /* go back to the spot we marked before justify */ ! /* We assume that no imarks have been set between fillpara and now */ curwp->w_doto = 0; getregion(®ion, dotp, llength(dotp)); diff -rc pine4.52/pico/search.c pine4.52.I.USE/pico/search.c *** pine4.52/pico/search.c Tue Dec 3 17:15:22 2002 --- pine4.52.I.USE/pico/search.c Tue Jan 14 13:13:39 2003 *************** *** 106,112 **** pc -= 0x20; } ! return(bc == pc); } --- 106,112 ---- pc -= 0x20; } ! return(((char) bc) == ((char) pc)); } *************** *** 494,500 **** register int s; int i = 0; char tpat[NPAT+20]; ! EXTRAKEYS menu_pat[7]; menu_pat[i = 0].name = "^Y"; menu_pat[i].label = "FirstLine"; --- 494,500 ---- register int s; int i = 0; char tpat[NPAT+20]; ! EXTRAKEYS menu_pat[9]; menu_pat[i = 0].name = "^Y"; menu_pat[i].label = "FirstLine"; *************** *** 528,533 **** --- 528,539 ---- KS_OSDATASET(&menu_pat[i], KS_NONE); } + if (pat[0] != '\0'){ + menu_pat[++i].name = "^N"; + menu_pat[i].label = "InsPat"; + menu_pat[i].key = (CTRL|'N'); + KS_OSDATASET(&menu_pat[i], KS_NONE);} + menu_pat[++i].name = NULL; strcpy(tpat, prompt); /* copy prompt to output string */ *************** *** 575,589 **** { int i, n; char tpat[NPAT+20]; ! EXTRAKEYS menu_pat[2]; menu_pat[i = 0].name = "^T"; menu_pat[i].label = "No Line Number"; menu_pat[i].key = (CTRL|'T'); ! KS_OSDATASET(&menu_pat[i++], KS_NONE); ! menu_pat[i].name = NULL; tpat[0] = '\0'; while(1) switch(mlreplyd(prompt, tpat, NPAT, QNORML, menu_pat)){ --- 581,601 ---- { int i, n; char tpat[NPAT+20]; ! EXTRAKEYS menu_pat[3]; menu_pat[i = 0].name = "^T"; menu_pat[i].label = "No Line Number"; menu_pat[i].key = (CTRL|'T'); ! KS_OSDATASET(&menu_pat[i], KS_NONE); ! if (pat[0] != '\0'){ ! menu_pat[++i].name = "^N"; ! menu_pat[i].label = "InsPat"; ! menu_pat[i].key = (CTRL|'N'); ! KS_OSDATASET(&menu_pat[i], KS_NONE);} + menu_pat[++i].name = NULL; + tpat[0] = '\0'; while(1) switch(mlreplyd(prompt, tpat, NPAT, QNORML, menu_pat)){ *************** *** 805,814 **** int maxlength; /* maximum chars in destination */ { ! char c; /* current char to translate */ /* scan through the string */ ! while ((c = *srcstr++) != 0) { if (c == '\n') { /* its an EOL */ *deststr++ = '<'; *deststr++ = 'N'; --- 817,826 ---- int maxlength; /* maximum chars in destination */ { ! unsigned char c; /* current char to translate */ /* scan through the string */ ! while ((c = (unsigned char) *srcstr++) != 0) { if (c == '\n') { /* its an EOL */ *deststr++ = '<'; *deststr++ = 'N'; diff -rc pine4.52/pico/word.c pine4.52.I.USE/pico/word.c *** pine4.52/pico/word.c Thu Dec 12 14:22:48 2002 --- pine4.52.I.USE/pico/word.c Tue Jan 14 13:26:08 2003 *************** *** 360,451 **** && isalnum((unsigned char)lgetc(curwp->w_dotp, curwp->w_doto).c)); } ! /* ! * Try to determine what the quote string for given line l is, ! * and put it into buf. * ! * Returns: 1 or the total number of indentations */ ! quote_match_work(q, l, buf, buflen) ! char *q; ! LINE *l; ! char *buf; ! int buflen; { ! register int i, n = 1, j, qb; ! int qstart, qend, k; ! /* ! * The method for determining the quote string is: ! * 1) strip leading and trailing whitespace from q ! * 2) add all leading whitespace to buf ! * 3) check for q ! * 4) if q, append q to buf and any trailing whitespace ! * 5) repeat steps 3 and 4 as necessary ! * ! * q in the future could be made to be an array of (char *)'s ! * (">" and whatever the user's quote_string is) ! */ ! /* count leading whitespace as part of the quote */ ! *buf = '\0'; ! for(j = 0; ! (j <= llength(l)) ! && ((unsigned char) lgetc(l, j).c == ' ') ! && j+1 < buflen; j++){ ! buf[j] = lgetc(l, j).c; ! n = 1; } - buf[j] = '\0'; - if(*q == '\0') - return(1); ! /* pare down q so it contains no leading or trailing whitespace */ ! qstart = 0; ! for(i = 0; (unsigned char)q[i] == ' '; i++) ! qstart = i + 1; ! qend = strlen(q); ! for(i = strlen(q); i > 0 && ((unsigned char)q[i-1] == ' '); i--) ! qend = i - 1; ! if(qend <= qstart) ! return(1); ! while(j <= llength(l)){ ! for(i = qstart; (j <= llength(l)) && i < qend; i++, j++) ! if(q[i] != lgetc(l, j).c) ! return(n); ! n++; ! if(i >= qend){ ! if(strlen(buf) + qend - qstart < (buflen - 1)) ! strncat(buf, q + qstart, qend - qstart); } /* ! * if we're this far along, we've matched a quote string, ! * and should now remove the following white space. */ ! for(k = strlen(buf); ! (j <= llength(l)) ! && ((unsigned char)lgetc(l,j).c == ' ') ! && (k + 1 < buflen); ! j++, k++){ ! buf[k] = lgetc(l,j).c; } ! buf[k] = '\0'; ! if(j > llength(l)) ! return(n); ! } ! return(n); /* never reached */ } /* ! * Return number of quotes if whatever starts the line matches the quote string ! * ! * The quote string returned in buf is now more lenient in what it returns, and now ! * handles leading white space and any numbers of q indentations. */ quote_match(q, l, buf, buflen) char *q; --- 360,1086 ---- && isalnum((unsigned char)lgetc(curwp->w_dotp, curwp->w_doto).c)); } ! #define is_cquote(c) ((c) == '>' || (c) == RPAREN || \ ! (c) == '|' || (c) == ']' || (c) == ':') ! #define is_cword(c) ((((c) >= 'a') && ((c) <= 'z')) || \ ! (((c) >= 'A') && ((c) <= 'Z')) || \ ! (((c) >= '0') && ((c) <= '9')) || \ ! ((c) == ' ') || ((c) == '?') || \ ! ((c) == '@') || ((c) == '.') || \ ! ((c) == '!') || ((c) == '\'') || \ ! ((c) == ',') || ((c) == '\"') ? 1 : 0) ! #define isaquote(c) ((c) == '\"' || (c) == '\'') ! #define is_cletter(c) (((c) >= 'a') && ((c) <= 'z')) ||\ ! (((c) >= 'A') && ((c) <= 'Z')) ! #define is_cnumber(c) ((c) >= '0' && (c) <= '9') ! #define allwd_after_word(c) (((c) == ' ') || ((c) == '>') || is_cletter(c)) ! #define before(word,i) (((i) > 0) ? (word)[(i) - 1] : 0) ! #define next(w,i) ((((w)[(i)]) != 0) ? ((w)[(i) + 1]) : 0) ! #define now(word,i) (word[(i)]) ! #define is_colon(c) (((c) == ':') ? 1 : 0) ! #define is_rarrow(c) (((c) == '>') ? 1 : 0) ! #define is_tilde(c) (((c) == '~') ? 1 : 0) ! #define is_dash(c) (((c) == '-') ? 1 : 0) ! #define is_pound(c) (((c) == '#') ? 1 : 0) ! #define is_space(c) (((c) == ' ') ? 1 : 0) ! #define is_allowed(c) (is_cquote(c) || is_cword(c) || is_dash(c) || \ ! is_pound(c)) ! ! /* Internal justification functions */ ! ! QSTRING_S *is_quote PROTO((char *, int[])); ! QSTRING_S *copy_qs PROTO((QSTRING_S *)); ! QSTRING_S *qs_normal_part PROTO((QSTRING_S *)); ! QSTRING_S *qs_remove_trailing_spaces PROTO((QSTRING_S *)); ! QSTRING_S *trim_qs_from_cl PROTO((QSTRING_S *, QSTRING_S *, QSTRING_S *)); ! QSTRING_S *fix_qstring PROTO((QSTRING_S *, QSTRING_S *, QSTRING_S *)); ! QSTRING_S *qs_add PROTO((char *, int[], QStrType, int, int, int, int)); ! int qstring_is_normal PROTO((QSTRING_S *)); ! int value_is_space PROTO((char *)); ! int strcmp_qs PROTO((char *, char *)); ! int count_levels_qstring PROTO((QSTRING_S *)); ! int same_qstring PROTO((QSTRING_S *, QSTRING_S *, int *)); ! int advance_indent_string PROTO((char *, int [], int)); ! int strlenis PROTO((char *)); ! char *flatten_qstring PROTO((QSTRING_S *, char *, int *, int)); ! ! /* ! * This function creates a qstring pointer with the information that ! * is_quote handles to it. ! * Parameters: ! * qs - User supplied quote string ! * word - The line of text that the user is trying to read/justify ! * beginw - Where we need to start copying from ! * endw - Where we end copying ! * offset - Any offset in endw that we need to account for ! * typeqs - type of the string to be created ! * neednext - boolean, indicating if we need to compute the next field ! * of leave it NULL * ! * It is a mistake to call this function if beginw >= endw + offset. ! * Please note the equality sign in the above inequality (this is because ! * we always assume that qstring->value != ""). */ ! ! QSTRING_S * ! qs_add(qs, word, typeqs, beginw, endw, offset, neednext) ! char *qs; ! int word[NSTRING]; ! QStrType typeqs; ! int beginw; ! int endw; ! int offset; ! int neednext; { ! QSTRING_S *qstring, *nextqs = (QSTRING_S *) NULL; ! int i; ! qstring = (QSTRING_S *) malloc (sizeof(QSTRING_S)); ! memset (qstring, 0, sizeof(QSTRING_S)); ! qstring->qstype = qsNormal; ! if (beginw == 0){ ! beginw = endw + offset; ! qstring->qstype = typeqs; } ! if (neednext) ! nextqs = is_quote(qs, word+beginw); ! qstring->value = (char *) malloc((beginw+1)*sizeof(char)); ! for (i = 0; (i < beginw) && (qstring->value[i] = word[i]); i++); ! qstring->value[i] = '\0'; ! qstring->next = nextqs; ! ! return qstring; ! } ! ! ! int ! qstring_is_normal(cl) ! QSTRING_S *cl; ! { ! while (cl && (cl->qstype == qsNormal)) ! cl = cl->next; ! ! return cl ? 0 : 1; ! } ! ! void ! free_qs(cl) ! QSTRING_S **cl; ! { ! if (!(*cl)) ! return; ! ! if ((*cl)->next) ! free_qs(&((*cl)->next)); ! ! (*cl)->next = (QSTRING_S *) NULL; ! ! if ((*cl)->value) ! free((void *)(*cl)->value); ! ! (*cl)->value = (char *) NULL; ! ! free((void *)(*cl)); ! *cl = (QSTRING_S *) NULL; ! } ! ! QSTRING_S * ! copy_qs(cl) ! QSTRING_S *cl; ! { ! QSTRING_S *qs; ! ! if (!cl) ! return (QSTRING_S *)NULL; ! ! qs = (QSTRING_S *) malloc (sizeof(QSTRING_S)); ! memset (qs, 0, sizeof(QSTRING_S)); ! ! qs->value = (char *) malloc ((strlen(cl->value)+1)*sizeof(char)); ! strcpy(qs->value, cl->value); ! qs->qstype = cl->qstype; ! qs->next = copy_qs(cl->next); ! return qs; ! } ! ! /* ! * Given a quote string, this function returns the part that is the leading ! * normal part of it. (the normal part is the part that is tagged qsNormal, ! * that is to say, the one that is not controversial at all (like qsString ! * for example). ! */ ! ! QSTRING_S * ! qs_normal_part(cl) ! QSTRING_S *cl; ! { ! ! if (!cl) /* nothing in, nothing out */ ! return cl; ! ! if (cl->qstype != qsNormal) ! free_qs(&cl); ! ! if (cl) ! cl->next = qs_normal_part(cl->next); ! ! return cl; ! } ! ! int ! value_is_space(value) ! char *value; ! { ! for (; value && *value && isspace(*value); value++); ! ! return value && *value ? 0 : 1; ! } ! ! /* ! * this function removes trailing spaces from a quote string, but leaves the ! * last one if there are trailing spaces ! */ ! ! QSTRING_S * ! qs_remove_trailing_spaces(cl) ! QSTRING_S *cl; ! { ! QSTRING_S *rl = cl; ! ! if (!cl) /* nothing in, nothing out */ ! return cl; ! ! if (cl->next) ! cl->next = qs_remove_trailing_spaces(cl->next); ! else{ ! if (value_is_space(cl->value)) ! free_qs(&cl); ! else{ ! int i, l; ! i = l = strlen(cl->value) - 1; ! while (cl->value && cl->value[i] ! && isspace((unsigned char) cl->value[i])) ! i--; ! i += (i < l) ? 2 : 1; ! cl->value[i] = '\0'; ! } ! } ! ! return cl; ! } ! ! /* ! * This function returns if two strings are the same quote string ! * the call is not symmetric. cl must preceed the line nl ! */ ! ! int ! strcmp_qs(valuecl, valuenl) ! char *valuecl; ! char *valuenl; ! { ! int same; ! ! if (!strcmp(valuecl, valuenl)) ! same = 1; ! else{ /* probably not the same, but could be spaces */ ! int j; ! for (j = 0; valuecl[j] && (valuecl[j] == valuenl[j]); j++); ! if (valuenl[j]){ ! if (value_is_space(valuenl+j) ! && value_is_space(valuecl+j) ! && strlenis(valuecl+j) >= strlenis(valuenl+j)) ! same = 1; ! else ! same = 0; ! } ! else{ ! if (value_is_space(valuecl+j)) ! same = 1; ! else ! same = 0; ! } ! } ! return same; ! } ! ! int ! count_levels_qstring(cl) ! QSTRING_S *cl; ! { ! int count = 0; ! while (cl){ ! cl = cl->next; ! count++; ! } ! ! return count; ! } ! ! ! int ! same_qstring(cl,nl, n) ! QSTRING_S *cl; ! QSTRING_S *nl; ! int *n; ! { ! int same = 1; ! ! if (cl){ ! if (nl){ ! if (cl->qstype == nl->qstype){ ! if (!strcmp(cl->value, nl->value)){ ! (*n)++; ! same = same_qstring(cl->next, nl->next, n); ! } ! else{ /* probably not the same, but could be spaces */ ! if (!cl->next){ ! if (same = strcmp_qs(cl->value, nl->value)) ! (*n)++; ! } ! else{ ! if (value_is_space(nl->value) ! && value_is_space(cl->value) ! && strlenis(cl->value) >= strlenis(nl->value)){ ! same = 1; ! (*n)++; ! } ! else ! same = 0; ! } ! } } + else + same = 0; + } /* else !nl && cl */ + else + same = *n; /* worry about this later */ + } /* else !cl */ + else + same = *n; /* worry about this later */ + return same; + } + + QSTRING_S * + trim_qs_from_cl(cl, nl, pl) + QSTRING_S *cl; + QSTRING_S *nl; + QSTRING_S *pl; + { + int p = 0, c, same; + QSTRING_S *cqstring = pl ? pl : nl; + QSTRING_S *tl = pl ? pl : nl; + + if (qstring_is_normal(tl)) + return tl; + + c = count_levels_qstring(cl); + same = same_qstring(pl ? pl : cl, pl ? cl : nl, &p); + + c = 1; + while (c < p){ + cl = cl->next; + tl = tl->next; + c++; + } + /* + * cl->next and tl->next differ, it may be because cl->next does not + * exist or tl->next does not exist or simply both exist but are + * different. In this last case, it may be that cl->next->value is made + * of spaces. If this is the case, tl advances once more. + */ + + if (tl->next){ + if (cl && cl->next && value_is_space(cl->next->value)) + tl = tl->next; + if (tl->next) + free_qs(&(tl->next)); + } + + return cqstring; + } + + + /* This function trims cl so that it returns a real quote string based + * on information gathered from the previous and next lines. pl and cl are + * also trimmed, but that is done in another function, not here. + */ + + QSTRING_S * + fix_qstring(cl, nl, pl) + QSTRING_S *cl; + QSTRING_S *nl; + QSTRING_S *pl; + { + QSTRING_S *cqstring; + QSTRING_S *nqstring; + QSTRING_S *pqstring; + int c = 0, n = 0, p = 0, rv, same; + + cqstring = cl; + nqstring = nl; + pqstring = pl; + + + if (qstring_is_normal(cl)) + return cl; + + c = count_levels_qstring(cl); + same = same_qstring(cl,nl, &n); + + if (!n){ /* no next line or no agreement with next line */ + int p = 0, samep; + QSTRING_S *tl; /* test line */ + + samep = same_qstring(pl, cl, &p); + + /* + * Here p <= c, so either p < c or p == c. If p == c, we are done, + * and return cl. If not, there are two cases, either p == 0 or + * 0 < p < c. In the first case, we do not have enough evidence + * to return anything other than the normal part of cl, in the second + * case we can only return p levels of cl. + */ + + if (p == c) + tl = cqstring; + else{ + if (p){ + c = 1; + while (c < p){ + cl = cl->next; + c++; + } + free_qs(&(cl->next)); + tl = cqstring; + } + else + tl = qs_normal_part(cl); + } + return tl; + } + + if (n + 1 < c){ /* if there are not enough agreements */ + int p = 0, samep; + QSTRING_S *tl; /* test line */ + + /* + * There's no way we can use cl in this case, but we can use + * part of cl, this is if pl does not have more agreements + * with cl. + */ + + samep = same_qstring(pl, cl, &p); + + if (p == c) + tl = cqstring; + else{ + int m = p < n ? n : p; + c = 1; + while (c < m){ + pl = pl->next; + nl = nl->next; + cl = cl->next; + c++; + } + if ((p == n) && pl && pl->next && nl && nl->next + && ((cl->next->qstype == pl->next->qstype) + || (cl->next->qstype == nl->next->qstype)) + && (strcmp_qs(cl->next->value, pl->next->value) + || strcmp_qs(pl->next->value, cl->next->value) + || strcmp_qs(cl->next->value, nl->next->value) + || strcmp_qs(nl->next->value, cl->next->value))) + cl = cl->next; /* next level differs only in spaces */ + if (cl->next) + free_qs(&(cl->next)); + tl = cqstring; + } + return tl; + } + + if (n + 1 == c){ + int p = 0, samep; + QSTRING_S *tl; /* test line */ + + samep = same_qstring(pl, cl, &p); + + /* + * p <= c, so p <= n+1, which means p < n + 1 or p == n + 1. + * If p < n + 1, then p <= n. + * so we have three possibilities: + * p == n + 1 or p == n or p < n. + * In the first case we copy p == n + 1 == c levels, in the second + * and third case we copy n levels, and check if we can copy the + * n + 1 == c level. + */ + + if (p == n + 1) /* p == c, in the above sense of c */ + tl = cl; /* use cl, this is enough evidence */ + else{ + c = 1; /* reuse c */ + while (c < n){ + cl = cl->next; + c++; + } /* ! * Here c == n, we only have one more level of cl, and at least one ! * more level of nl */ ! if (cl->next->qstype == qsNormal) ! cl = cl->next; ! if (cl->next) ! free_qs(&(cl->next)); ! tl = cqstring; ! } ! return tl; ! } ! if (n == c) /* Yeah!!! */ ! return cqstring; ! } ! ! ! /* ! * This function flattens the quote string returned to us by is_quote. A ! * crash in this function implies a bug elsewhere. ! */ ! ! char * ! flatten_qstring(qs, buff, length, start) ! QSTRING_S *qs; ! char *buff; ! int *length; ! int start; ! { ! int i = 0; ! ! if (length) ! *length = start; ! ! if (!qs){ ! buff[0] = '\0'; /* tie it off */ ! return buff; ! } ! ! for (i = 0; qs->value[i] && (buff[i] = qs->value[i]); i++); ! start += i; ! ! return flatten_qstring(qs->next, buff+i, length, start); ! ! } ! ! /* ! * Given a string, we return the position where the function thinks that ! * the quote string is over, if you are ever thinking of fixing something, ! * you got to the right place. Memory freed by caller. Experience shows ! * that it only makes sense to initialize memory when we need it, not at ! * the start of this function. ! */ ! ! QSTRING_S * ! is_quote (qs,word) ! char *qs; ! int word[NSTRING]; ! { ! int i = 0, q = -1, c, nxt, prev, fllwing, finished = 0, adv; ! int words = 0, spaces = 0, j, k; ! QSTRING_S *qstring = (QSTRING_S *) NULL; ! ! /* words : the number of consecutive words, should I only allow capital ! * letters? ! * spaces: number of consecutive spaces. ! */ ! ! if (!word || !word[0]) ! return (QSTRING_S *) NULL; ! ! ! while (!finished){ ! /* ! * Before we apply our rules, let's advance past the quote string ! * given by the user, this will avoid not recognition of the ! * user's indent string and application of the arbitrary rules ! * below. Notice that this step may bring bugs into this ! * procedure, but these bugs will only appear if the indent string ! * is really really strange and the text to be justified ! * cooperates a lot too, so in general this will not be a problem. ! * If you are concerned about this bug, simply remove the ! * following lines after this comment and before the "switch" ! * command below and use a more normal quote string!. ! */ ! if (adv = advance_indent_string(qs, word, i)){ ! i += adv; ! words = spaces = 0; } ! if (!word[i]) /* went too far? */ ! return qs_add(qs, word, qsNormal, 0, i, 0, 0); ! switch (c = now(word,i)){ ! case TAB: ! case ' ': spaces++; /* space */ ! if (words){ ! if (q >= 0){ /* space after and before a word, no quotes */ ! while ((i > 0) && is_cword(nxt = before(word,i)) ! && !isspace(nxt)) ! i--; ! finished++; ! } ! else{ /* allow "> ABC>", "|ABC >", " ABC >" */ ! if (is_cquote(next(word,i))){ ! i++; ! words = 0; ! } ! else{ ! finished++; ! i -= words; ! } ! } ! } ! else{ ! if (spaces > 1){ ! QSTRING_S *nextqs; ! ! for (; isspace(word[i]); i++); ! nextqs = is_quote(qs,word+i); ! /* ! * Merge qstring and nextqs, since this is an artificial ! * separation, unless nextqs is of different type. ! * What this means in practice is that if ! * qs->qstype == qsNormal and qs->next != NULL, then ! * qs->next->qstype != qsNormal. ! */ ! if (nextqs && (nextqs->qstype == qsNormal)) ! i += strlen(nextqs->value); ! ! qstring = qs_add(qs, word, qsNormal, 0, i, 0, 1); ! free_qs(&nextqs); ! return qstring; ! } ! else ! q = i++; ! } ! ! break; ! ! case ':': /* colon */ ! case '~': if (is_cquote(nxt = next(word,i)) || is_space(nxt) ! || is_cquote(prev = before(word,i)) ! || (is_space(prev)) || (i == 0)){ ! i++; ! spaces = 0; ! } ! else{ ! for (j = i; word[j] == c; j++); ! if (j - i > 1) ! finished++; ! else ! return qs_add(qs, word, qsChar, i, j, 0, 1); ! } ! break; ! ! case '-' : if ((is_cquote(nxt = next(word,i))) || ! (is_dash(nxt) && (is_cquote(next(word,i+1))))){ ! i++; ! spaces = 0; ! } ! else{ ! for (j = i; word[j] == c; j++); ! if (j - i > 1) ! finished++; ! else ! return qs_add(qs, word, qsChar, i, j, 0, 1); ! } ! break; ! ! case '*' : if (is_rarrow(nxt = next(word, i)) || /* stars */ ! (is_space(nxt) && is_rarrow(next(word,i+1)))){ ! i++; ! spaces = 0; ! } ! else{ ! for (j = i; word[j] == c ; j++); ! if (j - i > 1) ! finished++; ! else ! return qs_add(qs, word, qsChar, i, j, 0, 1); ! } ! break; ! ! ! case '#' : for (j = i; word[j] == '#'; j++); ! if (j - i > 1) ! finished++; ! else ! return qs_add(qs, word, qsChar, i, j, 0, 1); ! break; ! ! default: ! if (is_cquote(c)){ ! words = spaces = 0; ! i++; ! } ! else if (is_cletter(c)){ ! words++; ! for (j = i; is_cword(nxt = next(word,j)) && !is_space(nxt);j++); ! /* ! * The whole reason why we are splitting the quote ! * string is so that we will be able to accept quote ! * strings that are strange in some way. Here we got to ! * a point in which a quote string might exist, but it ! * could be strange, so we need to create a "next" field ! * for the quote string to warn us that something ! * strange is coming. We need to confirm if this is a ! * good choice later. For now we will let it pass. ! */ ! if (isaword(word,i,j)){ ! int offset; ! ! offset = is_cquote(next(word,j)) ? 2 ! : ((is_space(next(word,j)) ! && is_cquote(next(word,j+1))) ? 3 : -1); ! ! if (offset > 0) ! return qs_add(qs, word, qsString, i, j, offset, 1); ! } ! finished++; ! } ! else{ /* Chao pescao! */ ! finished++; ! if (words) ! while ((i > 0) && is_cword(nxt = before(word,i)) ! && !isspace(nxt)) i--; ! } ! break; ! ! } /* End Switch */ ! } /* End while */ ! ! if (i > 0) ! qstring = qs_add(qs, word, qsNormal, 0, i, 0, 0); ! ! return qstring; } + + int + isaword(word,i,j) + int word[NSTRING]; + int i; + int j; + { + return i <= j && is_cletter(word[i]) ? + (i < j ? isaword(word,i+1,j) : 1) : 0; + } + + /* ! * Return number of quotes if whatever starts the line matches the quote ! * string */ quote_match(q, l, buf, buflen) char *q; *************** *** 453,490 **** char *buf; int buflen; { ! int rv = 0; ! char nbuf[NLINE], pbuf[NLINE]; ! rv = quote_match_work(q, l, buf, buflen); ! /* ! * Check to see if the next line is part of the same paragraph, ! * but don't count white space as a quote if that white space ! * is just a paragraph indentation. */ ! if(lforw(l) != curbp->b_linep ! && quote_match_work(q, lforw(l), nbuf, NLINE) == rv ! && strlen(nbuf) < strlen(buf) ! && strncmp(buf, nbuf, strlen(nbuf)) == 0 ! && llength(lforw(l)) > strlen(nbuf)){ ! /* ! * If we get here, we know that the next line has the same indent string ! * that the current line, but it is padded with less spaces. This is ! * the typical situation that we find at the beginning of a paragraph. ! * We need to check, however, that this is so, by checking the previous ! * line. */ ! if((l == curbp->b_linep) ! || (rv != quote_match_work(q, lback(l), pbuf, NLINE)) ! || (strlen(pbuf) != strlen(buf)) ! || (strncmp(buf, pbuf, strlen(pbuf)))) ! strcpy(buf,nbuf); } ! return(rv); } fillpara(f, n) /* Fill the current paragraph according to the current fill column */ --- 1088,1301 ---- char *buf; int buflen; { ! int GLine[NSTRING] = {0}, NLine[NSTRING] = {0}, PLine[NSTRING] = {0}; ! int i; ! QSTRING_S *qs; ! LINE *nl = l != curbp->b_linep ? lforw(l) : NULL; ! LINE *pl = lback(l) != curbp->b_linep ? lback(l) : NULL; ! if (nl){ ! for (i = 0; (i < NSTRING) && (i NewN){ ! for (j = 0; (j < n) && (GLine[j] == NLine[j]); j++); ! clength = j; ! if (j < n){ /* see if buf and nbuf are padded with spaces and tabs */ ! for (i = clength; i < n && isspace(NLine[i]); i++); ! if (i == n){ ! for (i = clength; i < c && isspace(GLine[i]); i++); ! if (i == c) ! j = n; ! } ! } ! if (j == n){ ! for (j = clength; j < c && isspace(GLine[j]); j++); ! if (j == c){ ! ! /* ! * If we get here, it means that the current line has the same ! * quote string (visually) than the next line, but both of them ! * are padded with different amount of TABS or spaces at the end. ! * The current line (GLine) has more spaces/TABs than the next ! * line. This is the typical situation that is found at the ! * beginning of a paragraph. We need to check this, however, by ! * cheching the previous line. This avoids that we confuse ! * ourselves with being in the last line of a paragraph. */ ! ! if (p == c){ /* looks like the same quote string */ ! for (j = 0; (j < p) && (GLine[j] == PLine[j]); j++); ! if ((j != p) && NLine[n]){ /* indeed, it's the same qs */ ! free_qs(&cl); ! cl = copy_qs(nl); ! } /* else we are in the last line of a paragraph */ ! } ! else{ ! if (NLine[n]){ ! free_qs(&cl); ! cl = copy_qs(nl); ! } ! } ! } ! } } ! if (nl) free_qs(&nl); ! if (pl) free_qs(&pl); ! ! return cl; } + /* + * Given a line, an initial position, and a quote string, we advance the + * current line past the quote string, including arbitraty spaces + * contained in the line, except that it removes trailing spaces. We do + * not handle TABs, if any, contained in the quote string. At least not + * yet. + * + * Arguments: q - quote string + * l - a line to process + * i - position in the line to start processing. i = 0 is the + * begining of that line. + */ + int + advance_indent_string(q, l, i) + char *q; + int l[NSTRING]; + int i; + { + int n = 0, j = 0, is = 0, es = 0; + int k, m, p, r, adv; + char qs[NSTRING] = {'\0'}; + + if(*q == '\0') + return(0); + + for (p = strlen(q); (p > 0) && (q[p - 1] == ' '); p--, es++); + if (!p){ /* string contains only spaces */ + for (k = 0; l[i + k] == ' '; k++); + k -= k % es; + return k; + } + for (is = 0; q[is] == ' '; is++); /* count initial spaces */ + for (m = 0 ; is + m < p ; m++) + qs[m] = q[is + m]; /* qs = quote string without any space at the end */ + /* advance as many spaces as there are at the begining */ + for (k = 0; l[i + j] == ' '; k++, j++); + /* now find the visible string in the line */ + for (m = 0; qs[m] && l[i + j] == qs[m]; m++, j++); + if (qs[m]) /* no match */ + return n; /* n = 0 */ + else{ + /* + * So far we have advanced at least "is" spaces, plus the visible + * string "qs". Now we need to advance the trailing number of + * spaces "es". If we can do that, we have found the quote string. + */ + for (p = 0; l[i + j + p] == ' '; p++); + adv = advance_indent_string(q, l, i + j + ((p < es) ? p : es)); + n = ((p < es) ? 0 : es) + k + m + adv; + return n; + } + } + + /* + * This function returns the effective length in screen of the quote + * string. If the string contains a TAB character, it is added here, if + * not, the length returned is the length of the string + */ + + int + strlenis(qstr) + char *qstr; + { + int i, rv = 0; + + if (!qstr || !*qstr) + return rv; + for (i = 0; qstr[i]; i++) + rv += ((qstr[i] == TAB) ? (~rv & 0x07) + 1 : 1); + return rv; + } + fillpara(f, n) /* Fill the current paragraph according to the current fill column */ *************** *** 491,501 **** int f, n; /* deFault flag and Numeric argument */ { ! int i, j, c, qlen, word[NSTRING], same_word, spaces, word_len, line_len, line_last, qn; ! char *qstr, qstr2[NSTRING]; LINE *eopline; REGION region; if(curbp->b_mode&MDVIEW){ /* don't allow this command if */ return(rdonly()); /* we are in read only mode */ --- 1302,1313 ---- int f, n; /* deFault flag and Numeric argument */ { ! int i, j, c, qlen, word[NSTRING], same_word, qlenis, spaces, word_len, line_len, line_last, qn; ! char *qstr, qstr2[NSTRING], tbuf[NSTRING]; LINE *eopline; REGION region; + QSTRING_S *tl; if(curbp->b_mode&MDVIEW){ /* don't allow this command if */ return(rdonly()); /* we are in read only mode */ *************** *** 515,520 **** --- 1327,1333 ---- /* and back to the beginning of the paragraph */ gotobop(FALSE, 1); + setimark(FALSE, 1); /* Remember this spot in case we unjustify */ /* determine if we're justifying quoted text or not */ qstr = (glo_quote_str *************** *** 521,526 **** --- 1334,1340 ---- && quote_match(glo_quote_str, curwp->w_dotp, qstr2, NSTRING) && *qstr2) ? qstr2 : NULL; qlen = qstr ? strlen(qstr) : 0; + qlenis = qstr ? strlenis(qstr) : 0; /* let yank() know that it may be restoring a paragraph */ thisflag |= CFFILL; *************** *** 538,555 **** return(FALSE); /* Now insert it back wrapped */ ! spaces = word_len = line_len = same_word = 0; /* Beginning with leading quoting... */ if(qstr){ ! while(qstr[line_len]) linsert(1, qstr[line_len++]); ! line_last = ' '; /* no word-flush space! */ } /* ...and leading white space */ ! for(i = qlen; (c = fremove(i)) == ' ' || c == TAB; i++){ linsert(1, line_last = c); line_len += ((c == TAB) ? (~line_len & 0x07) + 1 : 1); } --- 1352,1380 ---- return(FALSE); /* Now insert it back wrapped */ ! spaces = word_len = line_len = same_word = i = 0; /* Beginning with leading quoting... */ if(qstr){ ! while((tbuf[line_len] = qstr[line_len]) == fremove(line_len)) linsert(1, qstr[line_len++]); ! /* ! * The only way that at the end of the above loop we don't have ! * line_len == qlen is that there are trailing spaces or TABS ! * which could not be accounted in the qstr in is_quote or other ! * functions before we got here. Now we enter the common part of ! * the quote string in the first line and the rest is only spaces ! * (or TABS) that need to be entered, which are left to the loop ! * following this "if" statement ! */ ! i = line_len; /* start next loop from here */ ! tbuf[line_len] = '\0'; /* closing tbuf... */ ! line_len = strlenis(tbuf); /* we demand a recount! */ line_last = ' '; /* no word-flush space! */ } /* ...and leading white space */ ! for(i; (c = fremove(i)) == ' ' || c == TAB; i++){ linsert(1, line_last = c); line_len += ((c == TAB) ? (~line_len & 0x07) + 1 : 1); } *************** *** 568,574 **** default : if(spaces){ /* flush word? */ ! if((line_len - qlen > 0) && line_len + word_len + 1 > fillcol && (line_len = fpnewline(qstr))) line_last = ' '; /* no word-flush space! */ --- 1393,1399 ---- default : if(spaces){ /* flush word? */ ! if((line_len - qlenis > 0) && line_len + word_len + 1 > fillcol && (line_len = fpnewline(qstr))) line_last = ' '; /* no word-flush space! */ *************** *** 596,602 **** if(word_len + 1 >= NSTRING){ /* Magic! Fake that we output a wrapped word */ ! if((line_len - qlen > 0) && !same_word++) line_len = fpnewline(qstr); line_len += word_len; --- 1421,1427 ---- if(word_len + 1 >= NSTRING){ /* Magic! Fake that we output a wrapped word */ ! if((line_len - qlenis > 0) && !same_word++) line_len = fpnewline(qstr); line_len += word_len; *************** *** 613,620 **** } if(word_len){ ! if((line_len - qlen > 0) && (line_len + word_len + 1 > fillcol)) ! (void) fpnewline(qstr); else if(line_len && !isspace((unsigned char) line_last)) linsert(1, ' '); --- 1438,1447 ---- } if(word_len){ ! if((line_len - qlenis > 0) && (line_len + word_len + 1 > fillcol)){ ! if (line_len && (line_len != qlenis)) ! (void) fpnewline(qstr); ! } else if(line_len && !isspace((unsigned char) line_last)) linsert(1, ' '); *************** *** 642,646 **** --- 1469,1475 ---- for(len = 0; quote && *quote; quote++, len++) linsert(1, *quote); + quote -= len; /* go back */ + len = strlenis(quote); /* and recount */ return(len); } diff -rc pine4.52/pine/adrbkcmd.c pine4.52.I.USE/pine/adrbkcmd.c *** pine4.52/pine/adrbkcmd.c Wed Dec 18 11:52:54 2002 --- pine4.52.I.USE/pine/adrbkcmd.c Tue Jan 14 13:13:39 2003 *************** *** 3847,3852 **** --- 3847,3854 ---- * won't do anything, but will cause compose_mail to think there's * already a role so that it won't try to confirm the default. */ + if (ps_global->role) + fs_give((void **)&ps_global->role); if(role) role = copy_action(role); else{ *************** *** 3854,3859 **** --- 3856,3862 ---- memset((void *)role, 0, sizeof(*role)); role->nick = cpystr("Default Role"); } + ps_global->role = cpystr(role->nick); } compose_mail(addr, fcc, role, NULL, NULL); diff -rc pine4.52/pine/args.c pine4.52.I.USE/pine/args.c *** pine4.52/pine/args.c Mon Nov 18 13:45:00 2002 --- pine4.52.I.USE/pine/args.c Tue Jan 14 13:13:40 2003 *************** *** 74,79 **** --- 74,80 ---- char args_err_non_abs_passfile[] = "argument to \"-passfile\" should be fully-qualified"; char args_err_missing_lu[] = "missing argument for option \"-create_lu\"\nUsage: pine -create_lu "; char args_err_missing_sort[] = "missing argument for option \"-sort\""; + char args_err_missing_thread_sort[] = "missing argument for option \"-threadsort\""; char args_err_missing_flag_arg[] = "missing argument for flag \"%c\""; char args_err_missing_flag_num[] = "Non numeric argument for flag \"%c\""; char args_err_missing_debug_num[] = "Non numeric argument for \"%s\""; *************** *** 117,122 **** --- 118,124 ---- " -z \t\tSuspend - allow use of ^Z suspension", " -r \t\tRestricted - can only send mail to oneself", " -sort \tSort - Specify sort order of folder:", + " -threadsort \tSort - Specify sort order of thread index screen:", "\t\t subject, arrival, date, from, size, /reverse", " -i\t\tIndex - Go directly to index, bypassing main menu", " -I Initial keystrokes to be executed", *************** *** 134,144 **** " -aux \tUse this with remote pinerc", " -P \tUse pine.conf file for default settings", " -nosplash \tDisable the PC-Pine splash screen", #ifdef PASSFILE " -passfile \tSet the password file to something other", "\t\tthan the default", #endif /* PASSFILE */ - #endif " -x \tUse configuration exceptions in .", "\t\tExceptions are used to override your default pinerc", "\t\tsettings for a particular platform, can be a local file or", --- 136,146 ---- " -aux \tUse this with remote pinerc", " -P \tUse pine.conf file for default settings", " -nosplash \tDisable the PC-Pine splash screen", + #endif #ifdef PASSFILE " -passfile \tSet the password file to something other", "\t\tthan the default", #endif /* PASSFILE */ " -x \tUse configuration exceptions in .", "\t\tExceptions are used to override your default pinerc", "\t\tsettings for a particular platform, can be a local file or", *************** *** 198,203 **** --- 200,206 ---- char *cmd_list = NULL; char *debug_str = NULL; char *sort = NULL; + char *threadsort = NULL; char *pinerc_file = NULL; char *addrbook_file = NULL; char *ab_sort_descrip = NULL; *************** *** 280,285 **** --- 283,289 ---- } else if(strcmp(*av, "nosplash") == 0) goto Loop; /* already taken care of in WinMain */ + #endif #ifdef PASSFILE else if(strcmp(*av, "passfile") == 0){ if(--ac){ *************** *** 305,311 **** goto Loop; } #endif /* PASSFILE */ - #endif else if(strcmp(*av, "create_lu") == 0){ if(ac > 2){ ac -= 2; --- 309,314 ---- *************** *** 381,386 **** --- 384,401 ---- goto Loop; } + else if(strcmp(*av, "threadsort") == 0){ + if(--ac){ + threadsort = *++av; + COM_THREAD_SORT_KEY = cpystr(threadsort); + } + else{ + display_args_err(args_err_missing_thread_sort, NULL, 1); + ++usage; + } + + goto Loop; + } else if(strcmp(*av, "url") == 0){ if(args->action == aaFolder && !args->data.folder){ args->action = aaURL; *************** *** 482,487 **** --- 497,508 ---- do_version = 1; goto Loop; } + else if(strcmp(*av, "subject") == 0){ + if(--ac){ + pine_state->subject = *++av; + } + goto Loop; + } #ifdef _WINDOWS else if(strcmp(*av, "registry") == 0){ if(--ac){ diff -rc pine4.52/pine/bldaddr.c pine4.52.I.USE/pine/bldaddr.c *** pine4.52/pine/bldaddr.c Wed Dec 18 11:52:55 2002 --- pine4.52.I.USE/pine/bldaddr.c Tue Jan 14 13:13:41 2003 *************** *** 2306,2313 **** if(as.cur >= as.how_many_personals) pab->type |= GLOBAL; ! pab->access = adrbk_access(pab); ! /* global address books are forced readonly */ if(pab->type & GLOBAL && pab->access != NoAccess) pab->access = ReadOnly; --- 2306,2319 ---- if(as.cur >= as.how_many_personals) pab->type |= GLOBAL; ! if(ps_global->mail_stream && ! ps_global->mail_stream->lock && (pab->type & REMOTE_VIA_IMAP)){ ! as.initialized = 0; ! pab->access = NoAccess; ! } ! else{ ! pab->access = adrbk_access(pab); ! } /* global address books are forced readonly */ if(pab->type & GLOBAL && pab->access != NoAccess) pab->access = ReadOnly; diff -rc pine4.52/pine/filter.c pine4.52.I.USE/pine/filter.c *** pine4.52/pine/filter.c Wed Jan 8 12:13:50 2003 --- pine4.52.I.USE/pine/filter.c Tue Jan 14 13:43:44 2003 *************** *** 204,209 **** --- 204,212 ---- error_description(errno))); if(source == TmpFileStar) (void)unlink(so->name); + if (ps_global->send_immediately){ + printf("%s : %s\n", so->name, error_description(errno)); + exit(EXIT_FAILURE);} fs_give((void **)&so->name); fs_give((void **)&so); /* so freed & set to NULL */ *************** *** 713,720 **** #define GF_FLUSH(F) ((int)(GF_IP_END(F), (*(F)->f)((F), GF_DATA), \ GF_IP_INIT(F), GF_EIB_INIT(F))) ! #define GF_PUTC(F, C) ((int)(*ip++ = (C), (ip >= eib) ? GF_FLUSH(F) : 1)) #define GF_GETC(F, C) ((op < eob) ? (((C) = *op++), 1) : GF_CH_RESET(F)) --- 716,725 ---- #define GF_FLUSH(F) ((int)(GF_IP_END(F), (*(F)->f)((F), GF_DATA), \ GF_IP_INIT(F), GF_EIB_INIT(F))) ! #define ENDOFLINE(C) ((((C) == '\012') || ((C) == '\015')) ? 1 : 0) + #define GF_PUTC(F, C) ((int)(*ip++ = (C), (ip + 80 >= eib) ? GF_FLUSH(F) : 1)) + #define GF_GETC(F, C) ((op < eob) ? (((C) = *op++), 1) : GF_CH_RESET(F)) *************** *** 1693,1698 **** --- 1698,1704 ---- GF_INIT(f, f->next); if(flg == GF_DATA){ + register unsigned char e; register unsigned char c; register int state = f->f1; *************** *** 1713,1718 **** --- 1719,1725 ---- break; case EQUAL : + e = c; if(c == '\015'){ /* "=\015" is a soft EOL */ state = CCR; break; *************** *** 1725,1733 **** } if(!isxdigit((unsigned char)c)){ /* must be hex! */ ! fs_give((void **)&(f->line)); ! gf_error("Non-hexadecimal character in QP encoding"); ! /* NO RETURN */ } if (isdigit ((unsigned char)c)) --- 1732,1743 ---- } if(!isxdigit((unsigned char)c)){ /* must be hex! */ ! GF_PUTC(f->next,c); /* be tolerant to sender errors */ ! e = '\0'; ! state = DFL; ! q_status_message(SM_ORDER, 3, 4, ! "Non-hexadecimal character in QP encoding"); ! break; } if (isdigit ((unsigned char)c)) *************** *** 1741,1749 **** case HEX : state = DFL; if(!isxdigit((unsigned char)c)){ /* must be hex! */ ! fs_give((void **)&(f->line)); ! gf_error("Non-hexadecimal character in QP encoding"); ! /* NO RETURN */ } if (isdigit((unsigned char)c)) --- 1751,1765 ---- case HEX : state = DFL; if(!isxdigit((unsigned char)c)){ /* must be hex! */ ! GF_PUTC(f->next,'='); /* be tolerant to sender errors */ ! if (e) ! GF_PUTC(f->next,e); ! e = '\0'; ! GF_PUTC(f->next,c); ! state = DFL; ! q_status_message(SM_ORDER, 3, 4, ! "Non-hexadecimal character in QP encoding"); ! break; } if (isdigit((unsigned char)c)) *************** *** 7092,7098 **** if(state){ state = 0; if(c == '\012'){ ! int done; GF_LINE_TEST_TEST(f, done); --- 7108,7119 ---- if(state){ state = 0; if(c == '\012'){ ! int done, i, j = 0; ! ! for (i = 0; op && op[i] && (i < LINE_TEST_BLOCK) && ! (i < SIZEOF_20KBUF) && (op[i] != '\015') && ! (tmp_20k_buf[i] = op[i]); i++); ! tmp_20k_buf[i] = '\0'; GF_LINE_TEST_TEST(f, done); diff -rc pine4.52/pine/folder.c pine4.52.I.USE/pine/folder.c *** pine4.52/pine/folder.c Mon Dec 16 14:56:27 2002 --- pine4.52.I.USE/pine/folder.c Tue Jan 14 13:13:42 2003 *************** *** 460,469 **** HELP_MENU, OTHER_MENU, NULL_MENU, NULL_MENU, NULL_MENU, - NULL_MENU, {"$", "Shuffle", {MC_SHUFFLE,1,{'$'}},KS_NONE}, RCOMPOSE_MENU, NULL_MENU, --- 460,469 ---- HELP_MENU, OTHER_MENU, + {"^H","ChkIncFld",{MC_FORCECHECK,1,ctrl('H')}, KS_NONE}, NULL_MENU, NULL_MENU, NULL_MENU, {"$", "Shuffle", {MC_SHUFFLE,1,{'$'}},KS_NONE}, RCOMPOSE_MENU, NULL_MENU, *************** *** 1665,1670 **** --- 1665,1671 ---- gf_io_t pc; dprint(1, (debugfile, "\n\n ---- FOLDER LISTER ----\n")); + ps->in_fld_list = 1; memset(&folder_proc_data, 0, sizeof(FPROC_S)); folder_proc_data.fs = fs; *************** *** 1785,1790 **** --- 1786,1792 ---- if(folder_proc_data.all_done) fs->context = NULL; + ps->in_fld_list = 0; return(folder_proc_data.rv); } *************** *** 2367,2374 **** "Empty folder collection. No folder to rename!"); break; - /*-------------- Delete --------------------*/ case MC_DELETE : if(!(sparms->text.handles --- 2369,2388 ---- "Empty folder collection. No folder to rename!"); break; + + /*------- Check incoming forlders -------*/ + case MC_FORCECHECK: + if (F_ON(F_ENABLE_INCOMING,ps_global) && + F_ON(F_ENABLE_INCOMING_CHECK,ps_global)){ + int nmail, omail = ps_global->number_of_folders; + nmail = new_mail_incfolder(ps_global,MC_FORCECHECK); + if ((ps_global->in_fld_list) && (nmail > omail)) + rv = 1; + } + break; + + /*-------------- Delete --------------------*/ case MC_DELETE : if(!(sparms->text.handles *************** *** 3157,3167 **** CONTEXT_S *context; { int i, n, total; n = folder_total(FOLDERS(context)); ! for(total = i = 0; i < n; i++) ! if(folder_entry(i, FOLDERS(context))->selected) total++; return(total); } --- 3171,3191 ---- CONTEXT_S *context; { int i, n, total; + FOLDER_S *f; n = folder_total(FOLDERS(context)); ! for(total = i = 0; i < n; i++){ ! f = folder_entry(i, FOLDERS(context)); ! if (context->use & CNTXT_INCMNG){ ! if(ps_global->last_message && *ps_global->last_message && ! strstr(ps_global->last_message,(char *)folder_in_list(FLDR_NAME(f)))) ! f->selected = 1; ! else ! f->selected = 0; ! } ! if(f->selected) total++; + } return(total); } *************** *** 4113,4119 **** else{ if(folders){ /*------ Actually do the subscription -----*/ STRLIST_S *flp; ! int n = 0, errors = 0; /* subscribe one at a time */ folder[0] = '\0'; --- 4137,4144 ---- else{ if(folders){ /*------ Actually do the subscription -----*/ STRLIST_S *flp; ! int n = 0, errors = 0, local_open; ! MAILSTREAM *tmp_stream; /* subscribe one at a time */ folder[0] = '\0'; *************** *** 4120,4126 **** for(flp = folders; flp; flp = flp->next){ (void) context_apply(tmp_20k_buf, &subscribe_cntxt, (char *) flp->name, SIZEOF_20KBUF); ! if(mail_subscribe(NULL, tmp_20k_buf) == 0L){ /* * This message may not make it to the screen, * because a c-client message about the failure --- 4145,4152 ---- for(flp = folders; flp; flp = flp->next){ (void) context_apply(tmp_20k_buf, &subscribe_cntxt, (char *) flp->name, SIZEOF_20KBUF); ! tmp_stream = mail_cmd_stream(cntxt, &local_open); ! if(mail_subscribe(tmp_stream, tmp_20k_buf) == 0L){ /* * This message may not make it to the screen, * because a c-client message about the failure *************** *** 4152,4157 **** --- 4178,4184 ---- FOLDERS(cntxt)); } } + mail_free_cache(tmp_stream); } if(n == 0) *************** *** 4168,4176 **** free_strlist(&folders); } else{ (void) context_apply(tmp_20k_buf, &subscribe_cntxt, folder, SIZEOF_20KBUF); ! if(mail_subscribe(NULL, tmp_20k_buf) == 0L){ q_status_message1(SM_ORDER | SM_DING, 3, 3, "Error subscribing to \"%.200s\"", folder); } --- 4195,4206 ---- free_strlist(&folders); } else{ + int local_open; + MAILSTREAM *tmp_stream; (void) context_apply(tmp_20k_buf, &subscribe_cntxt, folder, SIZEOF_20KBUF); ! tmp_stream = mail_cmd_stream(cntxt, &local_open); ! if(mail_subscribe(tmp_stream, tmp_20k_buf) == 0L){ q_status_message1(SM_ORDER | SM_DING, 3, 3, "Error subscribing to \"%.200s\"", folder); } *************** *** 4183,4188 **** --- 4213,4219 ---- folder_insert(-1, new_folder(folder, 0), FOLDERS(cntxt)); } + mail_free_cache(tmp_stream); } if(folder[0]) *************** *** 4486,4496 **** { char *folder, ques_buf[MAX_SCREEN_COLS+1], *fnamep, fname[MAILTMPLEN]; ! MAILSTREAM *del_stream; FOLDER_S *fp; EditWhich ew; PINERC_S *prc = NULL; ! int ret, close_opened = 0, blast_folder = 1, readonly; if(NEWS_TEST(context)){ static char fmt[] = "Really unsubscribe from \"%.*s\""; --- 4517,4527 ---- { char *folder, ques_buf[MAX_SCREEN_COLS+1], *fnamep, fname[MAILTMPLEN]; ! MAILSTREAM *del_stream, *tmp_stream; FOLDER_S *fp; EditWhich ew; PINERC_S *prc = NULL; ! int ret, close_opened = 0, blast_folder = 1, readonly, local_open; if(NEWS_TEST(context)){ static char fmt[] = "Really unsubscribe from \"%.*s\""; *************** *** 4512,4523 **** dprint(2, (debugfile, "deleting folder \"%s\" in context \"%s\"\n", folder, context->context)); (void) context_apply(tmp_20k_buf, context, folder, SIZEOF_20KBUF); ! if(!mail_unsubscribe(NULL, tmp_20k_buf)){ q_status_message1(SM_ORDER | SM_DING, 3, 3, "Error unsubscribing from \"%.200s\"", folder); return(0); } /* * Fix up the displayed list --- 4543,4556 ---- dprint(2, (debugfile, "deleting folder \"%s\" in context \"%s\"\n", folder, context->context)); + tmp_stream = mail_cmd_stream(context, &local_open); (void) context_apply(tmp_20k_buf, context, folder, SIZEOF_20KBUF); ! if(!mail_unsubscribe(tmp_stream, tmp_20k_buf)){ q_status_message1(SM_ORDER | SM_DING, 3, 3, "Error unsubscribing from \"%.200s\"", folder); return(0); } + mail_free_cache(tmp_stream); /* * Fix up the displayed list *************** *** 5891,5897 **** --- 5924,6007 ---- #endif } + /* Create .newsrc-server type filenames if any are needed */ + void + init_newsrc(ps) + struct pine *ps; + { + CONTEXT_S *cntxt = ps_global->context_list; + while (1){ + if (cntxt->prev) + cntxt = cntxt->prev; + else + break; + } + + while (1){ + if (NEWS_TEST(cntxt)) + init_newsrc_file(cntxt); + if (cntxt->next) + cntxt = cntxt->next; + else + break; + } + } + + void + init_newsrc_file(cntxt) + CONTEXT_S *cntxt; + { + int c = 0; + FILE *on = NULL, *nn = NULL; + char *tmp, *newsrc; + + newsrc = (char *) mail_parameters(NULL, GET_NEWSRC, NULL); + tmp = get_newsrc_name(cntxt); + if (!(nn = fopen(tmp,"r"))){ + if (nn = fopen(tmp,"wb")){ + if (on = fopen(newsrc,"r")){ + while ((c = fgetc(on))!= EOF) + fputc(c,nn); + } + } + } + fs_give((void **)&tmp); + if (nn) fclose(nn); + if (on) fclose(on); + } + + char * + get_newsrc_name(cntxt) + CONTEXT_S *cntxt; + { + int c = 0, i = 0; + char *newsrc, *tmp; + + newsrc = (char *) mail_parameters(NULL, GET_NEWSRC, NULL); + /* we used to get the name of the .newsrc file using c-clients routines + * but that turned out to be too slow if the connection to the + * server was not fast, so we do this manually here, and in a + * fast way + */ + i = cntxt && cntxt->server ? strlen(cntxt->server) : -1; + tmp = (char *) fs_get((strlen(newsrc) + i + 2)*sizeof(char)); + while (newsrc[c]){ + tmp[c] = newsrc[c]; + c++; + } + if (i > 0){ + tmp[c++] = '-'; + i = 0; + while ((cntxt->server[i] != '/') && (cntxt->server[i] != '\0')){ + tmp[c] = cntxt->server[i]; + c++;i++; + } + } + tmp[c] = '\0'; /* tie it off */ + return tmp; + } + /* * Add incoming list of folders to context. */ *************** *** 7118,7126 **** long *find_recent; int *did_cancel; { ! int index, recent = 0, failed_status = 0; char prompt[128]; FOLDER_S *f = NULL; /* note: find_folders may assign "stream" */ build_folder_list(streamp, cntxt, NULL, NULL, --- 7228,7237 ---- long *find_recent; int *did_cancel; { ! int index, recent = 0, failed_status = 0, done = 0; char prompt[128]; FOLDER_S *f = NULL; + char *test_current = cpystr(current); /* note: find_folders may assign "stream" */ build_folder_list(streamp, cntxt, NULL, NULL, *************** *** 7129,7135 **** if(find_recent) *find_recent = 0L; ! for(index = folder_index(current, cntxt, FI_FOLDER) + 1; index > 0 && index < folder_total(FOLDERS(cntxt)) && (f = folder_entry(index, FOLDERS(cntxt))) --- 7240,7248 ---- if(find_recent) *find_recent = 0L; ! ! find_new_message: ! for(index = folder_index(test_current, cntxt, FI_FOLDER) + 1; index > 0 && index < folder_total(FOLDERS(cntxt)) && (f = folder_entry(index, FOLDERS(cntxt))) *************** *** 7140,7145 **** --- 7253,7261 ---- int rv, we_cancel = 0, mlen; char msg_buf[MAX_BM+1], mbuf[MAX_BM+1]; + if ( done && !strcmp(ps_global->cur_folder, FLDR_NAME(f))) + break; + /* must be a folder and it can't be the current one */ if(ps_global->context_current == ps_global->context_list && !strcmp(ps_global->cur_folder, FLDR_NAME(f))) *************** *** 7243,7256 **** } } ! if(f && (!find_recent || recent)) strcpy(next, FLDR_NAME(f)); else *next = '\0'; /* BUG: how can this be made smarter so we cache the list? */ free_folder_list(cntxt); return((*next) ? next : NULL); } --- 7359,7495 ---- } } ! if(f && (!find_recent || recent)){ strcpy(next, FLDR_NAME(f)); + done++; + } else *next = '\0'; + if (F_ON(F_AUTO_CIRCULAR_TAB,ps_global) && !done){ + done++; + if (strcmp(test_current,ps_global->inbox_name)){ + test_current = ps_global->inbox_name; + goto find_new_message; + } + } + /* BUG: how can this be made smarter so we cache the list? */ free_folder_list(cntxt); return((*next) ? next : NULL); + } + + + + /* + * next_folder - given a current folder in a context, return the next in + * the list, or NULL if no more or there's a problem. + */ + char * + next_folder_check(streamp, next, current, cntxt, find_recent, show_status,f) + MAILSTREAM **streamp; + char *current, *next; + CONTEXT_S *cntxt; + long *find_recent; + int show_status; + FOLDER_S *f; + { + int index, recent = 0, failed_status = 0; + char *star = "*"; + + /* note: find_folders may assign "stream" */ + build_folder_list(streamp, cntxt, NULL, NULL, + NEWS_TEST(cntxt) ? BFL_LSUB : BFL_NONE); + + if(find_recent) + *find_recent = 0L; + + if(find_recent){ + MAILSTREAM *stream = NULL; + int rv, we_cancel = 0; + char msg_buf[MAX_SCREEN_COLS+1]; + + /* + * check to see if the folder we got is in the list of folders to + * be checked and if we already know that it contains new mail + * or if the user does not want us to check it. + */ + if (folder_in_message_list(FLDR_NAME(f)) || f->selected) + return folder_in_message_list(FLDR_NAME(f)) ? FLDR_NAME(f) : NULL; + else + if ((strcmp(ps_global->cur_folder, FLDR_NAME(f))) && + (ps_global->vars[V_INCOMING_FOLDERS_CHECK].current_val.p && + (strstr(ps_global->vars[V_INCOMING_FOLDERS_CHECK].current_val.p, + FLDR_NAME(f))) || + (ps_global->vars[V_INCOMING_FOLDERS_CHECK].current_val.p && + (ps_global->vars[V_INCOMING_FOLDERS_CHECK].current_val.p[0] == '*') + ))){ + if (show_status) /* for debugging purposes set show_status to TRUE */ + strcat(strncat(strcpy(msg_buf, "Checking "), FLDR_NAME(f), 50), + " for recent messages"); + we_cancel = busy_alarm(1, msg_buf, NULL, 1); + + /* First, get a stream for the test */ + if(streamp){ + if(*streamp){ + if(context_same_stream(cntxt, f->name, *streamp)){ + stream = *streamp; + } + else{ + mail_close(*streamp); + *streamp = NULL; + } + } + } + + if(!stream){ + if(context_same_stream(cntxt, f->name, ps_global->mail_stream)) + stream = ps_global->mail_stream; + else if(ps_global->mail_stream != ps_global->inbox_stream + && context_same_stream(cntxt, f->name, + ps_global->inbox_stream)) + stream = ps_global->inbox_stream; + } + + /* If interestingness is indeterminate, look harder... */ + + if(F_OFF(F_ENABLE_FAST_RECENT, ps_global) + || !((rv = folder_exists(cntxt,f->name)) + & (FEX_ISMARKED | FEX_UNMARKED))){ + extern MAILSTATUS mm_status_result; + + if((F_ON(F_ENABLE_FAST_RECENT, ps_global) && + (rv == 0 || rv & FEX_ERROR)) || + !context_status(cntxt, stream, f->name, SA_RECENT)){ + /* folder doesn't exist or error */ + failed_status = 1; + mm_status_result.flags = 0L; + } + + rv = ((mm_status_result.flags & SA_RECENT) + && (*find_recent = mm_status_result.recent)) + ? FEX_ISMARKED : 0; + + *find_recent = 0L; + } + + if(we_cancel) + cancel_busy_alarm(0); + + failed_status = 0; + + if(rv & FEX_ISMARKED){ + recent++; + if(f && (!find_recent || recent)) + strcpy(next, FLDR_NAME(f)); + else + *next = '\0'; + free_folder_list(cntxt); + return((*next) ? next : NULL);} + + } + return(NULL); + } } diff -rc pine4.52/pine/imap.c pine4.52.I.USE/pine/imap.c *** pine4.52/pine/imap.c Fri Dec 13 10:52:07 2002 --- pine4.52.I.USE/pine/imap.c Tue Jan 14 13:13:42 2003 *************** *** 778,784 **** q_line = -(ps_global->ttyo ? ps_global->ttyo->footer_rows : 3); /* make sure errors are seen */ ! if(ps_global->ttyo) flush_status_messages(0); /* --- 778,784 ---- q_line = -(ps_global->ttyo ? ps_global->ttyo->footer_rows : 3); /* make sure errors are seen */ ! if((ps_global->ttyo) && (!ps_global->checking_incfld)) flush_status_messages(0); /* diff -rc pine4.52/pine/init.c pine4.52.I.USE/pine/init.c *** pine4.52/pine/init.c Mon Jan 6 19:39:16 2003 --- pine4.52.I.USE/pine/init.c Tue Jan 14 13:13:43 2003 *************** *** 156,161 **** --- 156,163 ---- CONF_TXT_T cf_text_incoming_folders[] = "List of incoming msg folders besides INBOX, e.g. ={host2}inbox, {host3}inbox\n# Syntax: optnl-label {optnl-imap-host-name}folder-path"; + CONF_TXT_T cf_incoming_folders_check[] = "List of incoming folders to be checked for new mail\n"; + CONF_TXT_T cf_text_folder_collections[] = "List of directories where saved-message folders may be. First one is\n# the default for Saves. Example: Main {host1}mail/[], Desktop mail\\[]\n# Syntax: optnl-label {optnl-imap-hostname}optnl-directory-path[]"; CONF_TXT_T cf_text_news_collections[] = "List, only needed if nntp-server not set, or news is on a different host\n# than used for NNTP posting. Examples: News *[] or News *{host3/nntp}[]\n# Syntax: optnl-label *{news-host/protocol}[]"; *************** *** 206,215 **** --- 208,243 ---- CONF_TXT_T cf_text_sort_key[] = "Sets presentation order of messages in Index. Choices:\n# subject, from, arrival, date, size. Default: \"arrival\"."; + CONF_TXT_T cf_text_thread_sort_key[] = "Sets presentation order of threads in thread index. Choices:\n# subject, from, arrival, date, size. Default: \"date\" (same as \"thread\")."; + CONF_TXT_T cf_text_addrbook_sort_rule[] = "Sets presentation order of address book entries. Choices: dont-sort,\n# fullname-with-lists-last, fullname, nickname-with-lists-last, nickname\n# Default: \"fullname-with-lists-last\"."; CONF_TXT_T cf_text_folder_sort_rule[] = "Sets presentation order of folder list entries. Choices: ,\n# \n# Default: \"alpha-with-directories-last\"."; + CONF_TXT_T cf_text_compose_rules[] = "Allows a user to set rules when composing messages.\n"; + + CONF_TXT_T cf_text_forward_rules[] = "Allows a user to set rules when forwarding messages.\n"; + + CONF_TXT_T cf_text_reply_rules[] = "Allows a user to set rules when replying messages.\n"; + + CONF_TXT_T cf_text_index_rules[] = "Allows a user to superseed global index format variable in designated folders."; + + CONF_TXT_T cf_text_replace_rules[] = "Allows a user to change the form a specify field in the index-format is \n# displayed."; + + CONF_TXT_T cf_text_reply_indent_rules[] = "Allows a user to change the form a specify a reply-indent-string\n# based of rules."; + + CONF_TXT_T cf_text_reply_leadin_rules[] = "Allows a user to replace the reply-leadin message based on different parameters."; + + CONF_TXT_T cf_text_reply_subject_rules[] = "Allows a user to replace the subject of a message in a customs based way"; + + CONF_TXT_T cf_text_save_rules[] = "Allows a user to specify a save folder message for specific senders or folders."; + + CONF_TXT_T cf_text_smtp_rules[] = "Allows a user to specify a smtp server to be used when sending e-mail,\n# according to the rules specified here."; + + CONF_TXT_T cf_text_sort_rules[] = "Allows a user to specify the sort default order of a specific folder."; + + CONF_TXT_T cf_text_startup_rules[] = "Allows a user to specify the position of a highlighted message when opening a \n# folder."; + CONF_TXT_T cf_text_character_set[] = "Reflects capabilities of the display you have. Default: US-ASCII.\n# Typical alternatives include ISO-8859-x, (x is a number between 1 and 9)."; CONF_TXT_T cf_text_editor[] = "Specifies the program invoked by ^_ in the Composer,\n# or the \"enable-alternate-editor-implicitly\" feature."; *************** *** 436,441 **** --- 464,471 ---- cf_text_nntp_server}, {"inbox-path", 0, 1, 0, 1, 1, 0, 0, 0, 0, cf_text_inbox_path}, + {"incoming-folders-to-check", 0, 1, 0, 1, 1, 0, 0, 0, 0, + cf_incoming_folders_check}, {"incoming-archive-folders", 0, 1, 0, 1, 1, 1, 0, 0, 0, cf_text_archived_folders}, {"pruned-folders", 0, 1, 0, 1, 1, 1, 0, 0, 0, *************** *** 470,475 **** --- 500,507 ---- cf_text_fcc_name_rule}, {"sort-key", 0, 1, 0, 1, 1, 0, 0, 0, 0, cf_text_sort_key}, + {"thread-sort-key", 0, 1, 0, 1, 1, 0, 0, 0, 0, + cf_text_thread_sort_key}, {"addrbook-sort-rule", 0, 1, 0, 1, 1, 0, 0, 0, 0, cf_text_addrbook_sort_rule}, {"folder-sort-rule", 0, 1, 0, 1, 1, 0, 0, 0, 0, *************** *** 490,495 **** --- 522,551 ---- cf_text_thread_exp_char}, {"threading-lastreply-character", 0, 1, 0, 1, 1, 0, 0, 0, 0, cf_text_thread_lastreply_char}, + {"compose-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_compose_rules}, + {"forward-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_forward_rules}, + {"reply-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_reply_rules}, + {"index-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_index_rules}, + {"replace-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_replace_rules}, + {"reply-indent-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_reply_indent_rules}, + {"reply-leadin-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_reply_leadin_rules}, + {"reply-subject-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_reply_subject_rules}, + {"save-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_save_rules}, + {"smtp-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_smtp_rules}, + {"sort-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_sort_rules}, + {"startup-rules", 0, 1, 0, 1, 1, 1, 0, 0, 0, + cf_text_startup_rules}, {"character-set", 0, 1, 0, 1, 1, 0, 0, 0, 0, cf_text_character_set}, {"editor", 0, 1, 0, 1, 1, 1, 0, 0, 0, *************** *** 1397,1403 **** register struct variable *vars = ps->vars; int obs_header_in_reply, /* the obs_ variables are to */ obs_old_style_reply, /* support backwards compatibility */ ! obs_save_by_sender, i, def_sort_rev; PINERC_S *fixedprc = NULL; FeatureLevel obs_feature_level; --- 1453,1459 ---- register struct variable *vars = ps->vars; int obs_header_in_reply, /* the obs_ variables are to */ obs_old_style_reply, /* support backwards compatibility */ ! obs_save_by_sender, i, def_sort_rev, thread_def_sort_rev; PINERC_S *fixedprc = NULL; FeatureLevel obs_feature_level; *************** *** 1418,1423 **** --- 1474,1480 ---- GLO_FEATURE_LEVEL = cpystr(DF_FEATURE_LEVEL); GLO_OLD_STYLE_REPLY = cpystr(DF_OLD_STYLE_REPLY); GLO_SORT_KEY = cpystr(DF_SORT_KEY); + GLO_THREAD_SORT_KEY = cpystr(DF_THREAD_SORT_KEY); GLO_SAVED_MSG_NAME_RULE = cpystr(DF_SAVED_MSG_NAME_RULE); GLO_FCC_RULE = cpystr(DF_FCC_RULE); GLO_AB_SORT_RULE = cpystr(DF_AB_SORT_RULE); *************** *** 1761,1766 **** --- 1818,1835 ---- set_current_val(&vars[V_POSTPONED_FOLDER], TRUE, TRUE); set_current_val(&vars[V_READ_MESSAGE_FOLDER], TRUE, TRUE); set_current_val(&vars[V_FORM_FOLDER], TRUE, TRUE); + set_current_val(&vars[V_COMPOSE_RULES], TRUE, TRUE); + set_current_val(&vars[V_FORWARD_RULES], TRUE, TRUE); + set_current_val(&vars[V_REPLY_RULES], TRUE, TRUE); + set_current_val(&vars[V_INDEX_RULES], TRUE, TRUE); + set_current_val(&vars[V_REPLACE_RULES], TRUE, TRUE); + set_current_val(&vars[V_REPLY_INDENT_RULES], TRUE, TRUE); + set_current_val(&vars[V_REPLY_LEADIN_RULES], TRUE, TRUE); + set_current_val(&vars[V_RESUB_RULES], TRUE, TRUE); + set_current_val(&vars[V_SAVE_RULES], TRUE, TRUE); + set_current_val(&vars[V_SMTP_RULES], TRUE, TRUE); + set_current_val(&vars[V_SORT_RULES], TRUE, TRUE); + set_current_val(&vars[V_STARTUP_RULES], TRUE, TRUE); set_current_val(&vars[V_EDITOR], TRUE, TRUE); set_current_val(&vars[V_SPELLER], TRUE, TRUE); set_current_val(&vars[V_IMAGE_VIEWER], TRUE, TRUE); *************** *** 1936,1941 **** --- 2005,2012 ---- if(VAR_NEWSRC_PATH && VAR_NEWSRC_PATH[0]) mail_parameters(NULL, SET_NEWSRC, (void *)VAR_NEWSRC_PATH); + mail_parameters(NULL, SET_NEWSRCQUERY, (void *) pine_set_newsrc); + set_current_val(&vars[V_NEWS_ACTIVE_PATH], TRUE, TRUE); if(VAR_NEWS_ACTIVE_PATH) mail_parameters(NULL, SET_NEWSACTIVE, *************** *** 2159,2166 **** set_current_val(&vars[V_PRUNED_FOLDERS], TRUE, TRUE); set_current_val(&vars[V_ARCHIVED_FOLDERS], TRUE, TRUE); set_current_val(&vars[V_INCOMING_FOLDERS], TRUE, TRUE); set_current_val(&vars[V_SORT_KEY], TRUE, TRUE); ! if(decode_sort(VAR_SORT_KEY, &ps->def_sort, &def_sort_rev) == -1){ sprintf(tmp_20k_buf, "Sort type \"%.200s\" is invalid", VAR_SORT_KEY); init_error(ps, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf); ps->def_sort = SortArrival; --- 2230,2238 ---- set_current_val(&vars[V_PRUNED_FOLDERS], TRUE, TRUE); set_current_val(&vars[V_ARCHIVED_FOLDERS], TRUE, TRUE); set_current_val(&vars[V_INCOMING_FOLDERS], TRUE, TRUE); + set_current_val(&vars[V_INCOMING_FOLDERS_CHECK], TRUE, TRUE); set_current_val(&vars[V_SORT_KEY], TRUE, TRUE); ! if(decode_sort(VAR_SORT_KEY, &ps->def_sort, &def_sort_rev,0) == -1){ sprintf(tmp_20k_buf, "Sort type \"%.200s\" is invalid", VAR_SORT_KEY); init_error(ps, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf); ps->def_sort = SortArrival; *************** *** 2169,2174 **** --- 2241,2257 ---- else ps->def_sort_rev = def_sort_rev; + set_current_val(&vars[V_THREAD_SORT_KEY], TRUE, TRUE); + if(decode_sort(VAR_THREAD_SORT_KEY, &ps->thread_def_sort, + &thread_def_sort_rev, 1) == -1){ + sprintf(tmp_20k_buf, "Sort type \"%s\" is invalid", VAR_THREAD_SORT_KEY); + init_error(ps, SM_ORDER | SM_DING, 3, 5, tmp_20k_buf); + ps->thread_def_sort = SortDate; + ps->thread_def_sort_rev = 0; + } + else + ps->thread_def_sort_rev = thread_def_sort_rev; + cur_rule_value(&vars[V_SAVED_MSG_NAME_RULE], TRUE, TRUE); {NAMEVAL_S *v; int i; for(i = 0; v = save_msg_rules(i); i++) *************** *** 2407,2412 **** --- 2490,2497 ---- /* Reply Prefs */ + {"alternate-reply-menu", + F_ALT_REPLY_MENU, h_config_alt_reply_menu, PREF_RPLY}, {"enable-reply-indent-string-editing", F_ENABLE_EDIT_REPLY_INDENT, h_config_prefix_editing, PREF_RPLY}, {"include-attachments-in-reply", *************** *** 2441,2446 **** --- 2526,2533 ---- F_AUTO_FCC_ONLY, h_config_auto_fcc_only, PREF_SEND}, {"fcc-without-attachments", F_NO_FCC_ATTACH, h_config_no_fcc_attach, PREF_SEND}, + {"return-path-uses-domain-name", + F_USE_DOMAIN_NAME, h_config_use_domain, PREF_SEND}, {"mark-fcc-seen", F_MARK_FCC_SEEN, h_config_mark_fcc_seen, PREF_SEND}, {"use-sender-not-x-sender", *************** *** 2455,2460 **** --- 2542,2549 ---- F_ENABLE_DOT_FOLDERS, h_config_enable_dot_folders, PREF_FLDR}, {"enable-incoming-folders", F_ENABLE_INCOMING, h_config_enable_incoming, PREF_FLDR}, + {"enable-check-incoming-folders", + F_ENABLE_INCOMING_CHECK, h_config_enable_check_incoming, PREF_FLDR}, {"enable-lame-list-mode", F_FIX_BROKEN_LIST, h_config_lame_list_mode, PREF_FLDR}, {"expanded-view-of-folders", *************** *** 2483,2490 **** --- 2572,2583 ---- /* Index prefs */ {"auto-open-next-unread", F_AUTO_OPEN_NEXT_UNREAD, h_config_auto_open_unread, PREF_INDX}, + {"enable-circular-tab", + F_AUTO_CIRCULAR_TAB, h_config_circular_tab, PREF_INDX}, {"thread-index-shows-important-color", F_COLOR_LINE_IMPORTANT, h_config_color_thrd_import, PREF_INDX}, + {"enhanced-fancy-thread-support", + F_ENHANCED_THREAD, h_config_enhanced_thread, PREF_INDX}, {"continue-tab-without-confirm", F_TAB_NO_CONFIRM, h_config_tab_no_prompt, PREF_INDX}, {"delete-skips-deleted", *************** *** 2588,2593 **** --- 2681,2688 ---- F_FORCE_LOW_SPEED, h_config_force_low_speed, PREF_OS_LWSD}, {"auto-move-read-msgs", F_AUTO_READ_MSGS, h_config_auto_read_msgs, PREF_MISC}, + {"auto-move-read-msgs-using-rules", + F_AUTO_READ_MSGS_RULES, h_config_auto_read_msgs_rules, PREF_MISC}, {"auto-unzoom-after-apply", F_AUTO_UNZOOM, h_config_auto_unzoom, PREF_MISC}, {"auto-zoom-after-select", *************** *** 3800,3810 **** if(i > 0){ ps->initial_cmds = (int *)fs_get((i+1) * sizeof(int)); ps->free_initial_cmds = ps->initial_cmds; ! for(j = 0; j < i; j++) ps->initial_cmds[j] = i_cmds[j]; ! ps->initial_cmds[i] = 0; ps->in_init_seq = ps->save_in_init_seq = 1; } } --- 3895,3910 ---- if(i > 0){ ps->initial_cmds = (int *)fs_get((i+1) * sizeof(int)); + ps->initial_cmds_backup = (int *)fs_get((i+1) * sizeof(int)); ps->free_initial_cmds = ps->initial_cmds; ! for(j = 0; j < i; j++){ ps->initial_cmds[j] = i_cmds[j]; ! ps->initial_cmds_backup[j] = i_cmds[j];} ! #define ctrl_x 24 ! if (i > 1) ! ps->send_immediately = (i_cmds[i - 2] == ctrl_x) && (i_cmds[i - 1] == 'y'); ps->initial_cmds[i] = 0; + ps->initial_cmds_backup[i] = 0; ps->in_init_seq = ps->save_in_init_seq = 1; } } *************** *** 5852,5874 **** * argument also means arrival/reverse. */ int ! decode_sort(sort_spec, def_sort, def_sort_rev) char *sort_spec; SortOrder *def_sort; int *def_sort_rev; { char *sep; char *fix_this = NULL; ! int x, reverse; if(!sort_spec || !*sort_spec){ ! *def_sort = SortArrival; *def_sort_rev = 0; return(0); } if(struncmp(sort_spec, "reverse", strlen(sort_spec)) == 0){ ! *def_sort = SortArrival; *def_sort_rev = 1; return(0); } --- 5952,5975 ---- * argument also means arrival/reverse. */ int ! decode_sort(sort_spec, def_sort, def_sort_rev, thread) char *sort_spec; SortOrder *def_sort; int *def_sort_rev; + int thread; { char *sep; char *fix_this = NULL; ! int x = 0, reverse; if(!sort_spec || !*sort_spec){ ! *def_sort = thread ? SortDate : SortArrival; *def_sort_rev = 0; return(0); } if(struncmp(sort_spec, "reverse", strlen(sort_spec)) == 0){ ! *def_sort = thread ? SortDate : SortArrival; *def_sort_rev = 1; return(0); } diff -rc pine4.52/pine/mailcmd.c pine4.52.I.USE/pine/mailcmd.c *** pine4.52/pine/mailcmd.c Thu Jan 9 11:32:59 2003 --- pine4.52.I.USE/pine/mailcmd.c Tue Jan 14 13:13:45 2003 *************** *** 90,96 **** int save_ex_output_line PROTO((char *, unsigned long *, gf_io_t)); int create_for_save PROTO((MAILSTREAM *, CONTEXT_S *, char *)); void flag_string PROTO((MESSAGECACHE *, long, char *)); ! int select_sort PROTO((struct pine *, int, SortOrder *, int *)); void aggregate_select PROTO((struct pine *, MSGNO_S *, int, CmdWhere)); void thread_index_select PROTO((struct pine *, MSGNO_S *, int, CmdWhere)); int select_number PROTO((MAILSTREAM *, MSGNO_S *, long)); --- 90,96 ---- int save_ex_output_line PROTO((char *, unsigned long *, gf_io_t)); int create_for_save PROTO((MAILSTREAM *, CONTEXT_S *, char *)); void flag_string PROTO((MESSAGECACHE *, long, char *)); ! int select_sort PROTO((struct pine *, int, SortOrder *, int *, int)); void aggregate_select PROTO((struct pine *, MSGNO_S *, int, CmdWhere)); void thread_index_select PROTO((struct pine *, MSGNO_S *, int, CmdWhere)); int select_number PROTO((MAILSTREAM *, MSGNO_S *, long)); *************** *** 102,114 **** --- 102,135 ---- void search_headers PROTO((struct pine *, MAILSTREAM *, int, MSGNO_S *)); char *currentf_sequence PROTO((MAILSTREAM *, MSGNO_S *, long, long *,int)); char *invalid_elt_sequence PROTO((MAILSTREAM *, MSGNO_S *)); + long top_thread PROTO((MAILSTREAM *, long)); + void move_top_thread PROTO((MAILSTREAM *, MSGNO_S *, long)); + long top_this_thread PROTO((MAILSTREAM *, long)); + void move_top_this_thread PROTO((MAILSTREAM *, MSGNO_S *, long)); + void cmd_delete_this_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *)); + void cmd_delete_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *)); + void cmd_undelete_this_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *)); + void cmd_undelete_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *)); + void cmd_select_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *)); + void kolapse_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, char, int)); + int this_thread_is_kolapsed PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, long)); + int thread_is_kolapsed PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, long)); + int collapse_this_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, int)); + int collapse_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); + int expand_this_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, int)); + int expand_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); + int move_next_this_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); + int move_next_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); + int move_prev_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); char *selected_sequence PROTO((MAILSTREAM *, MSGNO_S *, long *)); int any_messages PROTO((MSGNO_S *, char *, char *)); int can_set_flag PROTO((struct pine *, char *, int)); + unsigned get_perfolder_startup_rule PROTO((MAILSTREAM *, int, char *)); int bezerk_delimiter PROTO((ENVELOPE *, gf_io_t, int)); int move_filtered_msgs PROTO((MAILSTREAM *, MSGNO_S *, char *, int)); void delete_filtered_msgs PROTO((MAILSTREAM *)); char *move_read_msgs PROTO((MAILSTREAM *, char *, char *, long)); + char *move_read_msgs_using_rules PROTO((MAILSTREAM *, char *, char *)); int read_msg_prompt PROTO((long, char *)); char *move_read_incoming PROTO((MAILSTREAM *, CONTEXT_S *, char *, char **, char *)); *************** *** 124,129 **** --- 145,153 ---- long closest_jump_target PROTO((long, MAILSTREAM *, MSGNO_S *, int, CmdWhere, char *)); long get_level PROTO((int, int, SCROLL_S *)); + int find_startup_position PROTO((int, MAILSTREAM *)); + char *get_rule_result PROTO((int, char *, char **)); + char *get_folder_to_save PROTO((MSGNO_S *, long, char *)); #define SV_DELETE 0x1 *************** *** 888,894 **** state->context_current, &recent_cnt, F_ON(F_TAB_NO_CONFIRM,state) ? NULL : &did_cancel))){ ! if(!in_inbox){ static ESCKEY_S inbox_opt[] = { {'y', 'y', "Y", "Yes"}, {'n', 'n', "N", "No"}, --- 912,918 ---- state->context_current, &recent_cnt, F_ON(F_TAB_NO_CONFIRM,state) ? NULL : &did_cancel))){ ! if(!in_inbox && F_OFF(F_AUTO_CIRCULAR_TAB,state)){ static ESCKEY_S inbox_opt[] = { {'y', 'y', "Y", "Yes"}, {'n', 'n', "N", "No"}, *************** *** 1243,1248 **** --- 1267,1275 ---- */ if(SORT_IS_THREADED()) refresh_sort(msgmap, SRT_NON); + if (msgmap->nmsgs + && F_ON(F_ENHANCED_THREAD, state) && COLL_THRDS()) + kolapse_thread(state, stream, msgmap, '[', 0); } else{ if(del_count) *************** *** 1381,1387 **** if(any_messages(msgmap, NULL, NULL)){ if(any_lflagged(msgmap, MN_SLCT) > 0L){ if(apply_command(state, stream, msgmap, 0, ! AC_NONE, question_line) && F_ON(F_AUTO_UNZOOM, state)) unzoom_index(state, stream, msgmap); } --- 1408,1414 ---- if(any_messages(msgmap, NULL, NULL)){ if(any_lflagged(msgmap, MN_SLCT) > 0L){ if(apply_command(state, stream, msgmap, 0, ! AC_NONE, question_line, 1) && F_ON(F_AUTO_UNZOOM, state)) unzoom_index(state, stream, msgmap); } *************** *** 1394,1411 **** /*-------- Sort command -------*/ case MC_SORT : { int were_threading = THREADING(); SortOrder sort = mn_get_sort(msgmap); int rev = mn_get_revsort(msgmap); dprint(1, (debugfile,"MAIL_CMD: sort\n")); ! if(select_sort(state, question_line, &sort, &rev)){ /* $ command reinitializes threading collapsed/expanded info */ if(SORT_IS_THREADED() && !SEP_THRDINDX()) erase_threading_info(stream, msgmap); ! sort_folder(ps_global->msgmap, sort, rev, SRT_VRB|SRT_MAN); } state->mangled_footer = 1; --- 1421,1450 ---- /*-------- Sort command -------*/ case MC_SORT : + case MC_SORTHREAD : { int were_threading = THREADING(); SortOrder sort = mn_get_sort(msgmap); int rev = mn_get_revsort(msgmap); + int thread = (command == MC_SORT) ? 0 : 1; dprint(1, (debugfile,"MAIL_CMD: sort\n")); ! if(select_sort(state, question_line, &sort, &rev, thread)){ /* $ command reinitializes threading collapsed/expanded info */ + if (command == MC_SORTHREAD && (sort != SortArrival) + && (sort != SortDate) && (sort != SortThread)){ + q_status_message(SM_ORDER, 0, 3, + "Sort method not implemented"); + break; + } if(SORT_IS_THREADED() && !SEP_THRDINDX()) erase_threading_info(stream, msgmap); ! ps_global->thread_def_sort = sort; ! ps_global->thread_def_sort_rev = rev; ! sort = (command == MC_SORT) ? sort : SortThread; ! ! sort_folder(ps_global->msgmap, sort, rev, SRT_VRB|SRT_MAN, 1); } state->mangled_footer = 1; *************** *** 1458,1463 **** --- 1497,1507 ---- break; + /*--------Incoming Folders Auto Check --------*/ + case MC_FORCECHECK: + new_mail_incfolder(state,command); + break; + /*--------- Default, unknown command ----------*/ default: panic("Unexpected command case"); *************** *** 2700,2706 **** { static char folder[MAILTMPLEN+1] = {'\0'}; static CONTEXT_S *last_context = NULL; ! int rc, n, flags, last_rc = 0, saveable_count = 0, done = 0; char prompt[MAX_SCREEN_COLS+1], *p, expanded[MAILTMPLEN]; char *buf = tmp_20k_buf; HelpType help; --- 2744,2751 ---- { static char folder[MAILTMPLEN+1] = {'\0'}; static CONTEXT_S *last_context = NULL; ! int rc, n = 0, flags, last_rc = 0, saveable_count = 0, done = 0; ! int use_rule = 0; char prompt[MAX_SCREEN_COLS+1], *p, expanded[MAILTMPLEN]; char *buf = tmp_20k_buf; HelpType help; *************** *** 2711,2733 **** if(((*cntxt) = default_save_context(state->context_list)) == NULL) (*cntxt) = state->context_list; ! if(!env || ps_global->save_msg_rule == MSG_RULE_LAST ! || ps_global->save_msg_rule == MSG_RULE_DEFLT){ ! if(ps_global->save_msg_rule == MSG_RULE_LAST && last_context) ! (*cntxt) = last_context; ! else{ strncpy(folder,ps_global->VAR_DEFAULT_SAVE_FOLDER,sizeof(folder)-1); folder[sizeof(folder)-1] = '\0'; ! } ! } ! else{ ! get_save_fldr_from_env(folder, sizeof(folder), env, state, rawmsgno, section); ! if(ps_global->expunge_count) /* somebody expunged current message */ ! return(0); } - /* how many context's can be saved to... */ for(tc = state->context_list; tc; tc = tc->next) if(!NEWS_TEST(tc)) --- 2756,2792 ---- if(((*cntxt) = default_save_context(state->context_list)) == NULL) (*cntxt) = state->context_list; ! { RULE_RESULT *rule; ! rule = (RULE_RESULT *) ! get_result_rule(ps_global->vars[V_SAVE_RULES].current_val.l, ! FOR_RULE | FOR_SAVE, env); ! if (rule){ ! use_rule++; ! sprintf(folder,rule->result); ! if (rule->result) ! fs_give((void **)&rule->result); ! fs_give((void **)&rule); ! } ! } ! ! if (!use_rule){ ! if(!env || ps_global->save_msg_rule == MSG_RULE_LAST ! || ps_global->save_msg_rule == MSG_RULE_DEFLT){ ! if(ps_global->save_msg_rule == MSG_RULE_LAST && last_context) ! (*cntxt) = last_context; ! else{ strncpy(folder,ps_global->VAR_DEFAULT_SAVE_FOLDER,sizeof(folder)-1); folder[sizeof(folder)-1] = '\0'; ! } ! } ! else{ ! get_save_fldr_from_env(folder, sizeof(folder), env, state, rawmsgno, section); ! if(ps_global->expunge_count) /* somebody expunged current message */ ! return(0); ! } } /* how many context's can be saved to... */ for(tc = state->context_list; tc; tc = tc->next) if(!NEWS_TEST(tc)) *************** *** 3508,3515 **** * if there is more than one message, do multiappend. * otherwise, we can use our already open stream. */ ! if(!save_stream || !is_imap_stream(save_stream) || ! (LEVELMULTIAPPEND(save_stream) && mn_total_cur(msgmap) > 1)){ APPENDPACKAGE pkg; STRING msg; --- 3567,3574 ---- * if there is more than one message, do multiappend. * otherwise, we can use our already open stream. */ ! if((!save_stream || !is_imap_stream(save_stream) || ! (LEVELMULTIAPPEND(save_stream) && mn_total_cur(msgmap) > 1))){ APPENDPACKAGE pkg; STRING msg; *************** *** 3587,3593 **** *date = '\0'; rv = save_fetch_append(stream, mn_m2raw(msgmap, i), ! NULL, save_stream, save_folder, context, mc->rfc822_size, flags, date, so); if(ps_global->expunge_count) --- 3646,3652 ---- *date = '\0'; rv = save_fetch_append(stream, mn_m2raw(msgmap, i), ! NULL, save_stream, folder, context, mc->rfc822_size, flags, date, so); if(ps_global->expunge_count) *************** *** 3657,3663 **** q_status_message(SM_ORDER | SM_DING, 3, 5, tmp_20k_buf); } } - return(nmsgs); } --- 3716,3721 ---- *************** *** 6039,6044 **** --- 6097,6289 ---- } + char *get_rule_result(rule_context, newfolder, list) + int rule_context; + char *newfolder; + char **list; + { char *rule_result = NULL; + ENVELOPE *news_envelope; + RULE_RESULT *rule; + + if (IS_NEWS(ps_global->mail_stream)){ + news_envelope = mail_newenvelope(); + news_envelope->newsgroups = cpystr(newfolder); + } + else + news_envelope = (ENVELOPE *) NULL; + + rule = (RULE_RESULT *) get_result_rule(list,rule_context, news_envelope); + + if (news_envelope) + mail_free_envelope (&news_envelope); + + if (rule){ + rule_result = cpystr(rule->result); + if (rule->result) + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + + return rule_result; + } + + find_startup_position(rule, m) + int rule; + MAILSTREAM *m; + { + long n; + switch(rule){ + /* + * For news in incoming collection we're doing the same thing + * for first-unseen and first-recent. In both those cases you + * get first-unseen if FAKE_NEW is off and first-recent if + * FAKE_NEW is on. If FAKE_NEW is on, first unseen is the + * same as first recent because all recent msgs are unseen + * and all unrecent msgs are seen (see pine_mail_open). + */ + case IS_FIRST_UNSEEN: + first_unseen: + mn_set_cur(ps_global->msgmap, + (ps_global->first_unseen + && mn_get_sort(ps_global->msgmap) == SortArrival + && !mn_get_revsort(ps_global->msgmap) + && !get_lflag(ps_global->mail_stream, NULL, + ps_global->first_unseen, MN_EXLD) + && (n = mn_raw2m(ps_global->msgmap, + ps_global->first_unseen))) + ? n + : first_sorted_flagged(F_UNSEEN | F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID)); + break; + + case IS_FIRST_RECENT: + first_recent: + /* + * We could really use recent for news but this is the way + * it has always worked, so we'll leave it. That is, if + * the FAKE_NEW feature is on, recent and unseen are + * equivalent, so it doesn't matter. If the feature isn't + * on, all the undeleted messages are unseen and we start + * at the first one. User controls with the FAKE_NEW feature. + */ + if(IS_NEWS(ps_global->mail_stream)){ + mn_set_cur(ps_global->msgmap, + first_sorted_flagged(F_UNSEEN|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID)); + } + else{ + mn_set_cur(ps_global->msgmap, + first_sorted_flagged(F_RECENT|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID)); + } + break; + + case IS_FIRST_IMPORTANT: + mn_set_cur(ps_global->msgmap, + first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID)); + break; + + case IS_FIRST_IMPORTANT_OR_UNSEEN: + + if(IS_NEWS(ps_global->mail_stream)) + goto first_unseen; + + { + MsgNo flagged, first_unseen; + + flagged = first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID); + first_unseen = (ps_global->first_unseen + && mn_get_sort(ps_global->msgmap) == SortArrival + && !mn_get_revsort(ps_global->msgmap) + && !get_lflag(ps_global->mail_stream, NULL, + ps_global->first_unseen, MN_EXLD) + && (n = mn_raw2m(ps_global->msgmap, + ps_global->first_unseen))) + ? n + : first_sorted_flagged(F_UNSEEN|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID); + mn_set_cur(ps_global->msgmap, + (MsgNo) min((int) flagged, (int) first_unseen)); + + } + + break; + + case IS_FIRST_IMPORTANT_OR_RECENT: + + if(IS_NEWS(ps_global->mail_stream)) + goto first_recent; + + { + MsgNo flagged, first_recent; + + flagged = first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID); + first_recent = first_sorted_flagged(F_RECENT|F_UNDEL, + m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID); + mn_set_cur(ps_global->msgmap, + (MsgNo) min((int) flagged, (int) first_recent)); + } + + break; + + case IS_FIRST: + mn_set_cur(ps_global->msgmap, + first_sorted_flagged(F_UNDEL, m, 0L, + THREADING() ? 0 : FSF_SKIP_CHID)); + break; + + case IS_LAST: + mn_set_cur(ps_global->msgmap, + first_sorted_flagged(F_UNDEL, m, 0L, + FSF_LAST | (THREADING() ? 0 : FSF_SKIP_CHID))); + break; + + default: + panic("Unexpected incoming startup case"); + break; + } + } + + unsigned + get_perfolder_startup_rule(stream, rule_type, folder) + MAILSTREAM *stream; + int rule_type; + char *folder; + { + unsigned startup_rule; + char *rule_result; + + startup_rule = reset_startup_rule(stream); + rule_result = get_rule_result(FOR_RULE | FOR_STARTUP, folder, + ps_global->vars[rule_type].current_val.l); + if (rule_result && *rule_result){ + int i; + NAMEVAL_S *v; + + for(i = 0; v = incoming_startup_rules(i); i++) + if(!strucmp(rule_result, v->name)){ + startup_rule = v->value; + break; + } + fs_give((void **)&rule_result); + } + return startup_rule; + } + + + long + any_new_message (ps) + struct pine *ps; + { + return ((ps->mail_stream) == (ps->inbox_stream)) + ? count_flagged(ps->mail_stream, F_UNSEEN) : + ps->mail_stream->recent; + } + /*---------------------------------------------------------------------- Actually attempt to open given folder *************** *** 6247,6252 **** --- 6492,6505 ---- clear_index_cache(); /* MUST sort before restoring msgno! */ refresh_sort(ps_global->msgmap, SRT_NON); + if (any_new_message(ps_global)) + q_status_message4(SM_ORDER, 0, 3, + "Opened folder \"%.200s\" with %.200s message%.200s - %.200s new", + ps_global->inbox_name, + long2string(mn_get_total(ps_global->msgmap)), + plural(mn_get_total(ps_global->msgmap)), + long2string(any_new_message(ps_global))); + else q_status_message3(SM_ORDER, 0, 3, "Opened folder \"%.200s\" with %.200s message%.200s", ps_global->inbox_name, *************** *** 6316,6321 **** --- 6569,6577 ---- ps_global->open_readonly_on_startup = 0 ; } + if(IS_NEWS(ps_global->mail_stream)) + openmode |= OP_MULNEWSRC; + ps_global->first_unseen = 0L; m = context_open((new_context && !open_inbox) ? new_context : NULL, stream, *************** *** 6491,6513 **** if(we_cancel) cancel_busy_alarm(0); ! q_status_message5(SM_ORDER, 0, 4, ! "%.200s \"%.200s\" opened with %.200s message%.200s%.200s", ! IS_NEWS(ps_global->mail_stream) ! ? "News group" : "Folder", ! pretty_fn(newfolder), ! comatose(mn_get_total(ps_global->msgmap)), ! plural(mn_get_total(ps_global->msgmap)), ! READONLY_FOLDER ? " READONLY" : ""); #ifdef _WINDOWS mswin_settitle(pretty_fn(newfolder)); #endif - reset_sort_order(SRT_VRB); ps_global->viewing_a_thread = 0; reset_index_format(); ! perfolder_startup_rule = reset_startup_rule(ps_global->mail_stream); if(mn_get_total(ps_global->msgmap) > 0L) { if(ps_global->start_entry > 0) { --- 6747,6783 ---- if(we_cancel) cancel_busy_alarm(0); ! reset_sort_order(SRT_VRB); ! ! if (any_new_message(ps_global)) ! q_status_message7(SM_ORDER, 0, 4, ! "%.200s \"%.200s\" opened with %.200s message%.200s%.200s - %.200s new", ! IS_NEWS(ps_global->mail_stream) ! ? "News group" : "Folder", ! pretty_fn(newfolder), ! comatose(mn_get_total(ps_global->msgmap)), ! plural(mn_get_total(ps_global->msgmap)), ! READONLY_FOLDER ? " READONLY" : "", ! long2string(any_new_message(ps_global)), ! NULL); ! else ! q_status_message5(SM_ORDER, 0, 4, ! "%.200s \"%.200s\" opened with %.200s message%.200s%.200s", ! IS_NEWS(ps_global->mail_stream) ! ? "News group" : "Folder", ! pretty_fn(newfolder), ! comatose(mn_get_total(ps_global->msgmap)), ! plural(mn_get_total(ps_global->msgmap)), ! READONLY_FOLDER ? " READONLY" : ""); #ifdef _WINDOWS mswin_settitle(pretty_fn(newfolder)); #endif ps_global->viewing_a_thread = 0; reset_index_format(); ! perfolder_startup_rule = get_perfolder_startup_rule(ps_global->mail_stream, ! V_STARTUP_RULES, newfolder); if(mn_get_total(ps_global->msgmap) > 0L) { if(ps_global->start_entry > 0) { *************** *** 6530,6650 **** else use_this_startup_rule = ps_global->inc_startup_rule; ! switch(use_this_startup_rule){ ! /* ! * For news in incoming collection we're doing the same thing ! * for first-unseen and first-recent. In both those cases you ! * get first-unseen if FAKE_NEW is off and first-recent if ! * FAKE_NEW is on. If FAKE_NEW is on, first unseen is the ! * same as first recent because all recent msgs are unseen ! * and all unrecent msgs are seen (see pine_mail_open). ! */ ! case IS_FIRST_UNSEEN: ! first_unseen: ! mn_set_cur(ps_global->msgmap, ! (ps_global->first_unseen ! && mn_get_sort(ps_global->msgmap) == SortArrival ! && !mn_get_revsort(ps_global->msgmap) ! && !get_lflag(ps_global->mail_stream, NULL, ! ps_global->first_unseen, MN_EXLD) ! && (n = mn_raw2m(ps_global->msgmap, ! ps_global->first_unseen))) ! ? n ! : first_sorted_flagged(F_UNSEEN | F_UNDEL, m, 0L, ! THREADING() ? 0 : FSF_SKIP_CHID)); ! break; - case IS_FIRST_RECENT: - first_recent: - /* - * We could really use recent for news but this is the way - * it has always worked, so we'll leave it. That is, if - * the FAKE_NEW feature is on, recent and unseen are - * equivalent, so it doesn't matter. If the feature isn't - * on, all the undeleted messages are unseen and we start - * at the first one. User controls with the FAKE_NEW feature. - */ - if(IS_NEWS(ps_global->mail_stream)){ - mn_set_cur(ps_global->msgmap, - first_sorted_flagged(F_UNSEEN|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID)); - } - else{ - mn_set_cur(ps_global->msgmap, - first_sorted_flagged(F_RECENT|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID)); - } - break; - - case IS_FIRST_IMPORTANT: - mn_set_cur(ps_global->msgmap, - first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID)); - break; - - case IS_FIRST_IMPORTANT_OR_UNSEEN: - - if(IS_NEWS(ps_global->mail_stream)) - goto first_unseen; - - { - MsgNo flagged, first_unseen; - - flagged = first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID); - first_unseen = (ps_global->first_unseen - && mn_get_sort(ps_global->msgmap) == SortArrival - && !mn_get_revsort(ps_global->msgmap) - && !get_lflag(ps_global->mail_stream, NULL, - ps_global->first_unseen, MN_EXLD) - && (n = mn_raw2m(ps_global->msgmap, - ps_global->first_unseen))) - ? n - : first_sorted_flagged(F_UNSEEN|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID); - mn_set_cur(ps_global->msgmap, - (MsgNo) min((int) flagged, (int) first_unseen)); - - } - - break; - - case IS_FIRST_IMPORTANT_OR_RECENT: - - if(IS_NEWS(ps_global->mail_stream)) - goto first_recent; - - { - MsgNo flagged, first_recent; - - flagged = first_sorted_flagged(F_FLAG|F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID); - first_recent = first_sorted_flagged(F_RECENT|F_UNDEL, - m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID); - mn_set_cur(ps_global->msgmap, - (MsgNo) min((int) flagged, (int) first_recent)); - } - - break; - - case IS_FIRST: - mn_set_cur(ps_global->msgmap, - first_sorted_flagged(F_UNDEL, m, 0L, - THREADING() ? 0 : FSF_SKIP_CHID)); - break; - - case IS_LAST: - mn_set_cur(ps_global->msgmap, - first_sorted_flagged(F_UNDEL, m, 0L, - FSF_LAST | (THREADING() ? 0 : FSF_SKIP_CHID))); - break; - - default: - panic("Unexpected incoming startup case"); - break; - - } } else if(IS_NEWS(ps_global->mail_stream)){ /* --- 6800,6807 ---- else use_this_startup_rule = ps_global->inc_startup_rule; ! find_startup_position(use_this_startup_rule, m); } else if(IS_NEWS(ps_global->mail_stream)){ /* *************** *** 6664,6672 **** adjust_cur_to_visible(ps_global->mail_stream, ps_global->msgmap); } ! else{ mn_set_cur(ps_global->msgmap, -1L); - } return(1); } --- 6821,6828 ---- adjust_cur_to_visible(ps_global->mail_stream, ps_global->msgmap); } ! else mn_set_cur(ps_global->msgmap, -1L); return(1); } *************** *** 6678,6686 **** long rflags = ROLE_DO_OTHER; PAT_STATE pstate; PAT_S *pat; ! int we_set_it = 0; ! if(ps_global->mail_stream && nonempty_patterns(rflags, &pstate)){ for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ if(match_pattern(pat->patgrp, ps_global->mail_stream, NULL, NULL, NULL, 0)) --- 6834,6843 ---- long rflags = ROLE_DO_OTHER; PAT_STATE pstate; PAT_S *pat; ! int we_set_it = 0,found = 0; ! found = find_index_rule(); if (found) we_set_it++; ! if(!found && ps_global->mail_stream && nonempty_patterns(rflags, &pstate)){ for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ if(match_pattern(pat->patgrp, ps_global->mail_stream, NULL, NULL, NULL, 0)) *************** *** 6710,6738 **** PAT_S *pat; SortOrder the_sort_order; int sort_is_rev; ! /* set default order */ ! the_sort_order = ps_global->def_sort; ! sort_is_rev = ps_global->def_sort_rev; ! if(ps_global->mail_stream && nonempty_patterns(rflags, &pstate)){ ! for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ ! if(match_pattern(pat->patgrp, ps_global->mail_stream, NULL, ! NULL, NULL, 0)) ! break; ! } ! if(pat && pat->action && !pat->action->bogus ! && pat->action->sort_is_set){ ! the_sort_order = pat->action->sortorder; ! sort_is_rev = pat->action->revsort; ! } } ! sort_folder(ps_global->msgmap, the_sort_order, sort_is_rev, flags); } - unsigned reset_startup_rule(stream) MAILSTREAM *stream; --- 6867,6907 ---- PAT_S *pat; SortOrder the_sort_order; int sort_is_rev; + char *rule_result; + SortOrder new_sort = EndofList; ! rule_result = get_rule_result(FOR_RULE | FOR_SORT, ps_global->cur_folder, ! ps_global->vars[V_SORT_RULES].current_val.l); ! if (rule_result && *rule_result){ ! new_sort = (SortOrder) translate(rule_result); ! fs_give((void **)&rule_result); ! } ! if (new_sort != EndofList){ ! the_sort_order = new_sort; ! sort_is_rev = ps_global->def_sort_rev; ! } ! else{ ! /* set default order */ ! the_sort_order = ps_global->def_sort; ! sort_is_rev = ps_global->def_sort_rev; ! if(ps_global->mail_stream && nonempty_patterns(rflags, &pstate)){ ! for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ ! if(match_pattern(pat->patgrp, ps_global->mail_stream, NULL, ! NULL, NULL, 0)) ! break; ! } ! if(pat && pat->action && pat->action->sort_is_set){ ! the_sort_order = pat->action->sortorder; ! sort_is_rev = pat->action->revsort; ! } ! } } ! sort_folder(ps_global->msgmap, the_sort_order, sort_is_rev, flags,1); } unsigned reset_startup_rule(stream) MAILSTREAM *stream; *************** *** 6865,6873 **** /* Save read messages? */ if(VAR_READ_MESSAGE_FOLDER && VAR_READ_MESSAGE_FOLDER[0] && stream == ps_global->inbox_stream ! && (seen_not_del = count_flagged(stream, F_SEEN | F_UNDEL))){ if(F_ON(F_AUTO_READ_MSGS,ps_global) || read_msg_prompt(seen_not_del, VAR_READ_MESSAGE_FOLDER)) /* move inbox's read messages */ moved_msg = move_read_msgs(stream, VAR_READ_MESSAGE_FOLDER, --- 7034,7044 ---- /* Save read messages? */ if(VAR_READ_MESSAGE_FOLDER && VAR_READ_MESSAGE_FOLDER[0] && stream == ps_global->inbox_stream ! && (F_ON(F_AUTO_READ_MSGS_RULES, ps_global) || ! (seen_not_del = count_flagged(stream, F_SEEN | F_UNDEL)))){ if(F_ON(F_AUTO_READ_MSGS,ps_global) + || F_ON(F_AUTO_READ_MSGS_RULES, ps_global) || read_msg_prompt(seen_not_del, VAR_READ_MESSAGE_FOLDER)) /* move inbox's read messages */ moved_msg = move_read_msgs(stream, VAR_READ_MESSAGE_FOLDER, *************** *** 7007,7016 **** ? comatose(stream->nmsgs) : "", plural(stream->nmsgs)); } ! else{ sprintf(buff2, "Clos%s empty folder \"%.*s\"", ing, sizeof(buff2)-50, pretty_fn(folder)); - } if(final_msg) *final_msg = cpystr(buff2); --- 7178,7186 ---- ? comatose(stream->nmsgs) : "", plural(stream->nmsgs)); } ! else sprintf(buff2, "Clos%s empty folder \"%.*s\"", ing, sizeof(buff2)-50, pretty_fn(folder)); if(final_msg) *final_msg = cpystr(buff2); *************** *** 7994,7999 **** --- 8164,8172 ---- char *bufp = NULL; MESSAGECACHE *mc; + if (F_ON(F_AUTO_READ_MSGS_RULES, ps_global)) + return move_read_msgs_using_rules(stream, dstfldr, buf); + if(!is_absolute_path(dstfldr) && !(save_context = default_save_context(ps_global->context_list))) save_context = ps_global->context_list; *************** *** 8025,8031 **** /* select search results */ for(i = 1L; i <= mn_get_total(msgmap); i++) if(((mc = mail_elt(stream,mn_m2raw(msgmap, i)))->valid ! && mc->seen && !mc->deleted) || (!mc->valid && mc->searched)) set_lflag(stream, msgmap, i, MN_SLCT, 1); --- 8198,8204 ---- /* select search results */ for(i = 1L; i <= mn_get_total(msgmap); i++) if(((mc = mail_elt(stream,mn_m2raw(msgmap, i)))->valid ! && mc->seen && !mc->deleted) || (!mc->valid && mc->searched)) set_lflag(stream, msgmap, i, MN_SLCT, 1); *************** *** 8033,8040 **** sprintf(buf, "Moving %s read message%s to \"%.45s\"", comatose(searched), plural(searched), dstfldr); we_cancel = busy_alarm(1, buf, NULL, 1); ! if(save(ps_global, stream, save_context, dstfldr, msgmap, ! SV_DELETE | SV_FIX_DELS) == searched) strncpy(bufp = buf + 1, "Moved", 5); /* change Moving to Moved */ mn_give(&msgmap); --- 8206,8214 ---- sprintf(buf, "Moving %s read message%s to \"%.45s\"", comatose(searched), plural(searched), dstfldr); we_cancel = busy_alarm(1, buf, NULL, 1); ! ps_global->exiting = 1; ! if((save(ps_global, stream, save_context, dstfldr, msgmap, ! SV_DELETE | SV_FIX_DELS) == searched)) strncpy(bufp = buf + 1, "Moved", 5); /* change Moving to Moved */ mn_give(&msgmap); *************** *** 8045,8052 **** --- 8219,8336 ---- return(bufp); } + char * + move_read_msgs_using_rules(stream, dstfldr,buf) + MAILSTREAM *stream; + char *dstfldr; + char *buf; + { + CONTEXT_S *save_context = NULL; + char **folder_to_save = NULL; + int num, we_cancel; + long i, j, success, nmsgs = 0L; + if(!is_absolute_path(dstfldr) + && !(save_context = default_save_context(ps_global->context_list))) + save_context = ps_global->context_list; + if (count_flagged(stream, F_SEEN)){ + folder_to_save = (char **)fs_get((mn_get_total(ps_global->msgmap) + 1)*sizeof(char *)); + folder_to_save[0] = NULL; + mn_init(&ps_global->msgmap, stream->nmsgs); + for (i = 1L; i <= mn_get_total(ps_global->msgmap); i++){ + set_lflag(ps_global->mail_stream, ps_global->msgmap, i, MN_SLCT, 0); + folder_to_save[i] = cpystr(get_folder_to_save(ps_global->msgmap, i, dstfldr)); + } + for (i = 1L; i <= mn_get_total(ps_global->msgmap); i++){ + num = 0; + if (folder_to_save[i]){ + mn_init(&ps_global->msgmap, stream->nmsgs); + for (j = i; j <= mn_get_total(ps_global->msgmap); j++){ + if (folder_to_save[j]){ + if (!strcmp(folder_to_save[i], folder_to_save[j])){ + set_lflag(ps_global->mail_stream, ps_global->msgmap, j, MN_SLCT, 1); + num++; + if (j != i) + fs_give((void **)&folder_to_save[j]); + } + } + } + pseudo_selected(ps_global->msgmap); + sprintf(buf, "Moving %s read message%s to \"%.45s\"", + comatose(num), plural(num), folder_to_save[i]); + we_cancel = busy_alarm(1, buf, NULL, 1); + ps_global->exiting = 1; + if(success = save(ps_global, stream,save_context, folder_to_save[i], + ps_global->msgmap, SV_DELETE | SV_FIX_DELS)) + nmsgs += success; + if(we_cancel) + cancel_busy_alarm(success ? 0 : -1); + for (j = i; j <= mn_get_total(ps_global->msgmap); j++) + set_lflag(ps_global->mail_stream, ps_global->msgmap, j, MN_SLCT, 0); + fs_give((void **)&folder_to_save[i]); + } + } + } + ps_global->exiting = 0; /* useful if we call from aggregate operations */ + sprintf(buf, "Moved automatically %s message%s", + comatose(nmsgs), plural(nmsgs)); + if (folder_to_save) + fs_give((void **)folder_to_save); + return buf; + } + + char * + get_folder_to_save(msgmap, i, dstfldr) + MSGNO_S *msgmap; + long i; + char *dstfldr; + { + MESSAGECACHE *mc; + RULE_RESULT *rule; + char *folder_to_save = NULL, *save_folder = NULL; + int n; + + /* The plan is as follows: Select each message of the folder. We + * need to set the cursor correctly so that iFlag gets the value + * correctly too, otherwise iFlag will get the value of the position + * of the cursor. After that we need to look for a rule that applies + * to the message and get the saving folder. If we get a saving folder, + * and we used the _FLAG_ token, use that folder, if no + * _FLAG_ token was used, move only if seen and not deleted, to the + * folder specified in the saving rule. If we did not get a saving + * folder from the rule, just save in the default folder. + */ + + mn_set_cur(msgmap, i); + mc = mail_elt(ps_global->mail_stream,mn_m2raw(msgmap, i)); + if (mc->seen){ + rule = (RULE_RESULT *) + get_result_rule(ps_global->vars[V_SAVE_RULES].current_val.l, + FOR_RULE | FOR_SAVE, (ENVELOPE *) mc->private.msg.env); + if (rule){ + folder_to_save = cpystr(rule->result); + n = rule->number; + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + + if (folder_to_save && *folder_to_save){ + if (strstr(ps_global->vars[V_SAVE_RULES].current_val.l[n],"_FLAG_") + || (mc->seen && !mc->deleted) || (!mc->valid && mc->searched)) + save_folder = cpystr(folder_to_save); + else + save_folder = NULL; + } + else + if (mc->seen && !mc->deleted) + save_folder = cpystr(dstfldr); + } + + return save_folder; + } + + /*---------------------------------------------------------------------- Move read messages from folder if listed in archive *************** *** 9426,9432 **** ----*/ int ! apply_command(state, stream, msgmap, preloadkeystroke, flags, q_line) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; --- 9710,9716 ---- ----*/ int ! apply_command(state, stream, msgmap, preloadkeystroke, flags, q_line, display) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; *************** *** 9433,9438 **** --- 9717,9723 ---- int preloadkeystroke; int flags; int q_line; + int display; { int i = 8, /* number of static entries in sel_opts3 */ rv = 1, *************** *** 9559,9567 **** collapse_or_expand(state, stream, msgmap, F_ON(F_SLASH_COLL_ENTIRE, ps_global) ? 0L ! : mn_get_cur(msgmap)); break; case ':' : select_thread_stmp(state, stream, msgmap); break; --- 9844,9862 ---- collapse_or_expand(state, stream, msgmap, F_ON(F_SLASH_COLL_ENTIRE, ps_global) ? 0L ! : mn_get_cur(msgmap), ! display); break; + case '[' : + collapse_this_thread(state, stream, msgmap, display, 0); + break; + + case ']' : + expand_this_thread(state, stream, msgmap, display, 0); + break; + + case ':' : select_thread_stmp(state, stream, msgmap); break; *************** *** 10782,10792 **** Returns 0 if it was cancelled, 1 otherwise. ----*/ int ! select_sort(state, ql, sort, rev) struct pine *state; int ql; SortOrder *sort; int *rev; { char prompt[200], tmp[3], *p; int s, i; --- 11077,11088 ---- Returns 0 if it was cancelled, 1 otherwise. ----*/ int ! select_sort(state, ql, sort, rev, thread) struct pine *state; int ql; SortOrder *sort; int *rev; + int thread; { char prompt[200], tmp[3], *p; int s, i; *************** *** 10827,10834 **** sorts[i].ch = tolower((unsigned char)(tmp[0] = *p)); sorts[i].name = cpystr(tmp); ! if(mn_get_sort(state->msgmap) == state->sort_types[i]) ! deefault = sorts[i].rval; } sorts[i].ch = 'r'; --- 11123,11135 ---- sorts[i].ch = tolower((unsigned char)(tmp[0] = *p)); sorts[i].name = cpystr(tmp); ! if (thread){ ! if (state->thread_def_sort == state->sort_types[i]) ! deefault = sorts[i].rval; ! } ! else ! if(mn_get_sort(state->msgmap) == state->sort_types[i]) ! deefault = sorts[i].rval; } sorts[i].ch = 'r'; *************** *** 10840,10847 **** if((s = radio_buttons(prompt,ql,sorts,deefault,'x',help,RB_NORM)) != 'x'){ state->mangled_body = 1; /* signal screen's changed */ ! if(s == 'r') *rev = !mn_get_revsort(state->msgmap); else *sort = state->sort_types[s]; } --- 11141,11151 ---- if((s = radio_buttons(prompt,ql,sorts,deefault,'x',help,RB_NORM)) != 'x'){ state->mangled_body = 1; /* signal screen's changed */ ! if(s == 'r'){ *rev = !mn_get_revsort(state->msgmap); + if (thread) + *sort = state->thread_def_sort; + } else *sort = state->sort_types[s]; } *************** *** 11469,11471 **** --- 11773,12402 ---- return(flag_submenu); } #endif /* _WINDOWS */ + + /* Extra Fancy Thread support */ + + long + top_thread(stream, rawmsgno) + MAILSTREAM *stream; + long rawmsgno; + { + PINETHRD_S *thrd = NULL; + unsigned long rawno; + + if(!stream) + return -1L; + + if(rawmsgno) + thrd = fetch_thread(stream, rawmsgno); + + if(!thrd) + return -1L; + + return F_ON(F_ENHANCED_THREAD, ps_global) + ? (thrd->toploose ? thrd->toploose : thrd->top) + : thrd->top; + } + + void + move_top_thread(stream, msgmap, rawmsgno) + MAILSTREAM *stream; + MSGNO_S *msgmap; + long rawmsgno; + { + mn_set_cur(msgmap,mn_raw2m(msgmap, top_thread(stream, rawmsgno))); + } + + long + top_this_thread(stream, rawmsgno) + MAILSTREAM *stream; + long rawmsgno; + { + PINETHRD_S *thrd = NULL; + unsigned long rawno; + + if(!stream) + return -1L; + + if(rawmsgno) + thrd = fetch_thread(stream, rawmsgno); + + if(!thrd) + return -1L; + + return thrd->top; + } + + void + move_top_this_thread(stream, msgmap, rawmsgno) + MAILSTREAM *stream; + MSGNO_S *msgmap; + long rawmsgno; + { + mn_set_cur(msgmap,mn_raw2m(msgmap, top_this_thread(stream, rawmsgno))); + } + + + void + cmd_delete_this_thread(state, stream, msgmap) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + { + unsigned long rawno, top, save_kolapsed; + PINETHRD_S *thrd = NULL, *nxthrd; + + if(!stream) + return; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_this_thread(stream, msgmap, rawno); + top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return; + + save_kolapsed = this_thread_is_kolapsed(state, stream, msgmap, top); + collapse_this_thread(state, stream, msgmap, 0, 0); + thread_command(state, stream, msgmap, 'd', -FOOTER_ROWS(state), 1); + if (!save_kolapsed) + expand_this_thread(state, stream, msgmap, 0, 0); + } + + void + cmd_delete_thread(state, stream, msgmap) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + { + unsigned long rawno, top, orig_top, topnxt, save_kolapsed; + PINETHRD_S *thrd = NULL, *nxthrd; + int done = 0; + + if(!stream) + return; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_thread(stream, msgmap, rawno); + top = orig_top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return; + + while (!done){ + cmd_delete_this_thread(state, stream, msgmap); + if (F_OFF(F_ENHANCED_THREAD, state) + || (move_next_this_thread(state, stream, msgmap, 0) <= 0) + || !(top = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_top != top_thread(stream, top))) + done++; + } + mn_set_cur(msgmap,mn_raw2m(msgmap, rawno)); + cmd_delete(state, msgmap, 0, MsgIndx); + q_status_message(SM_ORDER, 0, 1, "Thread marked deleted"); + } + + + + int + thread_is_kolapsed(state, stream, msgmap, rawmsgno) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + long rawmsgno; + { + int collapsed; + PINETHRD_S *thrd = NULL; + unsigned long rawno, orig, orig_rawno; + + if(!stream) + return -1; + + orig = mn_get_cur(msgmap); + move_top_thread(stream, msgmap, rawmsgno); + rawno = orig_rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return -1; + + while(collapsed = this_thread_is_kolapsed(state, stream, msgmap, rawno)) + if (F_OFF(F_ENHANCED_THREAD, state) + || (move_next_this_thread(state, stream, msgmap, 0) <= 0) + || !(rawno = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_rawno != top_thread(stream, rawno))) + break; + + mn_set_cur(msgmap,orig); /* return home */ + + return collapsed; + } + + /* this function tells us if the thread (or branch in the case of loose threads) + * is collapsed + */ + + int + this_thread_is_kolapsed(state, stream, msgmap, rawmsgno) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + long rawmsgno; + { + int collapsed; + PINETHRD_S *thrd = NULL, *nthrd = NULL; + unsigned long rawno, orig; + + if(!stream) + return -1; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return -1; + + collapsed = get_lflag(stream, NULL, rawno, MN_COLL | MN_CHID); + + if (!thrd->next){ + if (thrd->rawno != top_thread(stream, thrd->rawno)) + collapsed = get_lflag(stream, NULL, rawno, MN_CHID); + else + collapsed = thrd->flags; + } + + return collapsed; + } + + int + collapse_this_thread(state, stream, msgmap, display, special) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + int special; + { + int collapsed, rv = 1, done = 0; + PINETHRD_S *thrd = NULL, *nthrd; + unsigned long rawno, orig, msgno; + + if(!stream) + return 0; + + /* orig = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_this_thread(stream, msgmap,orig);*/ + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return rv; + + collapsed = this_thread_is_kolapsed(state, stream, msgmap, rawno); + + if (special && collapsed){ + expand_this_thread(state, stream, msgmap, 0, 0); + collapsed = 0; + } + + if (!thrd->next) + collapsed = thrd->flags; + + clear_index_cache_ent(mn_raw2m(msgmap,rawno)); + + if (!collapsed && thrd->next){ + if (thrd->rawno == top_thread(stream, thrd->rawno)) + collapse_or_expand(state, stream, msgmap, mn_get_cur(msgmap), display); + else{ + set_lflag(stream, msgmap, mn_raw2m(msgmap,thrd->rawno), MN_COLL, 1); + set_thread_subtree(stream, thrd, msgmap, 1, MN_CHID); + } + } + else{ + if (!collapsed && special + && ((F_OFF(F_ENHANCED_THREAD, state) && !thrd->next) + || F_ON(F_ENHANCED_THREAD, state))){ + thrd->flags = 1; + if (thrd->toploose && thrd->rawno != thrd->toploose) + set_lflag(stream, msgmap, mn_raw2m(msgmap,thrd->rawno),MN_CHID, 1); + } + else{ + rv = 0; + if (display) + q_status_message(SM_ORDER, 0, 1, "Thread already collapsed"); + } + } + return rv; + } + + int + collapse_thread(state, stream, msgmap, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + { + int collapsed, rv = 1, done = 0; + PINETHRD_S *thrd = NULL; + unsigned long orig, orig_top, top; + + if(!stream) + return 0; + + expand_this_thread(state, stream, msgmap, display, 1); + orig = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_thread(stream, msgmap,orig); + top = orig_top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return 0; + + while (!done){ + collapse_this_thread(state, stream, msgmap, display, 1); + if (F_OFF(F_ENHANCED_THREAD, state) + || (move_next_this_thread(state, stream, msgmap, 0) <= 0) + || !(top = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_top != top_thread(stream, top))) + done++; + } + mn_set_cur(msgmap,mn_raw2m(msgmap, orig_top)); + } + + int + expand_this_thread(state, stream, msgmap, display, special) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + int special; + { + int collapsed, rv = 1, done = 0; + PINETHRD_S *thrd = NULL, *nthrd; + unsigned long rawno, orig, msgno; + + if(!stream) + return 0; + + orig = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_this_thread(stream, msgmap,orig); + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return rv; + + collapsed = this_thread_is_kolapsed(state, stream, msgmap, rawno); + + if (special && !collapsed){ + collapse_this_thread(state, stream, msgmap, 0, 0); + collapsed = 1; + } + + if (!thrd->next) + collapsed = thrd->flags; + + clear_index_cache_ent(mn_raw2m(msgmap,rawno)); + + if (collapsed && thrd->next){ + if (thrd->rawno == top_thread(stream, thrd->rawno)) + collapse_or_expand(state, stream, msgmap, mn_get_cur(msgmap), display); + else{ + set_lflag(stream, msgmap, mn_raw2m(msgmap,thrd->rawno), MN_COLL, 0); + set_thread_subtree(stream, thrd, msgmap, 0, MN_CHID); + } + } + else{ + if (collapsed && special + && ((F_OFF(F_ENHANCED_THREAD, state) && !thrd->next) + || F_ON(F_ENHANCED_THREAD, state))){ + thrd->flags = 0; + if (thrd->toploose && thrd->rawno != thrd->toploose) + set_lflag(stream, msgmap, mn_raw2m(msgmap,thrd->rawno),MN_CHID, 0); + } + else{ + rv = 0; + if (display) + q_status_message(SM_ORDER, 0, 1, "Thread already expanded"); + } + } + return rv; + } + + int + expand_thread(state, stream, msgmap, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + { + int collapsed, rv = 1, done = 0; + PINETHRD_S *thrd = NULL; + unsigned long orig, orig_top, top; + + if(!stream) + return 0; + + orig = mn_m2raw(msgmap, mn_get_cur(msgmap)); + /* move_top_thread(stream, msgmap,orig);*/ + top = orig_top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return 0; + + while (!done){ + expand_this_thread(state, stream, msgmap, display, 1); + if (F_OFF(F_ENHANCED_THREAD, state) + || (move_next_this_thread(state, stream, msgmap, 0) <= 0) + || !(top = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_top != top_thread(stream, top))) + done++; + } + mn_set_cur(msgmap,mn_raw2m(msgmap, orig_top)); + } + + + void + cmd_undelete_this_thread(state, stream, msgmap) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + { + unsigned long rawno; + int save_kolapsed; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + save_kolapsed = this_thread_is_kolapsed(state, stream, msgmap, rawno); + collapse_this_thread(state, stream, msgmap, 0, 0); + thread_command(state, stream, msgmap, 'u', -FOOTER_ROWS(state), 1); + if (!save_kolapsed) + expand_this_thread(state, stream, msgmap, 0, 0); + } + + void + cmd_undelete_thread(state, stream, msgmap) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + { + PINETHRD_S *thrd = NULL; + unsigned long rawno, top, orig_top; + int done = 0; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_thread(stream, msgmap, rawno); + top = orig_top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return; + + while (!done){ + cmd_undelete_this_thread(state, stream, msgmap); + if (F_OFF(F_ENHANCED_THREAD, state) + || (move_next_this_thread(state, stream, msgmap, 0) <= 0) + || !(top = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_top != top_thread(stream, top))) + done++; + } + mn_set_cur(msgmap,mn_raw2m(msgmap, rawno)); + q_status_message(SM_ORDER, 0, 1, "Thread undeleted"); + } + + void + kolapse_thread(state, stream, msgmap, ch, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + char ch; + int display; + { + PINETHRD_S *thrd = NULL; + unsigned long rawno; + int rv = 1, done = 0; + + if(!stream) + return; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return; + + clear_index_cache(); + mn_set_cur(msgmap,1); /* go to the first message */ + while (!done){ + if (ch == '[') + collapse_thread(state, stream, msgmap, display); + else + expand_thread(state, stream, msgmap, display); + if ((rv = move_next_thread(state, stream, msgmap, 0)) <= 0) + done++; + } + + if (rv < 0){ + if (display) + q_status_message(SM_ORDER, 0, 1, (ch == '[') + ? "Error while collapsing thread" + : "Error while expanding thread"); + } + else + if(display) + q_status_message(SM_ORDER, 0, 1, (ch == '[') + ? "All threads collapsed. Use \"}\" to expand them" + : "All threads expanded. Use \"{\" to collapse them"); + + mn_set_cur(msgmap,mn_raw2m(msgmap, top_thread(stream,rawno))); + } + + int + move_next_this_thread(state, stream, msgmap, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + { + PINETHRD_S *thrd = NULL, *thrdnxt; + unsigned long rawno, top; + int rv = 1; + + if(!stream) + return -1; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return -1; + + top = top_thread(stream, rawno); + + thrdnxt = (top == rawno) ? fetch_thread(stream, top) : thrd; + if (thrdnxt->nextthd) + mn_set_cur(msgmap,mn_raw2m(msgmap, thrdnxt->nextthd)); + else{ + rv = 0; + if (display) + q_status_message(SM_ORDER, 0, 1, "No more Threads to advance"); + } + return rv; + } + + int + move_next_thread(state, stream, msgmap, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + { + int collapsed, rv = 1, done = 0; + PINETHRD_S *thrd = NULL; + unsigned long orig, orig_top, top; + + if(!stream) + return 0; + + orig = mn_m2raw(msgmap, mn_get_cur(msgmap)); + move_top_thread(stream, msgmap,orig); + top = orig_top = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + if(top) + thrd = fetch_thread(stream, top); + + if(!thrd) + return 0; + + while (rv > 0 && !done){ + rv = move_next_this_thread(state, stream, msgmap, display); + if (F_OFF(F_ENHANCED_THREAD, state) + || !(top = mn_m2raw(msgmap, mn_get_cur(msgmap))) + || (orig_top != top_thread(stream, top))) + done++; + } + if (display){ + if (rv > 0 && SEP_THRDINDX()) + q_status_message(SM_ORDER, 0, 2, "Viewing next thread"); + if (!rv) + q_status_message(SM_ORDER, 0, 2, "No more threads to advance"); + } + if(rv <= 0){ + rv = 0; + mn_set_cur(msgmap, mn_raw2m(msgmap, orig)); + } + + return rv; + } + + int + move_prev_thread(state, stream, msgmap, display) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int display; + { + PINETHRD_S *thrd = NULL; + unsigned long rawno, top; + int rv = 1; + + if(!stream) + return -1; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + if(rawno) + thrd = fetch_thread(stream, rawno); + + if(!thrd) + return -1; + + top = top_thread(stream, rawno); + + if (top != rawno) + mn_set_cur(msgmap,mn_raw2m(msgmap, top)); + else if (thrd->prevthd) + mn_set_cur(msgmap,mn_raw2m(msgmap, top_thread(stream,thrd->prevthd))); + else + rv = 0; + if (display){ + if (rv && SEP_THRDINDX()) + q_status_message(SM_ORDER, 0, 2, "Viewing previous thread"); + if (!rv) + q_status_message(SM_ORDER, 0, 2, "No more threads to go back"); + } + + return rv; + } + + void + cmd_select_thread(state, stream, msgmap) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + { + unsigned long rawno; + int save_kolapsed; + + rawno = mn_m2raw(msgmap, mn_get_cur(msgmap)); + save_kolapsed = thread_is_kolapsed(state, stream, msgmap, rawno); + collapse_thread(state, stream, msgmap, 0); + thread_command(state, stream, msgmap, ':', -FOOTER_ROWS(state), 1); + if (!save_kolapsed) + expand_thread(state, stream, msgmap, 0); + } diff -rc pine4.52/pine/mailindx.c pine4.52.I.USE/pine/mailindx.c *** pine4.52/pine/mailindx.c Wed Dec 18 14:18:23 2002 --- pine4.52.I.USE/pine/mailindx.c Tue Jan 14 13:13:47 2003 *************** *** 110,120 **** {"Z","ZoomMode",{MC_ZOOM,1,{'z'}},KS_ZOOM}, LISTFLD_MENU, RCOMPOSE_MENU, NULL_MENU, - NULL_MENU, - NULL_MENU, {"/","Collapse/Expand",{MC_COLLAPSE,1,{'/'}},KS_NONE}, NULL_MENU, NULL_MENU}; INST_KEY_MENU(index_keymenu, index_keys); #define BACK_KEY 2 --- 110,133 ---- {"Z","ZoomMode",{MC_ZOOM,1,{'z'}},KS_ZOOM}, LISTFLD_MENU, RCOMPOSE_MENU, + {"{","Collapse All",{MC_KOLAPSE,1,{'{'}},KS_NONE}, + {"}","Expand All", {MC_EXPTHREAD,1,{'}'}},KS_NONE}, NULL_MENU, {"/","Collapse/Expand",{MC_COLLAPSE,1,{'/'}},KS_NONE}, NULL_MENU, + {"K","Sort Thread",{MC_SORTHREAD,1,{'k'}},KS_NONE}, + + HELP_MENU, + OTHER_MENU, + {")","Next Threa",{MC_NEXTHREAD,1,{')'}},KS_NONE}, + {"(","Prev Threa",{MC_PRETHREAD,1,{'('}},KS_NONE}, + {"^D","Delete Thr",{MC_DELTHREAD,1,{ctrl('D')}},KS_NONE}, + {"^U","Undel Thre",{MC_UNDTHREAD,1,{ctrl('U')}},KS_NONE}, + {"^T","Select Thr",{MC_SELTHREAD,1,{ctrl('T')}},KS_NONE}, + NULL_MENU, + {"[","Close Thre",{MC_CTHREAD,1,{'['}},KS_NONE}, + {"]","Open Threa",{MC_OTHREAD,1,{']'}},KS_NONE}, + {"^H","ChkIncFl",{MC_FORCECHECK,1,{ctrl('H')}},KS_NONE}, NULL_MENU}; INST_KEY_MENU(index_keymenu, index_keys); #define BACK_KEY 2 *************** *** 195,205 **** {"Z","ZoomMode",{MC_ZOOM,1,{'z'}},KS_ZOOM}, LISTFLD_MENU, RCOMPOSE_MENU, NULL_MENU, NULL_MENU, NULL_MENU, ! {"/","Collapse/Expand",{MC_COLLAPSE,1,{'/'}},KS_NONE}, NULL_MENU, NULL_MENU}; INST_KEY_MENU(thread_keymenu, thread_keys); --- 208,231 ---- {"Z","ZoomMode",{MC_ZOOM,1,{'z'}},KS_ZOOM}, LISTFLD_MENU, RCOMPOSE_MENU, + {"^H","ChkIncFl",{MC_FORCECHECK,1,{ctrl('H')}},KS_NONE}, + {"]","Open Threa",{MC_OTHREAD,1,{']'}},KS_NONE}, NULL_MENU, + {"/","Collapse/Expand",{MC_COLLAPSE,1,{'/'}},KS_NONE}, + {")","Next Threa",{MC_NEXTHREAD,1,{')'}},KS_NONE}, + {"(","Prev Threa",{MC_PRETHREAD,1,{'('}},KS_NONE}, + + HELP_MENU, + OTHER_MENU, NULL_MENU, NULL_MENU, ! {"^D","Delete Thr",{MC_DELTHREAD,1,{ctrl('D')}},KS_NONE}, ! {"^U","Undel Thre",{MC_UNDTHREAD,1,{ctrl('U')}},KS_NONE}, ! {"^T","Select Thr",{MC_SELTHREAD,1,{ctrl('T')}},KS_NONE}, NULL_MENU, + NULL_MENU, + NULL_MENU, + {"K","Sort Thread",{MC_SORTHREAD,1,{'k'}},KS_NONE}, NULL_MENU}; INST_KEY_MENU(thread_keymenu, thread_keys); *************** *** 325,330 **** --- 351,360 ---- /* * Internal prototypes */ + SortOrder translate PROTO ((char *)); + ENVELOPE *make_envelope PROTO ((INDEXDATA_S *, int)); + char *find_value PROTO ((char *,char *, int, char *, int, char *, int, INDEXDATA_S *, char **)); + int find_index_rule PROTO(()); void index_index_screen PROTO((struct pine *)); void thread_index_screen PROTO((struct pine *)); void setup_for_index_index_screen PROTO((void)); *************** *** 350,355 **** --- 380,393 ---- void index_data_env PROTO((INDEXDATA_S *, ENVELOPE *)); int set_index_addr PROTO((INDEXDATA_S *, char *, ADDRESS *, char *, int, char *)); + unsigned long get_next PROTO((MAILSTREAM *,PINETHRD_S *)); + unsigned long get_branch PROTO((MAILSTREAM *,PINETHRD_S *)); + long get_length_branch PROTO((MAILSTREAM *, long)); + THREADNODE *copy_tree PROTO((THREADNODE *)); + void find_msgmap PROTO((MAILSTREAM *, MSGNO_S *, int, SortOrder, + unsigned)); + void move_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); + void relink_threads PROTO((MAILSTREAM *, MSGNO_S *, long *)); int i_cache_size PROTO((long)); int i_cache_width PROTO(()); int ctype_is_fixed_length PROTO((IndexColType)); *************** *** 390,399 **** struct pass_along *sort_thread_flatten PROTO((THREADNODE *, MAILSTREAM *, struct pass_along *, ! PINETHRD_S *, unsigned)); void make_thrdflags_consistent PROTO((MAILSTREAM *, MSGNO_S *, PINETHRD_S *, int)); THREADNODE *collapse_threadnode_tree PROTO((THREADNODE *)); PINETHRD_S *msgno_thread_info PROTO((MAILSTREAM *, unsigned long, PINETHRD_S *, unsigned)); long calculate_visible_threads PROTO((MAILSTREAM *)); --- 428,439 ---- struct pass_along *sort_thread_flatten PROTO((THREADNODE *, MAILSTREAM *, struct pass_along *, ! PINETHRD_S *, unsigned, int, ! long,long)); void make_thrdflags_consistent PROTO((MAILSTREAM *, MSGNO_S *, PINETHRD_S *, int)); THREADNODE *collapse_threadnode_tree PROTO((THREADNODE *)); + THREADNODE *copy_tree PROTO((THREADNODE *)); PINETHRD_S *msgno_thread_info PROTO((MAILSTREAM *, unsigned long, PINETHRD_S *, unsigned)); long calculate_visible_threads PROTO((MAILSTREAM *)); *************** *** 400,406 **** void set_thread_subtree PROTO((MAILSTREAM *, PINETHRD_S *, MSGNO_S *, int, int)); void thread_command PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, ! int, int)); void set_flags_for_thread PROTO((MAILSTREAM *, MSGNO_S *, int, PINETHRD_S *, int)); unsigned long count_flags_in_thread PROTO((MAILSTREAM *, PINETHRD_S *, long)); --- 440,446 ---- void set_thread_subtree PROTO((MAILSTREAM *, PINETHRD_S *, MSGNO_S *, int, int)); void thread_command PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, ! int, int, int)); void set_flags_for_thread PROTO((MAILSTREAM *, MSGNO_S *, int, PINETHRD_S *, int)); unsigned long count_flags_in_thread PROTO((MAILSTREAM *, PINETHRD_S *, long)); *************** *** 594,599 **** --- 634,640 ---- return; } + state->redrawer = redraw_index_body; state->prev_screen = mail_index_screen; state->next_screen = SCREEN_FUN_NULL; *************** *** 715,726 **** IndexType style, old_style = MsgIndex; struct index_state id; struct key_menu *km = NULL; #if defined(DOS) || defined(OS2) extern void (*while_waiting)(); #endif dprint(1, (debugfile, "\n\n ---- INDEX MANAGER ----\n")); ! ch = 'x'; /* For displaying msg 1st time thru */ force = 0; km_popped = 0; --- 756,785 ---- IndexType style, old_style = MsgIndex; struct index_state id; struct key_menu *km = NULL; + time_t now, last, old = time(0); + int first_time = 1, old_cmd; + char *begin_string; #if defined(DOS) || defined(OS2) extern void (*while_waiting)(); #endif dprint(1, (debugfile, "\n\n ---- INDEX MANAGER ----\n")); ! last = old; ! if ((!ps_global->done) && (ps_global->last_message) && ! (cntxt) && (!cntxt->prev) && ! (folder_in_message_list(folder))){ ! ps_global->number_of_folders -= 1; ! ps_global->done = TRUE; ! } ! if ((ps_global->last_message) && (cntxt) && (!cntxt->prev) && ! (begin_string = strstr(state->last_message,folder_in_list(folder)))){ ! int index = 0, length_folder = strlen(folder_in_list(folder)); ! while (begin_string[index + length_folder] != '\0'){ ! begin_string[index] = begin_string[index + length_folder]; ! index++; ! } ! begin_string[index] = '\0'; ! } ch = 'x'; /* For displaying msg 1st time thru */ force = 0; km_popped = 0; *************** *** 732,738 **** id.msgmap = msgmap; if(msgmap->top != 0L) id.msg_at_top = msgmap->top; ! if((id.stream = stream) != state->mail_stream) clear_index_cache(); /* BUG: should better tie stream to cache */ --- 791,797 ---- id.msgmap = msgmap; if(msgmap->top != 0L) id.msg_at_top = msgmap->top; ! if((id.stream = stream) != state->mail_stream) clear_index_cache(); /* BUG: should better tie stream to cache */ *************** *** 756,763 **** /*------- Check for new mail -------*/ new_mail(force, NM_TIMING(ch), NM_STATUS_MSG); force = 0; /* may not need to next time around */ - /* * If the width of the message number field in the display changes * we need to flush the cache and redraw. When the cache is cleared --- 815,836 ---- /*------- Check for new mail -------*/ new_mail(force, NM_TIMING(ch), NM_STATUS_MSG); + if (F_ON(F_ENABLE_INCOMING,ps_global) && + F_ON(F_ENABLE_INCOMING_CHECK,ps_global)){ + now = time(0); + if ((first_time == 1) && !strucmp(state->cur_folder,state->inbox_name)){ + new_mail_incfolder(state,MC_IFAUTOCHECK); + ps_global->delay = time(0) - now + 1; + first_time = 2; + } + now = time(0); + if (((now - old) > timeo*ps_global->delay) && (now - last > 1)){ + new_mail_incfolder(state,MC_IFAUTOCHECK); + ps_global->delay = time(0) - now + 1; + old = time(0); + } + } force = 0; /* may not need to next time around */ /* * If the width of the message number field in the display changes * we need to flush the cache and redraw. When the cache is cleared *************** *** 924,929 **** --- 997,1003 ---- #endif #endif ch = read_command(); + last = now = time(0); #ifdef MOUSE clear_mfunc(mouse_in_content); #endif *************** *** 967,972 **** --- 1041,1047 ---- /*---------- Scroll line up ----------*/ case MC_CHARUP : + previtem: (void) process_cmd(state, stream, msgmap, MC_PREVITEM, (style == MsgIndex || style == MultiMsgIndex *************** *** 984,989 **** --- 1059,1065 ---- /*---------- Scroll line down ----------*/ case MC_CHARDOWN : + nextitem: /* * Special Page framing handling here. If we * did something that should scroll-by-a-line, frame *************** *** 1158,1163 **** --- 1234,1240 ---- case MC_THRDINDX : + mc_thrdindx: msgmap->top = msgmap->top_after_thrd; if(unview_thread(state, stream, msgmap)){ ps_global->redrawer = NULL; *************** *** 1207,1213 **** && mp.col == id.plus_col && style != ThreadIndex){ collapse_or_expand(state, stream, msgmap, ! mn_get_cur(msgmap)); } else if (mp.doubleclick){ if(mp.button == M_BUTTON_LEFT){ --- 1284,1290 ---- && mp.col == id.plus_col && style != ThreadIndex){ collapse_or_expand(state, stream, msgmap, ! mn_get_cur(msgmap), 1); } else if (mp.doubleclick){ if(mp.button == M_BUTTON_LEFT){ *************** *** 1280,1285 **** --- 1357,1363 ---- /*---------- Redraw ----------*/ case MC_REPAINT : + first_time++; force = 1; /* check for new mail! */ reset_index_border(); break; *************** *** 1287,1292 **** --- 1365,1371 ---- /*---------- No op command ----------*/ case MC_NONE : + last = now - 2; break; /* no op check for new mail */ *************** *** 1301,1309 **** case MC_COLLAPSE : ! thread_command(state, stream, msgmap, ch, -FOOTER_ROWS(state)); break; case MC_DELETE : case MC_UNDELETE : case MC_REPLY : --- 1380,1485 ---- case MC_COLLAPSE : ! thread_command(state, stream, msgmap, ch, -FOOTER_ROWS(state), 1); break; + case MC_CTHREAD : + if (SEP_THRDINDX()) + goto mc_thrdindx; + else + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, + "to collapse a thread")) + collapse_thread(state, stream,msgmap, 1); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_OTHREAD : + if (SEP_THRDINDX()) + goto view_a_thread; + else + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to expand a thread")) + expand_thread(state, stream,msgmap, 1); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_NEXTHREAD: + case MC_PRETHREAD: + if (THRD_INDX()){ + if (cmd == MC_NEXTHREAD) + goto nextitem; + else + goto previtem; + } + else + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, + "to move to other thread")) + move_thread(state, stream, msgmap, + cmd == MC_NEXTHREAD ? 1 : -1); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_KOLAPSE: + case MC_EXPTHREAD: + if (SEP_THRDINDX()){ + q_status_message(SM_ORDER, 0, 1, + "Command not available in this screen"); + } + else{ + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, + cmd == MC_KOLAPSE ? "to collapse" : "to expand")) + kolapse_thread(state, stream, msgmap, + (cmd == MC_KOLAPSE) ? '[' : ']', 1); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + } + break; + + case MC_DELTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to delete")) + cmd_delete_thread(state, stream, msgmap); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_UNDTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to undelete")) + cmd_undelete_thread(state, stream, msgmap); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + + case MC_SELTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to undelete")) + cmd_select_thread(state, stream, msgmap); + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + case MC_DELETE : case MC_UNDELETE : case MC_REPLY : *************** *** 1324,1336 **** if(rawno) thrd = fetch_thread(stream, rawno); ! collapsed = thrd && thrd->next ! && get_lflag(stream, NULL, rawno, MN_COLL); } if(collapsed){ thread_command(state, stream, msgmap, ! ch, -FOOTER_ROWS(state)); /* increment current */ if(cmd == MC_DELETE){ advance_cur_after_delete(state, stream, msgmap, --- 1500,1511 ---- if(rawno) thrd = fetch_thread(stream, rawno); ! collapsed = thread_is_kolapsed(ps_global, stream, msgmap, rawno); } if(collapsed){ thread_command(state, stream, msgmap, ! ch, -FOOTER_ROWS(state),1); /* increment current */ if(cmd == MC_DELETE){ advance_cur_after_delete(state, stream, msgmap, *************** *** 1369,1375 **** } /* else fall thru to normal default */ ! /*---------- Default -- all other command ----------*/ default: do_the_default: --- 1544,1553 ---- } /* else fall thru to normal default */ ! case MC_TAB: ! old = now = time(0); ! /* do not check for new mail in inc fldrs and fall through */ ! /*---------- Default -- all other command ----------*/ default: do_the_default: *************** *** 1744,1756 **** } while(thrd && thrd != topthrd){ if(!msgline_hidden(screen->stream, screen->msgmap, mn_raw2m(screen->msgmap,thrd->rawno), 0)) x += xdir; ! if(thrddir > 0 && thrd->nextthd) ! thrd = fetch_thread(screen->stream, thrd->nextthd); else if(thrddir < 0 && thrd->prevthd) thrd = fetch_thread(screen->stream, thrd->prevthd); else --- 1922,1935 ---- } while(thrd && thrd != topthrd){ + unsigned long branch; if(!msgline_hidden(screen->stream, screen->msgmap, mn_raw2m(screen->msgmap,thrd->rawno), 0)) x += xdir; ! if(thrddir > 0 && (branch = get_branch(screen->stream, thrd))) ! thrd = fetch_thread(screen->stream, branch); else if(thrddir < 0 && thrd->prevthd) thrd = fetch_thread(screen->stream, thrd->prevthd); else *************** *** 2610,2615 **** --- 2789,2795 ---- n = mn_raw2m(msgs, thrd->rawno); while(thrd){ + unsigned long branch; if(!msgline_hidden(stream, msgs, n, 0) && (++m % lines_per_page) == 1L) t = n; *************** *** 2619,2626 **** if(mn_get_revsort(msgs) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgs) && thrd->nextthd) ! thrd = fetch_thread(stream, thrd->nextthd); else thrd = NULL; --- 2799,2807 ---- if(mn_get_revsort(msgs) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgs) && ! (branch = get_branch(stream, thrd))) ! thrd = fetch_thread(stream, branch); else thrd = NULL; *************** *** 2642,2650 **** * forward through the thread. */ while(thrd && m < thrd->thrdno){ n = thrd->rawno; ! if(mn_get_revsort(msgs) && thrd->nextthd) ! thrd = fetch_thread(stream, thrd->nextthd); else if(!mn_get_revsort(msgs) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); else --- 2823,2833 ---- * forward through the thread. */ while(thrd && m < thrd->thrdno){ + unsigned long branch; n = thrd->rawno; ! if(mn_get_revsort(msgs) && ! (branch = get_branch(stream, thrd))) ! thrd = fetch_thread(stream, branch); else if(!mn_get_revsort(msgs) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); else *************** *** 2678,2688 **** /* n is the end of this thread */ while(thrd){ n = mn_raw2m(msgs, thrd->rawno); ! if(thrd->branch) ! thrd = fetch_thread(stream, thrd->branch); ! else if(thrd->next) ! thrd = fetch_thread(stream, thrd->next); else thrd = NULL; } --- 2861,2872 ---- /* n is the end of this thread */ while(thrd){ + unsigned long next = 0L, branch = 0L; n = mn_raw2m(msgs, thrd->rawno); ! if(branch = get_branch(stream,thrd)) ! thrd = fetch_thread(stream, branch); ! else if(next = get_next(stream,thrd)) ! thrd = fetch_thread(stream, next); else thrd = NULL; } *************** *** 2835,2840 **** --- 3019,3025 ---- case iSTime: case iKSize: case iSize: + case iSizeThread: (*answer)[column].req_width = 7; break; case iS1Date: *************** *** 2876,2884 **** {"FROMORTONOTNEWS", iFromToNotNews, FOR_INDEX}, {"SIZE", iSize, FOR_INDEX}, {"SIZECOMMA", iSizeComma, FOR_INDEX}, {"SIZENARROW", iSizeNarrow, FOR_INDEX}, {"KSIZE", iKSize, FOR_INDEX}, ! {"SUBJECT", iSubject, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"FULLSTATUS", iFStatus, FOR_INDEX}, {"IMAPSTATUS", iIStatus, FOR_INDEX}, {"DESCRIPSIZE", iDescripSize, FOR_INDEX}, --- 3061,3070 ---- {"FROMORTONOTNEWS", iFromToNotNews, FOR_INDEX}, {"SIZE", iSize, FOR_INDEX}, {"SIZECOMMA", iSizeComma, FOR_INDEX}, + {"SIZETHREAD", iSizeThread, FOR_INDEX}, {"SIZENARROW", iSizeNarrow, FOR_INDEX}, {"KSIZE", iKSize, FOR_INDEX}, ! {"SUBJECT", iSubject, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_RULE|FOR_SAVE|FOR_TRIM}, {"FULLSTATUS", iFStatus, FOR_INDEX}, {"IMAPSTATUS", iIStatus, FOR_INDEX}, {"DESCRIPSIZE", iDescripSize, FOR_INDEX}, *************** *** 2900,2911 **** {"MONTHABBREV", iMonAbb, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"DAYOFWEEKABBREV", iDayOfWeekAbb, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"DAYOFWEEK", iDayOfWeek, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"FROM", iFrom, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"TO", iTo, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"SENDER", iSender, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"CC", iCc, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"RECIPS", iRecips, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"NEWS", iNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"TOANDNEWS", iToAndNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"NEWSANDTO", iNewsAndTo, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"RECIPSANDNEWS", iRecipsAndNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, --- 3086,3098 ---- {"MONTHABBREV", iMonAbb, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"DAYOFWEEKABBREV", iDayOfWeekAbb, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"DAYOFWEEK", iDayOfWeek, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"FROM", iFrom, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_SAVE|FOR_RULE|FOR_COMPOSE}, ! {"TO", iTo, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_SAVE|FOR_RULE|FOR_COMPOSE}, ! {"SENDER", iSender, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_SAVE|FOR_RULE}, ! {"CC", iCc, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_SAVE|FOR_RULE}, ! {"ADDRESSTO", iAddressTo, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_SAVE|FOR_RULE}, {"RECIPS", iRecips, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"NEWS", iNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_RULE}, {"TOANDNEWS", iToAndNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"NEWSANDTO", iNewsAndTo, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"RECIPSANDNEWS", iRecipsAndNews, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, *************** *** 2920,2926 **** {"MONTH2DIGIT", iMon2Digit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"YEAR", iYear, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"YEAR2DIGIT", iYear2Digit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"ADDRESS", iAddress, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"MAILBOX", iMailbox, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"INIT", iInit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"CURDATE", iCurDate, FOR_REPLY_INTRO|FOR_TEMPLATE}, --- 3107,3113 ---- {"MONTH2DIGIT", iMon2Digit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"YEAR", iYear, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"YEAR2DIGIT", iYear2Digit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, ! {"ADDRESS", iAddress, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE|FOR_RULE}, {"MAILBOX", iMailbox, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"INIT", iInit, FOR_INDEX|FOR_REPLY_INTRO|FOR_TEMPLATE}, {"CURDATE", iCurDate, FOR_REPLY_INTRO|FOR_TEMPLATE}, *************** *** 2929,2934 **** --- 3116,3130 ---- {"CURTIME24", iCurTime24, FOR_REPLY_INTRO|FOR_TEMPLATE}, {"CURTIME12", iCurTime12, FOR_REPLY_INTRO|FOR_TEMPLATE}, {"CURSORPOS", iCursorPos, FOR_TEMPLATE}, + {"NICK", iNick, FOR_RULE|FOR_SAVE}, + {"FOLDER", iFolder, FOR_RULE|FOR_SAVE|FOR_FOLDER}, + {"ROLE", iRole, FOR_RULE| FOR_RESUB | FOR_TRIM}, + {"FLAG", iFlag, FOR_RULE|FOR_SAVE|FOR_FLAG}, + {"COLLECTION", iCollection, FOR_RULE|FOR_SAVE|FOR_COMPOSE|FOR_FOLDER}, + {"BCC", iBcc, FOR_COMPOSE|FOR_RULE}, + {"LCC", iLcc, FOR_COMPOSE|FOR_RULE}, + {"FORWARDFROM", iFfrom, FOR_COMPOSE|FOR_RULE}, + {"FORWARDADDRESS", iFadd, FOR_COMPOSE|FOR_RULE}, {NULL, iNothing, FOR_NOTHING} }; *************** *** 3095,3101 **** */ static IndexColType fixed_ctypes[] = { iMessNo, iStatus, iFStatus, iIStatus, iDate, iSDate, iSDateTime, ! iSTime, iLDate, iS1Date, iS2Date, iS3Date, iS4Date, iDateIso, iDateIsoS, iSize, iSizeComma, iSizeNarrow, iKSize, iDescripSize, iAtt, iTime24, iTime12, iTimezone, iMonAbb, iYear, iYear2Digit, --- 3291,3297 ---- */ static IndexColType fixed_ctypes[] = { iMessNo, iStatus, iFStatus, iIStatus, iDate, iSDate, iSDateTime, ! iSTime, iLDate, iSizeThread, iS1Date, iS2Date, iS3Date, iS4Date, iDateIso, iDateIsoS, iSize, iSizeComma, iSizeNarrow, iKSize, iDescripSize, iAtt, iTime24, iTime12, iTimezone, iMonAbb, iYear, iYear2Digit, *************** *** 3253,3258 **** --- 3449,3455 ---- case iTime12: case iSize: case iKSize: + case iSizeThread: cdesc->actual_length = 7; cdesc->adjustment = Right; break; *************** *** 3314,3320 **** cdesc->ctype != iNothing; cdesc++) if(cdesc->ctype == iSize || cdesc->ctype == iKSize || ! cdesc->ctype == iSizeNarrow || cdesc->ctype == iSizeComma || cdesc->ctype == iDescripSize){ if(cdesc->actual_length == 0){ if((fix=cdesc->width) > 0){ /* had this reserved */ --- 3511,3517 ---- cdesc->ctype != iNothing; cdesc++) if(cdesc->ctype == iSize || cdesc->ctype == iKSize || ! cdesc->ctype == iSizeNarrow || cdesc->ctype == iSizeThread || cdesc->ctype == iSizeComma || cdesc->ctype == iDescripSize){ if(cdesc->actual_length == 0){ if((fix=cdesc->width) > 0){ /* had this reserved */ *************** *** 3574,3580 **** --- 3771,3865 ---- } } + ENVELOPE *make_envelope(idata, index) + INDEXDATA_S *idata; + int index; + { + ENVELOPE *result; + result = mail_newenvelope(); + + result->from = rfc822_cpy_adr(idata->from); + result->to = rfc822_cpy_adr(idata->to); + result->cc = rfc822_cpy_adr(idata->cc); + result->sender = rfc822_cpy_adr(idata->sender); + result->subject = cpystr(idata->subject); + result->newsgroups = index ? cpystr(idata->newsgroups) : + IS_NEWS(idata->stream) ? cpystr(ps_global->cur_folder) + : NULL; + return result; + } + + /*--------------------------------- + + -----------*/ + + char *find_value(token,function1, context1, function2, context2, function3, context3, idata, rule) + char *token; + char *function1; + int context1; + char *function2; + int context2; + char *function3; + int context3; + INDEXDATA_S *idata; + char **rule; + { int n = 0, we_cancel = FALSE, next_step = FALSE; + char *rule_result; + int rule_context; + char *rule_data; + char *rule_data_backup; + + if (rule && *rule){ + rule_context = FOR_RULE; + while (!we_cancel && rule[n] && *rule[n]){ + rule_data = cpystr(rule[n++]); + rule_data_backup = strstr(rule_data,"=>"); + if (rule_data_backup){ + if (rule_data_backup = strstr(rule_data_backup,token)) + rule_data_backup += strlen(token); + if (rule_data_backup && strstr(rule_data_backup,":=")) + rule_data_backup += strlen(":="); + if (context1){ + if (rule_data_backup && strstr(rule_data_backup,function1)){ + rule_context |= context1; + next_step = TRUE; + } + } + if (context2){ + if (rule_data_backup && strstr(rule_data_backup,function2)){ + rule_context |= context2; + next_step = TRUE; + } + } + if (context3){ + if (rule_data_backup && strstr(rule_data_backup,function3)){ + rule_context |= context3; + next_step = TRUE; + } + } + } + if (next_step){ + ENVELOPE *local_env = make_envelope(idata,1); + next_step = FALSE; + rule_result = (char *) + process_rule(rule_data, rule_context, local_env); + if (local_env) + mail_free_envelope(&local_env); + if (rule_result) + we_cancel = TRUE; + } + if (rule_data) + fs_give((void **)&rule_data); + } + } + if (!we_cancel) + return NULL; + else + return rule_result; + } + + /*---------------------------------------------------------------------- Create a string summarizing the message header for index on screen *************** *** 3701,3710 **** /* find next thread which is visible */ do{ if(mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgmap) && thrd->nextthd) ! thrd = fetch_thread(stream, thrd->nextthd); else thrd = NULL; } while(thrd --- 3986,3996 ---- /* find next thread which is visible */ do{ + unsigned long branch; if(mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgmap) && thrd->branch) ! thrd = fetch_thread(stream, thrd->branch); else thrd = NULL; } while(thrd *************** *** 4158,4168 **** hline = get_index_cache(idata->msgno); /* is this a collapsed thread index line? */ if(!idata->bogus && THREADING()){ ! thrd = fetch_thread(idata->stream, idata->rawno); ! collapsed = thrd && thrd->next ! && get_lflag(idata->stream, NULL, ! idata->rawno, MN_COLL); } /* calculate contents of the required fields */ --- 4444,4452 ---- hline = get_index_cache(idata->msgno); /* is this a collapsed thread index line? */ + thrd = fetch_thread(idata->stream, idata->rawno); if(!idata->bogus && THREADING()){ ! collapsed = thread_is_kolapsed(ps_global, idata->stream, ps_global->msgmap, idata->rawno); } /* calculate contents of the required fields */ *************** *** 4243,4249 **** else if(str[2] == 'N') new_off = status_offset + 2; } - break; case iFStatus: --- 4527,4532 ---- *************** *** 4518,4524 **** --- 4801,4831 ---- break; + case iSizeThread: + if (!THREADING()){ + goto getsize; + } else if (collapsed){ + l = count_flags_in_thread(idata->stream, thrd, F_NONE); + sprintf(str, "(%lu)", l); + } + else{ + thrd = fetch_thread(idata->stream, idata->rawno); + if(!thrd) + sprintf(str,"Error"); + else{ + long lengthb; + lengthb = get_length_branch(idata->stream, idata->rawno); + + if (lengthb > 0L) + sprintf(str,"(%lu)", lengthb); + else + sprintf(str," "); + } + } + break; + case iSize: + getsize: /* 0 ... 9999 */ if((l = fetch_size(idata)) < 10*1000L) sprintf(str, "(%lu)", l); *************** *** 4541,4547 **** } else strcpy(str, "(HUGE!)"); - break; case iSizeComma: --- 4848,4853 ---- *************** *** 6416,6424 **** PINETHRD_S *thd, *thdorig; HLINE_S *hline; unsigned long rawno; memset(str, 0, (width+1) * sizeof(*str)); ! if(subject = fetch_subject(idata)){ if(THREADING() && (ps_global->thread_disp_style == THREAD_STRUCT || ps_global->thread_disp_style == THREAD_MUTTLIKE --- 6722,6738 ---- PINETHRD_S *thd, *thdorig; HLINE_S *hline; unsigned long rawno; + char *rule_result; memset(str, 0, (width+1) * sizeof(*str)); ! rule_result = find_value("_SUBJECT_","_REPLACE_",FOR_REPLACE, "_TRIM_",FOR_TRIM, "_REXTRIM_", FOR_TRIM, idata,ps_global->vars[V_REPLACE_RULES].current_val.l); ! if (rule_result){ ! subject = cpystr(rule_result); ! fs_give((void **)&rule_result); ! } ! else ! subject = fetch_subject(idata); ! if(subject){ if(THREADING() && (ps_global->thread_disp_style == THREAD_STRUCT || ps_global->thread_disp_style == THREAD_MUTTLIKE *************** *** 6427,6434 **** thdorig = thd = fetch_thread(idata->stream, idata->rawno); border = str + width; if(current_index_state->plus_col >= 0 && !THRD_INDX()){ ! collapsed = thd && thd->next && ! get_lflag(idata->stream, NULL, idata->rawno, MN_COLL); hline = get_index_cache(idata->msgno); hline->plus = collapsed ? ps_global->VAR_THREAD_MORE_CHAR[0] : (thd && thd->next) --- 6741,6748 ---- thdorig = thd = fetch_thread(idata->stream, idata->rawno); border = str + width; if(current_index_state->plus_col >= 0 && !THRD_INDX()){ ! collapsed = thread_is_kolapsed(ps_global, idata->stream, ps_global->msgmap, idata->rawno); ! collapsed = collapsed && thd->next; hline = get_index_cache(idata->msgno); hline->plus = collapsed ? ps_global->VAR_THREAD_MORE_CHAR[0] : (thd && thd->next) *************** *** 6647,6654 **** thdorig = thd = fetch_thread(idata->stream, idata->rawno); border = str + width; if(current_index_state->plus_col >= 0 && !THRD_INDX()){ ! collapsed = thd && thd->next && ! get_lflag(idata->stream, NULL, idata->rawno, MN_COLL); hline = get_index_cache(idata->msgno); hline->plus = collapsed ? ps_global->VAR_THREAD_MORE_CHAR[0] : (thd && thd->next) --- 6961,6968 ---- thdorig = thd = fetch_thread(idata->stream, idata->rawno); border = str + width; if(current_index_state->plus_col >= 0 && !THRD_INDX()){ ! collapsed = thread_is_kolapsed(ps_global, idata->stream, ps_global->msgmap, idata->rawno); ! collapsed = collapsed && thd->next; hline = get_index_cache(idata->msgno); hline->plus = collapsed ? ps_global->VAR_THREAD_MORE_CHAR[0] : (thd && thd->next) *************** *** 6739,6754 **** ? "To" : (addr = fetch_cc(idata)) ? "Cc" ! : NULL)) ! && set_index_addr(idata, field, addr, "To: ", ! width, fptr)) ! break; ! if(ctype == iFromTo && (newsgroups = fetch_newsgroups(idata)) && *newsgroups){ ! sprintf(fptr, "To: %-*.*s", width-4, width-4, ! newsgroups); break; } --- 7053,7082 ---- ? "To" : (addr = fetch_cc(idata)) ? "Cc" ! : NULL))){ ! char *rule_result; ! rule_result = find_value("_FROM_","_REPLACE_",FOR_REPLACE, NULL,0,NULL,0, idata,ps_global->vars[V_REPLACE_RULES].current_val.l); ! if (!rule_result) ! set_index_addr(idata, field, addr, "To: ", ! width, str); ! else{ ! sprintf(str, "%-*.*s", width, width, rule_result); ! fs_give((void **)&rule_result); ! } ! break; ! } if(ctype == iFromTo && (newsgroups = fetch_newsgroups(idata)) && *newsgroups){ ! char *rule_result; ! rule_result = find_value("_FROM_","_REPLACE_",FOR_REPLACE, NULL,0,NULL, 0, idata,ps_global->vars[V_REPLACE_RULES].current_val.l); ! if (!rule_result) ! sprintf(str, "To: %-*.*s", width-4, width-4, ! newsgroups); ! else{ ! sprintf(str, "%-*.*s", width, width, rule_result); ! fs_give((void **)&rule_result); ! } break; } *************** *** 6761,6768 **** break; case iFrom: ! set_index_addr(idata, "From", fetch_from(idata), ! NULL, width, fptr); break; case iAddress: --- 7089,7105 ---- break; case iFrom: ! { char *rule_result; ! rule_result = find_value("_FROM_","_REPLACE_",FOR_REPLACE, "_TRIM_",FOR_TRIM, "_REXTRIM_",FOR_TRIM,idata,ps_global->vars[V_REPLACE_RULES].current_val.l); ! if (!rule_result) ! set_index_addr(idata, "From", fetch_from(idata), ! NULL, width, str); ! else{ ! sprintf(str, "%-*.*s", width, width, rule_result); ! fs_give((void **)&rule_result); ! } ! } ! break; case iAddress: *************** *** 7144,7149 **** --- 7481,7511 ---- : ((mdiff = *mess_a - *mess_b) ? ((mdiff > 0) ? 1 : -1) : 0)); } + SortOrder translate(order) + char *order; + { + if (!strcmp(order,"tHread")) + return SortThread; + if (!strcmp(order,"OrderedSubj")) + return SortSubject2; + if (!strcmp(order,"Subject")) + return SortSubject; + if (!strcmp(order,"Arrival")) + return SortArrival; + if (!strcmp(order,"From")) + return SortFrom; + if (!strcmp(order,"To")) + return SortTo; + if (!strcmp(order,"Cc")) + return SortCc; + if (!strcmp(order,"Date")) + return SortDate; + if (!strcmp(order,"siZe")) + return SortSize; + if (!strcmp(order,"scorE")) + return SortScore; + return EndofList; + } /*---------------------------------------------------------------------- Sort the current folder into the order set in the msgmap *************** *** 7159,7169 **** causes the sort to happen if it is still needed. ----*/ void ! sort_folder(msgmap, new_sort, new_rev, flags) MSGNO_S *msgmap; SortOrder new_sort; int new_rev; unsigned flags; { long raw_current, i, j; unsigned long *sort = NULL; --- 7521,7532 ---- causes the sort to happen if it is still needed. ----*/ void ! sort_folder(msgmap, new_sort, new_rev, flags, first) MSGNO_S *msgmap; SortOrder new_sort; int new_rev; unsigned flags; + int first; { long raw_current, i, j; unsigned long *sort = NULL; *************** *** 7172,7177 **** --- 7535,7549 ---- SortOrder current_sort; int current_rev; + if (first){ + if (new_sort == SortThread && ps_global->thread_def_sort == SortArrival) + find_msgmap(ps_global->mail_stream, msgmap, flags, + ps_global->thread_def_sort, ps_global->thread_def_sort_rev); + else + sort_folder(msgmap, new_sort, new_rev, flags, 0); + return; + } + dprint(2, (debugfile, "Sorting by %s%s\n", sort_name(new_sort), new_rev ? "/reverse" : "")); *************** *** 7534,7539 **** --- 7906,7912 ---- thrd = fetch_head_thread(ps_global->mail_stream); for(j = msgmap->max_thrdno; thrd && j >= 1L; j--){ + unsigned long branch; thrd->thrdno = j; if(thrd->nextthd) *************** *** 7656,7662 **** unsigned long msgno, rawno, set_in_thread, in_thread; int bail, this_is_vis; int un_view_thread = 0; ! long raw_current; dprint(2, (debugfile, "sort_thread_callback\n")); --- 8029,8035 ---- unsigned long msgno, rawno, set_in_thread, in_thread; int bail, this_is_vis; int un_view_thread = 0; ! long raw_current, branch; dprint(2, (debugfile, "sort_thread_callback\n")); *************** *** 7675,7683 **** * way. If the dummy node is at the top-level, then its children are * promoted to the top-level as separate threads. */ ! collapsed_tree = collapse_threadnode_tree(tree); ! (void) sort_thread_flatten(collapsed_tree, stream, thrd_flatten_array, ! NULL, THD_TOP); mail_free_threadnode(&collapsed_tree); if(any_lflagged(g_sort.msgmap, MN_HIDE)) --- 8048,8058 ---- * way. If the dummy node is at the top-level, then its children are * promoted to the top-level as separate threads. */ ! collapsed_tree = F_ON(F_ENHANCED_THREAD, ps_global) ? ! copy_tree(tree) : collapse_threadnode_tree(tree); ! (void) sort_thread_flatten(collapsed_tree, ! stream, thrd_flatten_array, ! NULL, THD_TOP, 0, 1L, 0L); mail_free_threadnode(&collapsed_tree); if(any_lflagged(g_sort.msgmap, MN_HIDE)) *************** *** 7881,7890 **** PINETHRD_S *not_this_thread; { PINETHRD_S *thrd = NULL, *nthrd; ! unsigned long msgno; dprint(9, (debugfile, "collapse_threads\n")); thrd = fetch_head_thread(stream); while(thrd){ if(thrd != not_this_thread){ --- 8256,8272 ---- PINETHRD_S *not_this_thread; { PINETHRD_S *thrd = NULL, *nthrd; ! unsigned long msgno, branch; dprint(9, (debugfile, "collapse_threads\n")); + /* if(F_ON(F_ENHANCED_THREAD, ps_global)){*/ + kolapse_thread(ps_global, stream, msgmap, '[', 0); + if (not_this_thread) + expand_thread(ps_global, stream, msgmap, 0); + return; + /* }*/ + thrd = fetch_head_thread(stream); while(thrd){ if(thrd != not_this_thread){ *************** *** 7892,7899 **** /* set collapsed bit */ if(msgno){ - set_lflag(stream, g_sort.msgmap, msgno, MN_COLL, 1); set_lflag(stream, g_sort.msgmap, msgno, MN_CHID, 0); } /* hide its children */ --- 8274,8281 ---- /* set collapsed bit */ if(msgno){ set_lflag(stream, g_sort.msgmap, msgno, MN_CHID, 0); + set_lflag(stream, g_sort.msgmap, msgno, MN_COLL, 1); } /* hide its children */ *************** *** 7919,7925 **** int a_parent_is_collapsed; { PINETHRD_S *nthrd, *bthrd; ! unsigned long msgno; if(!thrd) return; --- 8301,8307 ---- int a_parent_is_collapsed; { PINETHRD_S *nthrd, *bthrd; ! unsigned long msgno, next, branch; if(!thrd) return; *************** *** 7937,7944 **** set_lflag(stream, msgmap, msgno, MN_CHID, 0); } ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) make_thrdflags_consistent(stream, msgmap, nthrd, a_parent_is_collapsed --- 8319,8326 ---- set_lflag(stream, msgmap, msgno, MN_CHID, 0); } ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) make_thrdflags_consistent(stream, msgmap, nthrd, a_parent_is_collapsed *************** *** 7947,7954 **** MN_COLL)); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) make_thrdflags_consistent(stream, msgmap, bthrd, a_parent_is_collapsed); --- 8329,8336 ---- MN_COLL)); } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) make_thrdflags_consistent(stream, msgmap, bthrd, a_parent_is_collapsed); *************** *** 7961,7967 **** MAILSTREAM *stream; { PINETHRD_S *thrd = NULL; ! long vis = 0L; thrd = fetch_head_thread(stream); while(thrd){ --- 8343,8349 ---- MAILSTREAM *stream; { PINETHRD_S *thrd = NULL; ! long vis = 0L, branch; thrd = fetch_head_thread(stream); while(thrd){ *************** *** 7978,8032 **** struct pass_along * ! sort_thread_flatten(node, stream, entry, thrd, flags) THREADNODE *node; MAILSTREAM *stream; struct pass_along *entry; PINETHRD_S *thrd; unsigned flags; { long n = 0L; ! PINETHRD_S *newthrd = NULL; if(node){ ! if(node->num){ /* holes happen */ n = (long) (entry - thrd_flatten_array); for(; n > 0; n--) if(thrd_flatten_array[n].rawno == node->num) break; /* duplicate */ ! if(!n) ! entry->rawno = node->num; ! } ! ! /* ! * Build a richer threading structure that will help us paint ! * and operate on threads and subthreads. ! */ ! if(!n && node->num){ ! newthrd = msgno_thread_info(stream, node->num, thrd, flags); ! if(newthrd){ ! entry->thrd = newthrd; ! entry++; ! ! if(node->next) entry = sort_thread_flatten(node->next, stream, entry, ! newthrd, THD_NEXT); ! if(node->branch) entry = sort_thread_flatten(node->branch, stream, entry, ! newthrd, ! (flags == THD_TOP) ? THD_TOP ! : THD_BRANCH); } } } return(entry); } /* * Make a copy of c-client's THREAD tree while eliminating dummy nodes. */ --- 8360,8474 ---- struct pass_along * ! sort_thread_flatten(node, stream, entry, thrd, flags, adopted, top, threadno) THREADNODE *node; MAILSTREAM *stream; struct pass_along *entry; PINETHRD_S *thrd; unsigned flags; + int adopted; + long top; + long threadno; { long n = 0L; ! PINETHRD_S *newthrd = NULL, *save_thread = NULL; if(node){ ! if(node->num){ n = (long) (entry - thrd_flatten_array); + if (adopted == 2) + top = node->num; + for(; n > 0; n--) if(thrd_flatten_array[n].rawno == node->num) break; /* duplicate */ ! if(!n){ ! entry->rawno = node->num; ! newthrd = msgno_thread_info(stream, node->num, thrd, flags); ! if(newthrd){ ! if (adopted == 2) ! threadno = newthrd->thrdno; ! if (adopted){ ! newthrd->toploose = top; ! newthrd->thrdno = threadno; ! } ! entry->thrd = newthrd; ! entry++; ! } ! adopted = adopted ? 1 : 0; ! if (node->next) entry = sort_thread_flatten(node->next, stream, entry, ! newthrd, THD_NEXT, adopted, top, ! threadno); if(node->branch) entry = sort_thread_flatten(node->branch, stream, entry, ! newthrd, ! (flags == THD_TOP) ? THD_TOP: THD_BRANCH, ! adopted, top, threadno); } } + else{ + adopted = 2; + if(node->next) + entry = sort_thread_flatten(node->next, stream, entry, + thrd, THD_TOP, adopted, top, threadno); + adopted = 0; + if(node->branch){ + if(entry){ + struct pass_along *last_entry = entry; + int i = 0; + + /* + * Next moved up to replace "tree" in the tree. + * If next has no branches, then we want to branch off + * of next. If next has branches, we want to branch off + * of the last of those branches instead. + */ + last_entry--; + while(last_entry->thrd->parent) + last_entry--; + save_thread = last_entry->thrd; + last_entry += i+1; + + last_entry = sort_thread_flatten(node->branch, stream, entry, + save_thread, + (flags == THD_TOP) ? THD_TOP: THD_BRANCH, + adopted, top, threadno); + } + else + entry = sort_thread_flatten(node->branch, stream, entry, + NULL, THD_TOP, adopted, top, threadno); + } + } } return(entry); + } + /* + * Make a copy of c-client's THREAD tree + */ + THREADNODE * + copy_tree(tree) + THREADNODE *tree; + { + THREADNODE *newtree = NULL; + if(tree){ + newtree = mail_newthreadnode(NULL); + newtree->num = tree->num; + if(tree->next) + newtree->next = copy_tree(tree->next); + + if(tree->branch) + newtree->branch = copy_tree(tree->branch); + } + return(newtree); + } + /* * Make a copy of c-client's THREAD tree while eliminating dummy nodes. */ *************** *** 9509,9515 **** if(set){ sort_folder(ps_global->msgmap, order & 0x000000ff, ! (order & 0x00000100) != 0, SRT_VRB); mswin_beginupdate(); update_titlebar_message(); update_titlebar_status(); --- 9951,9957 ---- if(set){ sort_folder(ps_global->msgmap, order & 0x000000ff, ! (order & 0x00000100) != 0, SRT_VRB, 1); mswin_beginupdate(); update_titlebar_message(); update_titlebar_status(); *************** *** 9678,9689 **** void ! thread_command(state, stream, msgmap, preloadkeystroke, q_line) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; int preloadkeystroke; int q_line; { PINETHRD_S *thrd = NULL; unsigned long rawno, save_branch; --- 10120,10132 ---- void ! thread_command(state, stream, msgmap, preloadkeystroke, q_line, display) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; int preloadkeystroke; int q_line; + int display; { PINETHRD_S *thrd = NULL; unsigned long rawno, save_branch; *************** *** 9732,9738 **** cancel_busy_alarm(0); (void ) apply_command(state, stream, msgmap, preloadkeystroke, flags, ! q_line); /* restore the original flags */ copy_lflags(stream, msgmap, MN_STMP, MN_SLCT); --- 10175,10181 ---- cancel_busy_alarm(0); (void ) apply_command(state, stream, msgmap, preloadkeystroke, flags, ! q_line, display); /* restore the original flags */ copy_lflags(stream, msgmap, MN_STMP, MN_SLCT); *************** *** 9770,9775 **** --- 10213,10219 ---- int v; { PINETHRD_S *nthrd, *bthrd; + unsigned long next = 0L, branch = 0L; if(!(stream && thrd && msgmap)) return; *************** *** 9776,9789 **** set_lflag(stream, msgmap, mn_raw2m(msgmap, thrd->rawno), f, v); ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) set_flags_for_thread(stream, msgmap, f, nthrd, v); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) set_flags_for_thread(stream, msgmap, f, bthrd, v); } --- 10220,10233 ---- set_lflag(stream, msgmap, mn_raw2m(msgmap, thrd->rawno), f, v); ! if(next = get_next(stream,thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) set_flags_for_thread(stream, msgmap, f, nthrd, v); } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) set_flags_for_thread(stream, msgmap, f, bthrd, v); } *************** *** 9804,9809 **** --- 10248,10254 ---- PINETHRD_S *thrd; { PINETHRD_S *nthrd, *bthrd; + unsigned long next, branch; if(!(stream && thrd)) return; *************** *** 9811,9824 **** if(thrd->rawno > 0L && thrd->rawno <= stream->nmsgs) mm_searched(stream, thrd->rawno); ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) set_search_bit_for_thread(stream, nthrd); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) set_search_bit_for_thread(stream, bthrd); } --- 10256,10269 ---- if(thrd->rawno > 0L && thrd->rawno <= stream->nmsgs) mm_searched(stream, thrd->rawno); ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) set_search_bit_for_thread(stream, nthrd); } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) set_search_bit_for_thread(stream, bthrd); } *************** *** 9873,9883 **** * index. */ void ! collapse_or_expand(state, stream, msgmap, msgno) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; unsigned long msgno; { int collapsed, adjust_current = 0; PINETHRD_S *thrd = NULL, *nthrd; --- 10318,10329 ---- * index. */ void ! collapse_or_expand(state, stream, msgmap, msgno, display) struct pine *state; MAILSTREAM *stream; MSGNO_S *msgmap; unsigned long msgno; + int display; { int collapsed, adjust_current = 0; PINETHRD_S *thrd = NULL, *nthrd; *************** *** 9913,9919 **** if(!thrd) return; ! collapsed = get_lflag(stream, NULL, thrd->rawno, MN_COLL) && thrd->next; if(collapsed){ msgno = mn_raw2m(msgmap, thrd->rawno); --- 10359,10365 ---- if(!thrd) return; ! collapsed = this_thread_is_kolapsed(ps_global, stream, msgmap, thrd->rawno); if(collapsed){ msgno = mn_raw2m(msgmap, thrd->rawno); *************** *** 9931,9943 **** msgno = mn_raw2m(msgmap, thrd->rawno); if(msgno > 0L && msgno <= mn_get_total(msgmap)){ set_lflag(stream, msgmap, msgno, MN_COLL, 1); ! if(nthrd = fetch_thread(stream, thrd->next)) set_thread_subtree(stream, nthrd, msgmap, 1, MN_CHID); clear_index_cache_ent(msgno); } } ! else q_status_message(SM_ORDER, 0, 1, "No thread to collapse or expand on this line"); --- 10377,10389 ---- msgno = mn_raw2m(msgmap, thrd->rawno); if(msgno > 0L && msgno <= mn_get_total(msgmap)){ set_lflag(stream, msgmap, msgno, MN_COLL, 1); ! if((thrd->next) && (nthrd = fetch_thread(stream, thrd->next))) set_thread_subtree(stream, nthrd, msgmap, 1, MN_CHID); clear_index_cache_ent(msgno); } } ! else if (display) q_status_message(SM_ORDER, 0, 1, "No thread to collapse or expand on this line"); *************** *** 10019,10036 **** unsigned long rawno, count = 0; PINETHRD_S *nthrd, *bthrd; MESSAGECACHE *mc; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) count += count_flags_in_thread(stream, nthrd, flags); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) count += count_flags_in_thread(stream, bthrd, flags); } --- 10465,10483 ---- unsigned long rawno, count = 0; PINETHRD_S *nthrd, *bthrd; MESSAGECACHE *mc; + unsigned long next = 0L, branch = 0L; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! ! if(next = get_next(stream,thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) count += count_flags_in_thread(stream, nthrd, flags); } ! if(branch = get_branch(stream,thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) count += count_flags_in_thread(stream, bthrd, flags); } *************** *** 10060,10079 **** MSGNO_S *msgmap; int flags; /* flag to count */ { ! unsigned long rawno, count = 0; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) count += count_lflags_in_thread(stream, nthrd, msgmap, flags); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) count += count_lflags_in_thread(stream, bthrd, msgmap,flags); } --- 10507,10526 ---- MSGNO_S *msgmap; int flags; /* flag to count */ { ! unsigned long rawno, count = 0, next, branch; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) count += count_lflags_in_thread(stream, nthrd, msgmap, flags); } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) count += count_lflags_in_thread(stream, bthrd, msgmap,flags); } *************** *** 10095,10101 **** MAILSTREAM *stream; PINETHRD_S *thrd; { ! unsigned long rawno, count = 0; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) --- 10542,10548 ---- MAILSTREAM *stream; PINETHRD_S *thrd; { ! unsigned long rawno, count = 0, next, branch; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) *************** *** 10104,10117 **** if(get_lflag(stream, NULL, thrd->rawno, MN_HIDE) == 0) return 1; ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd && thread_has_some_visible(stream, nthrd)) return 1; } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd && thread_has_some_visible(stream, bthrd)) return 1; } --- 10551,10564 ---- if(get_lflag(stream, NULL, thrd->rawno, MN_HIDE) == 0) return 1; ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd && thread_has_some_visible(stream, nthrd)) return 1; } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd && thread_has_some_visible(stream, bthrd)) return 1; } *************** *** 10186,10192 **** MSGNO_S *msgmap; { int count = 0; ! long n; PINETHRD_S *nthrd, *bthrd; MESSAGECACHE *mc; --- 10633,10639 ---- MSGNO_S *msgmap; { int count = 0; ! long n, next, branch; PINETHRD_S *nthrd, *bthrd; MESSAGECACHE *mc; *************** *** 10193,10206 **** if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) count += mark_msgs_in_thread(stream, nthrd, msgmap); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) count += mark_msgs_in_thread(stream, bthrd, msgmap); } --- 10640,10653 ---- if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return count; ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) count += mark_msgs_in_thread(stream, nthrd, msgmap); } ! if(branch = get_branch(stream, thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) count += mark_msgs_in_thread(stream, bthrd, msgmap); } *************** *** 10234,10240 **** int flags; /* flags to set or clear */ int v; /* set or clear? */ { ! unsigned long rawno, msgno; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) --- 10681,10687 ---- int flags; /* flags to set or clear */ int v; /* set or clear? */ { ! unsigned long rawno, msgno, next, branch; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) *************** *** 10259,10272 **** if(flags == MN_CHID2 && v == 1 && get_index_cache(msgno)->line[0]) clear_index_cache_ent(msgno); ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) set_thread_lflags(stream, nthrd, msgmap, flags, v); } ! if(thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) set_thread_lflags(stream, bthrd, msgmap, flags, v); } --- 10706,10719 ---- if(flags == MN_CHID2 && v == 1 && get_index_cache(msgno)->line[0]) clear_index_cache_ent(msgno); ! if(next = get_next(stream, thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) set_thread_lflags(stream, nthrd, msgmap, flags, v); } ! if(branch = get_branch(stream,thrd)){ ! bthrd = fetch_thread(stream, branch); if(bthrd) set_thread_lflags(stream, bthrd, msgmap, flags, v); } *************** *** 10353,10370 **** { char to_us = ' '; PINETHRD_S *nthrd, *bthrd; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return to_us; ! if(thrd->next){ ! nthrd = fetch_thread(stream, thrd->next); if(nthrd) to_us = to_us_symbol_for_thread(stream, nthrd, consider_flagged); } ! if(to_us == ' ' && thrd->branch){ ! bthrd = fetch_thread(stream, thrd->branch); if(bthrd) to_us = to_us_symbol_for_thread(stream, bthrd, consider_flagged); } --- 10800,10821 ---- { char to_us = ' '; PINETHRD_S *nthrd, *bthrd; + unsigned long next = 0L, branch = 0L; if(!thrd || !stream || thrd->rawno < 1L || thrd->rawno > stream->nmsgs) return to_us; ! ! ! ! if(next = get_next(stream,thrd)){ ! nthrd = fetch_thread(stream, next); if(nthrd) to_us = to_us_symbol_for_thread(stream, nthrd, consider_flagged); } ! if(to_us == ' ' && (branch = get_branch(stream,thrd))){ ! bthrd = fetch_thread(stream, branch); if(bthrd) to_us = to_us_symbol_for_thread(stream, bthrd, consider_flagged); } *************** *** 10394,10400 **** break; } ! if(to_us != '+' && resent_to_us(&idata)) to_us = '+'; if(to_us == ' ' && F_ON(F_MARK_FOR_CC,ps_global)) --- 10845,10851 ---- break; } ! if(to_us != '+' && !idata.bogus && resent_to_us(&idata)) to_us = '+'; if(to_us == ' ' && F_ON(F_MARK_FOR_CC,ps_global)) *************** *** 10430,10436 **** int flags; /* flags to set or clear */ { int hiding; ! unsigned long rawno, msgno; PINETHRD_S *nthrd, *bthrd; hiding = (flags == MN_CHID) && v; --- 10881,10887 ---- int flags; /* flags to set or clear */ { int hiding; ! unsigned long rawno, msgno, next, branch; PINETHRD_S *nthrd, *bthrd; hiding = (flags == MN_CHID) && v; *************** *** 10442,10448 **** set_lflag(stream, msgmap, msgno, flags, v); ! if(thrd->next && (hiding || !get_lflag(stream,NULL,thrd->rawno,MN_COLL))){ nthrd = fetch_thread(stream, thrd->next); if(nthrd) set_thread_subtree(stream, nthrd, msgmap, v, flags); --- 10893,10900 ---- set_lflag(stream, msgmap, msgno, flags, v); ! if(thrd->next ! && (hiding || !get_lflag(stream,NULL,thrd->rawno,MN_COLL))){ nthrd = fetch_thread(stream, thrd->next); if(nthrd) set_thread_subtree(stream, nthrd, msgmap, v, flags); *************** *** 10486,10493 **** if(rawno) thrd = fetch_thread(stream, rawno); ! if(thrd && thrd->top && thrd->top != thrd->rawno) ! thrd = fetch_thread(stream, thrd->top); if(!thrd) return 0; --- 10938,10945 ---- if(rawno) thrd = fetch_thread(stream, rawno); ! if(thrd && thrd->top && top_thread(stream,thrd->top) != thrd->rawno) ! thrd = fetch_thread(stream, top_thread(stream,thrd->top)); if(!thrd) return 0; *************** *** 10503,10510 **** set_thread_lflags(stream, thrd, msgmap, MN_CHID2, 1); } ! if(current_index_state) ! msgmap->top_after_thrd = current_index_state->msg_at_top; /* * If this is one of those wacky users who like to sort backwards --- 10955,10963 ---- set_thread_lflags(stream, thrd, msgmap, MN_CHID2, 1); } ! /* if(current_index_state) ! msgmap->top_after_thrd = current_index_state->msg_at_top;*/ ! msgmap->top_after_thrd = mn_raw2m(msgmap, thrd->top); /* * If this is one of those wacky users who like to sort backwards *************** *** 10559,10565 **** thrd = fetch_thread(stream, rawno); if(thrd && thrd->top) ! topthrd = fetch_thread(stream, thrd->top); if(!topthrd) return 0; --- 11012,11018 ---- thrd = fetch_thread(stream, rawno); if(thrd && thrd->top) ! topthrd = fetch_thread(stream, top_thread(stream,thrd->top)); if(!topthrd) return 0; *************** *** 10599,10608 **** thrd = startthrd; ! if(!thrd || !(thrd->prevthd || thrd->nextthd)) thrd = fetch_thread(stream, mn_m2raw(msgmap, mn_get_cur(msgmap))); ! if(thrd && !(thrd->prevthd || thrd->nextthd) && thrd->head) thrd = fetch_thread(stream, thrd->head); if(thrd){ --- 11052,11061 ---- thrd = startthrd; ! if(!thrd || !(thrd->prevthd || get_branch(stream, thrd))) thrd = fetch_thread(stream, mn_m2raw(msgmap, mn_get_cur(msgmap))); ! if(thrd && !(thrd->prevthd || get_branch(stream, thrd)) && thrd->head) thrd = fetch_thread(stream, thrd->head); if(thrd){ *************** *** 10609,10621 **** /* go forward from here */ if(thrd->thrdno < target){ while(thrd){ if(thrd->thrdno == target) break; if(mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgmap) && thrd->nextthd) ! thrd = fetch_thread(stream, thrd->nextthd); else thrd = NULL; } --- 11062,11075 ---- /* go forward from here */ if(thrd->thrdno < target){ while(thrd){ + unsigned long branch; if(thrd->thrdno == target) break; if(mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); ! else if(!mn_get_revsort(msgmap) && (branch = get_branch(stream, thrd))) ! thrd = fetch_thread(stream, branch); else thrd = NULL; } *************** *** 10625,10635 **** && (mn_get_revsort(msgmap) || (thrd->thrdno - target) < (target - 1L))){ while(thrd){ if(thrd->thrdno == target) break; ! if(mn_get_revsort(msgmap) && thrd->nextthd) ! thrd = fetch_thread(stream, thrd->nextthd); else if(!mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); else --- 11079,11090 ---- && (mn_get_revsort(msgmap) || (thrd->thrdno - target) < (target - 1L))){ while(thrd){ + unsigned long branch; if(thrd->thrdno == target) break; ! if(mn_get_revsort(msgmap) && (branch = get_branch(stream, thrd))) ! thrd = fetch_thread(stream, branch); else if(!mn_get_revsort(msgmap) && thrd->prevthd) thrd = fetch_thread(stream, thrd->prevthd); else *************** *** 10641,10646 **** --- 11096,11102 ---- if(thrd->head){ thrd = fetch_thread(stream, thrd->head); while(thrd){ + unsigned long branch; if(thrd->thrdno == target) break; *************** *** 10685,10687 **** --- 11141,11456 ---- } } } + + unsigned long + get_branch(stream,thrd) + MAILSTREAM *stream; + PINETHRD_S *thrd; + { + PINETHRD_S *nthrd = NULL; + unsigned long top; + + if (thrd->toploose && thrd->nextthd) + nthrd = fetch_thread(stream, thrd->nextthd); + if (!nthrd) + return thrd->branch; + top = top_thread(stream, thrd->rawno); + return thrd->branch + ? thrd->branch + : (F_ON(F_ENHANCED_THREAD, ps_global) + ? (top == top_thread(stream, nthrd->rawno) ? thrd->nextthd : 0L) + : 0L); + } + + unsigned long + get_next(stream,thrd) + MAILSTREAM *stream; + PINETHRD_S *thrd; + { + return thrd->next; + } + + long + get_length_branch(stream, rawno) + MAILSTREAM *stream; + long rawno; + { + int branchp = 0, done = 0; + long top, count = 1L, raw; + PINETHRD_S *thrd, *pthrd = NULL, *nthrd; + + thrd = fetch_thread(stream, rawno); + + if (!thrd) + return -1L; + + top = thrd->top; + + if (thrd->parent) + pthrd = fetch_thread(stream, thrd->parent); + + if (thrd->rawno == top) + branchp++; + + if (!branchp && !pthrd){ /* what!!?? */ + raw = top; + while (!done){ + pthrd = fetch_thread(stream, raw); + if ((pthrd->next == rawno) || (pthrd->branch == rawno)) + done++; + else{ + if (pthrd->next) + raw = pthrd->next; + else if (pthrd->branch) + raw = pthrd->branch; + } + } + } + + if (pthrd && pthrd->next == thrd->rawno && thrd->branch) + branchp++; + + if (pthrd && pthrd->next && pthrd->next != thrd->rawno){ + nthrd = fetch_thread(stream, pthrd->next); + while (nthrd && nthrd->branch && nthrd->branch != thrd->rawno) + nthrd = fetch_thread(stream, nthrd->branch); + if(nthrd && nthrd->branch && nthrd->branch == thrd->rawno) + branchp++; + } + + if(branchp){ + int entry = 0; + while(thrd && thrd->next){ + entry = 1; + count++; + thrd = fetch_thread(stream, thrd->next); + if (thrd->branch) + break; + } + if (entry && thrd->branch) + count--; + } + return branchp ? (count ? count : 1L) : 0L; + } + + void + find_msgmap(stream, msgmap, flags, ordersort, is_rev) + MAILSTREAM *stream; + MSGNO_S *msgmap; + int flags; + SortOrder ordersort; + unsigned is_rev; + { + int we_cancel; + long *old_arrival,*new_arrival; + long init_thread, end_thread, current; + long k = 1L, j, last_thread = 0L; + long i, tmsg, ntmsg, nthreads; + int nflags = (SRT_VRB | SRT_MAN); + char sort_msg[MAX_SCREEN_COLS+1] = {'\0'}; + PINETHRD_S *thrd, *tthrd, *nthrd; + + current = mn_m2raw(msgmap, mn_get_cur(msgmap)); + + /* now sort by arrival */ + sort_folder(msgmap, ordersort, 0, nflags, 0); + + tmsg = mn_get_total(msgmap) + 1; + + if (tmsg <= 1) + return; + + old_arrival = (long *) fs_get(tmsg * sizeof(long)); + memset(old_arrival, 0, tmsg*sizeof(long)); + for (i= 1L;(i <= mn_get_total(msgmap)) && (old_arrival[i] = msgmap->sort[i]); i++); + + /* now sort by thread */ + sort_folder(msgmap, SortThread, 0, nflags, 0); + ntmsg = mn_get_total(msgmap) + 1; + + if (tmsg != ntmsg){ /* oh oh, something happened,we better try again */ + fs_give((void **)&old_arrival); + find_msgmap(stream, msgmap, flags, ordersort, is_rev); + return; + } + + /* reconstruct the msgmap */ + + new_arrival = (long *) fs_get(tmsg * sizeof(long)); + memset(new_arrival, 0, tmsg*sizeof(long)); + i = mn_get_total(msgmap); + while (new_arrival[1] == 0){ /* think of this as (tmsg > 0) */ + int done = 0; + long n = mn_get_total(msgmap); + + init_thread = top_thread(stream, old_arrival[i]); + thrd = fetch_thread(stream, init_thread); + while ((new_arrival[n] != 0) && !done){ /* compare raw numbers */ + done = (new_arrival[n] == init_thread); + n--; + } + if (!done){ + k = 1L; + mn_set_cur(msgmap, mn_raw2m(msgmap, init_thread)); + if (move_next_thread(ps_global, stream, msgmap, 0) <= 0) + j = mn_get_total(msgmap) - mn_raw2m(msgmap, init_thread) + 1; + else + j = mn_get_cur(msgmap) - mn_raw2m(msgmap, init_thread); + end_thread = mn_raw2m(msgmap, init_thread) + j; + while (k <= j){ + new_arrival[tmsg - k] = msgmap->sort[end_thread - k]; + k++; + } + tmsg -= j; + } + i--; + } + relink_threads(stream, msgmap, new_arrival); + for (i = 1; (i <= mn_get_total(msgmap)) + && (msgmap->sort[i] = new_arrival[i]); i++); + msgno_reset_isort(msgmap); + + fs_give((void **)&new_arrival); + fs_give((void **)&old_arrival); + + + if(is_rev && (mn_get_total(msgmap) > 1L)){ + long *rev_sort; + long i = 1L, l = mn_get_total(msgmap); + + rev_sort = (long *) fs_get((mn_get_total(msgmap)+1L) * sizeof(long)); + memset(rev_sort, 0, (mn_get_total(msgmap)+1L)*sizeof(long)); + while (l > 0L){ + if (top_thread(stream, msgmap->sort[l]) == msgmap->sort[l]){ + long init_thread = msgmap->sort[l]; + long j, k; + + mn_set_cur(msgmap, mn_raw2m(msgmap, init_thread)); + if (move_next_thread(ps_global, stream, msgmap, 0) <= 0) + j = mn_get_total(msgmap) - mn_raw2m(msgmap, init_thread) + 1; + else + j = mn_get_cur(msgmap) - mn_raw2m(msgmap, init_thread); + for (k = 0L; (k < j) && (rev_sort[i+k] = msgmap->sort[l+k]); k++); + i += j; + } + l--; + } + relink_threads(stream, msgmap, rev_sort); + for (i = 1L; i <= mn_get_total(msgmap); i++) + msgmap->sort[i] = rev_sort[i]; + msgno_reset_isort(msgmap); + fs_give((void **)&rev_sort); + } + mn_reset_cur(msgmap, first_sorted_flagged(is_rev ? F_NONE : F_SRCHBACK, + stream, mn_raw2m(msgmap, current), FSF_SKIP_CHID)); + msgmap->top = -1L; + + ps_global->unsorted_newmail = 0; + + for(i = 1L; i <= ps_global->mail_stream->nmsgs; i++) + mail_elt(ps_global->mail_stream, i)->spare7 = 0; + + mn_set_sort(msgmap, SortThread); + clear_index_cache(); + } + + void + move_thread(state, stream, msgmap, direction) + struct pine *state; + MAILSTREAM *stream; + MSGNO_S *msgmap; + int direction; + { + long new_cursor, old_cursor = mn_get_cur(msgmap); + int rv; + PINETHRD_S *thrd; + + rv = direction > 0 ? move_next_thread(state, stream, msgmap, 1): + move_prev_thread(state, stream, msgmap, 1); + if (rv > 0 && THRD_INDX_ENABLED()){ + new_cursor = mn_get_cur(msgmap); + mn_set_cur(msgmap, old_cursor); + unview_thread(state, stream, msgmap); + thrd = fetch_thread(stream,mn_m2raw(msgmap, new_cursor)); + if (thrd && !thrd->next) + thrd->flags = 0; + mn_set_cur(msgmap, new_cursor); + view_thread(state, stream, msgmap, 1); + state->next_screen = SCREEN_FUN_NULL; + } + } + + void + relink_threads(stream, msgmap, new_arrival) + MAILSTREAM *stream; + MSGNO_S *msgmap; + long *new_arrival; + { + long last_thread = 0L; + long i = 0L, j = 1L, k; + PINETHRD_S *thrd, *nthrd; + + while (j <= mn_get_total(msgmap)){ + i++; + thrd = fetch_thread(stream, new_arrival[j]); + thrd->prevthd = last_thread; + thrd->thrdno = i; + thrd->head = new_arrival[1]; + last_thread = thrd->rawno; + mn_set_cur(msgmap, mn_raw2m(msgmap,thrd->top)); + k = mn_get_cur(msgmap); + if (move_next_thread(ps_global, stream, msgmap, 0) <= 0) + j += mn_get_total(msgmap) + 1 - k; + else + j += mn_get_cur(msgmap) - k; + if (!thrd->toploose) + thrd->nextthd = (j <= mn_get_total(msgmap)) ? new_arrival[j] : 0L; + else{ + int done = 0; + while(thrd->nextthd && !done){ + thrd->thrdno = i; + thrd->head = new_arrival[1]; + if (thrd->nextthd) + nthrd = fetch_thread(stream, thrd->nextthd); + else + done++; + if(top_thread(stream, thrd->rawno) == top_thread(stream, nthrd->rawno)) + thrd = nthrd; + else + done++; + } + thrd->nextthd = (j <= mn_get_total(msgmap)) ? new_arrival[j] : 0L; + last_thread = thrd->rawno; + } + } + } + + + int + find_index_rule() + { + int found = 0; + RULE_RESULT *rule; + INDEXDATA_S idata; + ENVELOPE *local_env; + + memset(&idata, 0, sizeof(INDEXDATA_S)); + idata.stream = ps_global->mail_stream; + local_env = (ENVELOPE *)make_envelope(&idata, 0); + rule = (RULE_RESULT *) + get_result_rule(ps_global->vars[V_INDEX_RULES].current_val.l, + FOR_RULE | FOR_INDEX, local_env); + if (local_env) + mail_free_envelope(&local_env); + if (rule){ + init_index_format(rule->result, &ps_global->index_disp_format); + found = 1; + } + if (rule){ + if (rule->result) + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + return found; + } + diff -rc pine4.52/pine/mailpart.c pine4.52.I.USE/pine/mailpart.c *** pine4.52/pine/mailpart.c Wed Nov 27 15:22:54 2002 --- pine4.52.I.USE/pine/mailpart.c Tue Jan 14 13:13:47 2003 *************** *** 3343,3349 **** /* * For consistency, the first question is always "include text?" */ ! if((include_text = reply_text_query(ps_global, 1, &prefix)) >= 0 && reply_news_test(a->body->nested.msg->env, outgoing) > 0 && reply_harvest(ps_global, msgno, a->number, a->body->nested.msg->env, &saved_from, --- 3343,3349 ---- /* * For consistency, the first question is always "include text?" */ ! if((include_text = reply_text_query(ps_global, 1, NULL, &prefix)) >= 0 && reply_news_test(a->body->nested.msg->env, outgoing) > 0 && reply_harvest(ps_global, msgno, a->number, a->body->nested.msg->env, &saved_from, diff -rc pine4.52/pine/mailview.c pine4.52.I.USE/pine/mailview.c *** pine4.52/pine/mailview.c Tue Jan 7 16:17:00 2003 --- pine4.52.I.USE/pine/mailview.c Tue Jan 14 13:26:11 2003 *************** *** 97,102 **** --- 97,103 ---- static char *g_editorial_prefix, *g_editorial_postfix; + static char *prefix; /* * Def's to help in sorting out multipart/alternative *************** *** 207,221 **** HELP_MENU, OTHER_MENU, NULL_MENU, - NULL_MENU, RCOMPOSE_MENU, NULL_MENU, - NULL_MENU, - NULL_MENU, - NULL_MENU, - NULL_MENU, - NULL_MENU, NULL_MENU}; INST_KEY_MENU(view_keymenu, view_keys); #define VIEW_ATT_KEY 3 --- 208,222 ---- HELP_MENU, OTHER_MENU, + {"^H","ChkIncFld",{MC_FORCECHECK,1,{ctrl('H')}}, KS_NONE}, NULL_MENU, RCOMPOSE_MENU, + {"(","Prev Threa",{MC_PRETHREAD,1,{'('}},KS_NONE}, + {")","Next Threa",{MC_NEXTHREAD,1,{')'}},KS_NONE}, + {"^D","Delete Thr",{MC_DELTHREAD,1,{ctrl('D')}},KS_NONE}, + {"^U","Undel Thre",{MC_UNDTHREAD,1,{ctrl('U')}},KS_NONE}, + {"^T","selcT Thre",{MC_SELTHREAD,1,{ctrl('T')}},KS_NONE}, NULL_MENU, NULL_MENU}; INST_KEY_MENU(view_keymenu, view_keys); #define VIEW_ATT_KEY 3 *************** *** 354,359 **** --- 355,361 ---- int pcpine_resize_scroll PROTO((void)); int pcpine_view_cursor PROTO((int, long)); #endif + int is_word PROTO((char [], int, int)); *************** *** 432,437 **** --- 434,450 ---- else ps->unseen_in_view = !mc->seen; + prefix = reply_quote_str(env); + /* Make sure the prefix is not only made of spaces, so that we do not + * paint the screen incorrectly + */ + if (prefix && *prefix){ + int i; + for (i = 0; prefix[i] == ' '; i++); + if (i == strlen(prefix)) + fs_give((void **)&prefix); + } + #if defined(DOS) && !defined(WIN32) /* * Handle big text for DOS here. *************** *** 579,584 **** --- 592,599 ---- } while(ps->next_screen == SCREEN_FUN_NULL); + if (prefix && *prefix) + fs_give((void **)&prefix); if(we_cancel) cancel_busy_alarm(-1); } *************** *** 3240,3246 **** --- 3255,3278 ---- struct quote_colors *next; }; + #define is_letter(c) (((c) >= 'a' && (c) <= 'z') || \ + ((c) >= 'A' && (c) <= 'Z')) + + #define next(w,i) ((((w)[(i)]) != 0) ? ((w)[(i) + 1]) : 0) + + #define single_level(c) (((c) == '>') || ((c) == '|') || ((c) == '~')) + int + is_word (buf, i, j) + char buf[NSTRING]; + int i; + int j; + { + return i <= j && is_letter(buf[i]) ? + (i < j ? is_word(buf,i+1,j) : 1) : 0; + } + + int color_a_quote(linenum, line, ins, local) long linenum; char *line; *************** *** 3247,3263 **** LT_INS_S **ins; void *local; { ! int countem = 0; struct variable *vars = ps_global->vars; char *p; struct quote_colors *colors = NULL, *cp, *next; COLOR_PAIR *col = NULL; p = line; - while(isspace((unsigned char)*p)) - p++; ! if(p[0] == '>'){ struct quote_colors *c; /* --- 3279,3328 ---- LT_INS_S **ins; void *local; { ! int countem = 0, i, j = 0; ! static int GLine[NSTRING] = {0}; ! int NLine[NSTRING] = {0}; struct variable *vars = ps_global->vars; char *p; + char buf[NSTRING] = {'\0'}; + QSTRING_S *qs; struct quote_colors *colors = NULL, *cp, *next; COLOR_PAIR *col = NULL; + static int PLine[NSTRING] = {0}; + if (linenum != 0){ + for (i = 0; GLine[i] && (PLine[i] = GLine[i]); i++); + PLine[i] = 0; + } + + for (i = 0; tmp_20k_buf[i] && (tmp_20k_buf[i] != '\015') && (i < NSTRING) + && (i < SIZEOF_20KBUF) + && (NLine[i] = (int) tmp_20k_buf[i]); i++); + NLine[i] = 0; + p = line; ! for (i = 0; (i < NSTRING) && ((GLine[i] = (int)p[i]) != 0); i++); ! GLine[NSTRING - 1] = 0; ! qs = do_quote_match(prefix && *prefix ? prefix : ">", GLine, NLine, PLine); ! flatten_qstring(qs, buf, &i, 0); i--; ! free_qs(&qs); ! for (; (i > 0) && isspace(buf[i]); i--); ! buf[++i] = '\0'; ! /* do not paint an extra level for a line with a >From string at the ! * begining of it ! */ ! if (buf[0] && (strlen(buf) + strlen("From ") + 1 < NSTRING)){ ! i = strlen(buf); ! if (strstr(p,(char *)strcat(buf,"From ")) == p) ! buf[i - 1] = '\0'; ! else ! buf[i] = '\0'; ! } ! ! for (i = 0; isspace((unsigned char)buf[i]); i++) ! p++; ! if(buf[i]){ struct quote_colors *c; /* *************** *** 3306,3312 **** free_color_pair(&col); cp = NULL; ! while(*p == '>'){ cp = (cp && cp->next) ? cp->next : colors; if(countem > 0) --- 3371,3377 ---- free_color_pair(&col); cp = NULL; ! while(buf[i]){ cp = (cp && cp->next) ? cp->next : colors; if(countem > 0) *************** *** 3316,3323 **** countem = (countem == 1) ? 0 : countem; ! for(p++; isspace((unsigned char)*p); p++) ; } if(colors){ --- 3381,3428 ---- countem = (countem == 1) ? 0 : countem; ! if (!single_level(buf[i])){ ! if (is_letter(buf[i])){ /* if there's a word */ ! for (j = i; buf[j] && is_letter(buf[j]); j++); ! j += ((buf[j] == '>') || (buf[j] == ':')) ? 1 : 2; ! } ! else{ ! switch(buf[i]){ ! case ':' : ! if (next(buf,i) != RPAREN) ! j = i + 1; ! else ! j = i + 2; ! break; ! ! case '-' : ! if (next(buf,i) != '-') ! j = i + 2; ! else ! j = i + 3; ! break; ! ! case '*' : ! j = i + 2; ! break; ! ! default : ! for (j = i; buf[j] && !isspace(buf[j]) ! && (!single_level(buf[i]) && !is_letter(buf[j])); j++); ! j += isspace(buf[j]) ? 1 : 0; ! break; ! } ! } ! p += j - i; ! } ! else{ /* count every '>' for one level */ ! j = ++i; ! p++; ! } ! ! for(; isspace((unsigned char)*p); p++) ; + for(i = j; isspace(buf[i]); i++); } if(colors){ *************** *** 6211,6217 **** register long cur_top_line, num_display_lines; int result, done, ch, cmd, found_on, found_on_col, first_view, force, scroll_lines, km_size, ! cursor_row, cursor_col, km_popped; long jn; struct key_menu *km; HANDLE_S *next_handle; --- 6316,6322 ---- register long cur_top_line, num_display_lines; int result, done, ch, cmd, found_on, found_on_col, first_view, force, scroll_lines, km_size, ! cursor_row, cursor_col, km_popped, nmail, omail = 0; long jn; struct key_menu *km; HANDLE_S *next_handle; *************** *** 6218,6224 **** --- 6323,6331 ---- bitmap_t bitmap; OtherMenu what; Pos whereis_pos; + time_t now, last, old = time(0); + last = old; num_display_lines = SCROLL_LINES(ps_global); km_popped = 0; ps_global->mangled_header = 1; *************** *** 6426,6432 **** --- 6533,6556 ---- ps_global->mangled_footer = 0; } + ps_global->in_pico = 0; + if (F_ON(F_ENABLE_INCOMING,ps_global) && + F_ON(F_ENABLE_INCOMING_CHECK,ps_global)){ + now = time(0); + if (((now - old) > timeo*ps_global->delay) && (now - last > 1)){ + old = now; + omail = ps_global->number_of_folders; + nmail = new_mail_incfolder(ps_global,MC_IFAUTOCHECK); + ps_global->delay = time(0) - now + 1; + if ((ps_global->in_fld_list) && (nmail > omail)){ + cmd = MC_RESIZE; + goto end; + } + } + } + + /* * If an expunge of the current message happened during the * new mail check we want to bail out of here. See mm_expunged. *************** *** 6529,6534 **** --- 6653,6659 ---- mswin_mousetrackcallback(pcpine_view_cursor); #endif ch = read_command(); + last = now = time(0); #ifdef MOUSE #ifndef WIN32 if(sparms->text.handles) *************** *** 7194,7199 **** --- 7319,7325 ---- /*------- no op timeout to check for new mail ------*/ case MC_NONE : + last = now - 2; break; *************** *** 7228,7234 **** --- 7354,7406 ---- print_to_printer(sparms); break; + case MC_NEXTHREAD: + case MC_PRETHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, + "to move to other thread")) + move_thread(ps_global, ps_global->mail_stream, ps_global->msgmap, + cmd == MC_NEXTHREAD ? 1 : -1); + done = 1; + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + case MC_DELTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to delete")) + cmd_delete_thread(ps_global, ps_global->mail_stream, ps_global->msgmap); + done = 1; + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_UNDTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to undelete")) + cmd_undelete_thread(ps_global, ps_global->mail_stream, ps_global->msgmap); + done = 1; + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + + case MC_SELTHREAD: + if (THREADING()){ + if (any_messages(ps_global->msgmap, NULL, "to undelete")) + cmd_select_thread(ps_global, ps_global->mail_stream, ps_global->msgmap); + done = 1; + } + else + q_status_message(SM_ORDER, 0, 1, + "Command available in threaded mode only"); + break; + /* ------- First handle on Line ------ */ case MC_GOTOBOL : if(sparms->text.handles){ *************** *** 7260,7266 **** --- 7432,7454 ---- break; + /*------- Check incoming forlders -------*/ + case MC_FORCECHECK: + if (F_ON(F_ENABLE_INCOMING,ps_global) && + F_ON(F_ENABLE_INCOMING_CHECK,ps_global)){ + int nmail, omail = ps_global->number_of_folders; + nmail = new_mail_incfolder(ps_global,MC_FORCECHECK); + if ((ps_global->in_fld_list) && (nmail > omail)){ + cmd = MC_RESIZE; + goto end; + } + } + break; + case MC_TAB: + old = now = time(0); + /* do not check for new mail in inc fldrs and fall through */ + /*------- Standard commands ------*/ default: whereis_pos.row = 0; *************** *** 7311,7316 **** --- 7499,7505 ---- } /* End of while() -- loop executing commands */ + end: ps_global->redrawer = NULL; /* next statement makes this invalid! */ zero_scroll_text(); /* very important to zero out on return!!! */ scroll_state(SS_FREE); diff -rc pine4.52/pine/makefile.a32 pine4.52.I.USE/pine/makefile.a32 *** pine4.52/pine/makefile.a32 Mon Nov 18 15:35:14 2002 --- pine4.52.I.USE/pine/makefile.a32 Tue Jan 14 13:13:48 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.a41 pine4.52.I.USE/pine/makefile.a41 *** pine4.52/pine/makefile.a41 Tue Sep 10 14:39:20 2002 --- pine4.52.I.USE/pine/makefile.a41 Tue Jan 14 13:13:48 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.aix pine4.52.I.USE/pine/makefile.aix *** pine4.52/pine/makefile.aix Tue Oct 23 15:24:43 2001 --- pine4.52.I.USE/pine/makefile.aix Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.aux pine4.52.I.USE/pine/makefile.aux *** pine4.52/pine/makefile.aux Tue Oct 23 15:24:44 2001 --- pine4.52.I.USE/pine/makefile.aux Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.bs2 pine4.52.I.USE/pine/makefile.bs2 *** pine4.52/pine/makefile.bs2 Tue Sep 10 14:39:21 2002 --- pine4.52.I.USE/pine/makefile.bs2 Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.bsd pine4.52.I.USE/pine/makefile.bsd *** pine4.52/pine/makefile.bsd Mon Nov 18 15:35:15 2002 --- pine4.52.I.USE/pine/makefile.bsd Tue Jan 14 13:13:48 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.bsf pine4.52.I.USE/pine/makefile.bsf *** pine4.52/pine/makefile.bsf Tue Sep 10 14:39:21 2002 --- pine4.52.I.USE/pine/makefile.bsf Tue Jan 14 13:13:48 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.bsi pine4.52.I.USE/pine/makefile.bsi *** pine4.52/pine/makefile.bsi Tue Sep 10 14:39:21 2002 --- pine4.52.I.USE/pine/makefile.bsi Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.bso pine4.52.I.USE/pine/makefile.bso *** pine4.52/pine/makefile.bso Mon Nov 18 15:35:16 2002 --- pine4.52.I.USE/pine/makefile.bso Tue Jan 14 13:13:48 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.cvx pine4.52.I.USE/pine/makefile.cvx *** pine4.52/pine/makefile.cvx Tue Oct 23 15:24:45 2001 --- pine4.52.I.USE/pine/makefile.cvx Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.d-g pine4.52.I.USE/pine/makefile.d-g *** pine4.52/pine/makefile.d-g Tue Oct 23 15:24:45 2001 --- pine4.52.I.USE/pine/makefile.d-g Tue Jan 14 13:13:48 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.dpx pine4.52.I.USE/pine/makefile.dpx *** pine4.52/pine/makefile.dpx Tue Oct 23 15:24:45 2001 --- pine4.52.I.USE/pine/makefile.dpx Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.dyn pine4.52.I.USE/pine/makefile.dyn *** pine4.52/pine/makefile.dyn Tue Oct 23 15:24:46 2001 --- pine4.52.I.USE/pine/makefile.dyn Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o xs.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o xs.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.epx pine4.52.I.USE/pine/makefile.epx *** pine4.52/pine/makefile.epx Tue Oct 23 15:24:46 2001 --- pine4.52.I.USE/pine/makefile.epx Tue Jan 14 13:13:48 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gen pine4.52.I.USE/pine/makefile.gen *** pine4.52/pine/makefile.gen Tue Sep 10 14:39:22 2002 --- pine4.52.I.USE/pine/makefile.gen Tue Jan 14 13:13:48 2003 *************** *** 81,87 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 81,87 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gh9 pine4.52.I.USE/pine/makefile.gh9 *** pine4.52/pine/makefile.gh9 Mon Nov 18 15:35:17 2002 --- pine4.52.I.USE/pine/makefile.gh9 Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.ghp pine4.52.I.USE/pine/makefile.ghp *** pine4.52/pine/makefile.ghp Mon Nov 18 15:35:17 2002 --- pine4.52.I.USE/pine/makefile.ghp Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gs4 pine4.52.I.USE/pine/makefile.gs4 *** pine4.52/pine/makefile.gs4 Tue Oct 23 15:24:47 2001 --- pine4.52.I.USE/pine/makefile.gs4 Tue Jan 14 13:13:49 2003 *************** *** 83,89 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 83,89 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gs5 pine4.52.I.USE/pine/makefile.gs5 *** pine4.52/pine/makefile.gs5 Tue Oct 23 15:24:47 2001 --- pine4.52.I.USE/pine/makefile.gs5 Tue Jan 14 13:13:49 2003 *************** *** 83,89 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 83,89 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gsu pine4.52.I.USE/pine/makefile.gsu *** pine4.52/pine/makefile.gsu Mon Nov 18 15:35:17 2002 --- pine4.52.I.USE/pine/makefile.gsu Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.gul pine4.52.I.USE/pine/makefile.gul *** pine4.52/pine/makefile.gul Mon Nov 18 15:35:17 2002 --- pine4.52.I.USE/pine/makefile.gul Tue Jan 14 13:13:49 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.hpp pine4.52.I.USE/pine/makefile.hpp *** pine4.52/pine/makefile.hpp Mon Nov 18 15:35:18 2002 --- pine4.52.I.USE/pine/makefile.hpp Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.hpx pine4.52.I.USE/pine/makefile.hpx *** pine4.52/pine/makefile.hpx Mon Nov 18 15:35:18 2002 --- pine4.52.I.USE/pine/makefile.hpx Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.isc pine4.52.I.USE/pine/makefile.isc *** pine4.52/pine/makefile.isc Tue Oct 23 15:24:48 2001 --- pine4.52.I.USE/pine/makefile.isc Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.lnx pine4.52.I.USE/pine/makefile.lnx *** pine4.52/pine/makefile.lnx Tue Sep 10 14:34:39 2002 --- pine4.52.I.USE/pine/makefile.lnx Tue Jan 14 13:13:49 2003 *************** *** 72,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ ! os.o HFILES= headers.h os.h pine.h context.h helptext.h \ $(PICODIR)/headers.h $(PICODIR)/estruct.h \ --- 72,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o \ ! takeaddr.o os.o HFILES= headers.h os.h pine.h context.h helptext.h \ $(PICODIR)/headers.h $(PICODIR)/estruct.h \ diff -rc pine4.52/pine/makefile.lyn pine4.52.I.USE/pine/makefile.lyn *** pine4.52/pine/makefile.lyn Tue Oct 23 15:24:48 2001 --- pine4.52.I.USE/pine/makefile.lyn Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.mct pine4.52.I.USE/pine/makefile.mct *** pine4.52/pine/makefile.mct Tue Oct 23 15:24:49 2001 --- pine4.52.I.USE/pine/makefile.mct Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.mnt pine4.52.I.USE/pine/makefile.mnt *** pine4.52/pine/makefile.mnt Mon Nov 18 15:35:18 2002 --- pine4.52.I.USE/pine/makefile.mnt Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.msc pine4.52.I.USE/pine/makefile.msc *** pine4.52/pine/makefile.msc Tue Jul 3 10:02:25 2001 --- pine4.52.I.USE/pine/makefile.msc Tue Jan 14 13:13:49 2003 *************** *** 85,91 **** OBJ= addrbook.obj adrbklib.obj args.obj bldaddr.obj context.obj \ filter.obj folder.obj help.obj imap.obj init.obj mailcap.obj \ mailcmd.obj mailindx.obj mailpart.obj mailview.obj newmail.obj \ ! os.obj other.obj pine.obj reply.obj screen.obj send.obj \ signals.obj status.obj strings.obj takeaddr.obj adrbkcmd.obj all: pine.exe --- 85,91 ---- OBJ= addrbook.obj adrbklib.obj args.obj bldaddr.obj context.obj \ filter.obj folder.obj help.obj imap.obj init.obj mailcap.obj \ mailcmd.obj mailindx.obj mailpart.obj mailview.obj newmail.obj \ ! os.obj other.obj pine.obj reply.obj rules.obj screen.obj send.obj \ signals.obj status.obj strings.obj takeaddr.obj adrbkcmd.obj all: pine.exe diff -rc pine4.52/pine/makefile.neb pine4.52.I.USE/pine/makefile.neb *** pine4.52/pine/makefile.neb Tue Sep 10 14:39:23 2002 --- pine4.52.I.USE/pine/makefile.neb Tue Jan 14 13:13:49 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.nto pine4.52.I.USE/pine/makefile.nto *** pine4.52/pine/makefile.nto Mon Nov 18 15:35:18 2002 --- pine4.52.I.USE/pine/makefile.nto Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.nxt pine4.52.I.USE/pine/makefile.nxt *** pine4.52/pine/makefile.nxt Mon Nov 18 15:35:18 2002 --- pine4.52.I.USE/pine/makefile.nxt Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.osf pine4.52.I.USE/pine/makefile.osf *** pine4.52/pine/makefile.osf Mon Nov 18 15:35:19 2002 --- pine4.52.I.USE/pine/makefile.osf Tue Jan 14 13:13:49 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.osx pine4.52.I.USE/pine/makefile.osx *** pine4.52/pine/makefile.osx Fri Sep 20 11:22:23 2002 --- pine4.52.I.USE/pine/makefile.osx Tue Jan 14 13:13:49 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.pt1 pine4.52.I.USE/pine/makefile.pt1 *** pine4.52/pine/makefile.pt1 Tue Oct 23 15:24:50 2001 --- pine4.52.I.USE/pine/makefile.pt1 Tue Jan 14 13:13:50 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.ptx pine4.52.I.USE/pine/makefile.ptx *** pine4.52/pine/makefile.ptx Tue Oct 23 15:24:50 2001 --- pine4.52.I.USE/pine/makefile.ptx Tue Jan 14 13:13:50 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.s40 pine4.52.I.USE/pine/makefile.s40 *** pine4.52/pine/makefile.s40 Mon Nov 18 15:35:19 2002 --- pine4.52.I.USE/pine/makefile.s40 Tue Jan 14 13:13:50 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.sc5 pine4.52.I.USE/pine/makefile.sc5 *** pine4.52/pine/makefile.sc5 Tue Oct 23 15:24:51 2001 --- pine4.52.I.USE/pine/makefile.sc5 Tue Jan 14 13:13:50 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.sco pine4.52.I.USE/pine/makefile.sco *** pine4.52/pine/makefile.sco Tue Oct 23 15:24:51 2001 --- pine4.52.I.USE/pine/makefile.sco Tue Jan 14 13:13:50 2003 *************** *** 74,80 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 74,80 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.sgi pine4.52.I.USE/pine/makefile.sgi *** pine4.52/pine/makefile.sgi Tue Oct 23 15:24:51 2001 --- pine4.52.I.USE/pine/makefile.sgi Tue Jan 14 13:13:50 2003 *************** *** 75,81 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 75,81 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.so4 pine4.52.I.USE/pine/makefile.so4 *** pine4.52/pine/makefile.so4 Tue Oct 23 15:24:51 2001 --- pine4.52.I.USE/pine/makefile.so4 Tue Jan 14 13:13:50 2003 *************** *** 81,87 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 81,87 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.so5 pine4.52.I.USE/pine/makefile.so5 *** pine4.52/pine/makefile.so5 Tue Oct 23 15:24:51 2001 --- pine4.52.I.USE/pine/makefile.so5 Tue Jan 14 13:13:50 2003 *************** *** 81,87 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 81,87 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.sun pine4.52.I.USE/pine/makefile.sun *** pine4.52/pine/makefile.sun Mon Nov 18 15:35:20 2002 --- pine4.52.I.USE/pine/makefile.sun Tue Jan 14 13:13:50 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.sv4 pine4.52.I.USE/pine/makefile.sv4 *** pine4.52/pine/makefile.sv4 Tue Oct 23 15:24:52 2001 --- pine4.52.I.USE/pine/makefile.sv4 Tue Jan 14 13:13:50 2003 *************** *** 72,78 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 72,78 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.ult pine4.52.I.USE/pine/makefile.ult *** pine4.52/pine/makefile.ult Mon Nov 18 15:35:20 2002 --- pine4.52.I.USE/pine/makefile.ult Tue Jan 14 13:13:50 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.uw2 pine4.52.I.USE/pine/makefile.uw2 *** pine4.52/pine/makefile.uw2 Tue Oct 23 15:24:52 2001 --- pine4.52.I.USE/pine/makefile.uw2 Tue Jan 14 13:13:50 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/makefile.vul pine4.52.I.USE/pine/makefile.vul *** pine4.52/pine/makefile.vul Mon Nov 18 15:35:20 2002 --- pine4.52.I.USE/pine/makefile.vul Tue Jan 14 13:13:50 2003 *************** *** 73,79 **** OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ --- 73,79 ---- OFILES= addrbook.o adrbkcmd.o adrbklib.o args.o bldaddr.o context.o filter.o \ folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \ mailindx.o mailpart.o mailview.o newmail.o other.o pine.o \ ! reply.o rules.o screen.o send.o signals.o status.o strings.o takeaddr.o \ os.o HFILES= headers.h os.h pine.h context.h helptext.h \ diff -rc pine4.52/pine/newmail.c pine4.52.I.USE/pine/newmail.c *** pine4.52/pine/newmail.c Wed Nov 27 15:22:54 2002 --- pine4.52.I.USE/pine/newmail.c Tue Jan 14 13:13:50 2003 *************** *** 56,64 **** void new_mail_mess PROTO((MAILSTREAM *, char *, long, long)); void fixup_flags PROTO((MAILSTREAM *, MSGNO_S *, long)); - static long mailbox_mail_since_command = 0L, ! inbox_mail_since_command = 0L; /*---------------------------------------------------------------------- new_mail() - check for new mail in the inbox --- 56,64 ---- void new_mail_mess PROTO((MAILSTREAM *, char *, long, long)); void fixup_flags PROTO((MAILSTREAM *, MSGNO_S *, long)); static long mailbox_mail_since_command = 0L, ! inbox_mail_since_command = 0L, ! incoming_folders_new_mail = 0L; /*---------------------------------------------------------------------- new_mail() - check for new mail in the inbox *************** *** 638,648 **** /* * Decide if likewise need to clean up the new mail icon... */ ! if(mailbox_mail_since_command || inbox_mail_since_command) icon_text(NULL); mailbox_mail_since_command = 0L; inbox_mail_since_command = 0L; } --- 638,650 ---- /* * Decide if likewise need to clean up the new mail icon... */ ! if(mailbox_mail_since_command || inbox_mail_since_command || ! incoming_folders_new_mail) icon_text(NULL); mailbox_mail_since_command = 0L; inbox_mail_since_command = 0L; + incoming_folders_new_mail = 0L; } *************** *** 678,680 **** --- 680,869 ---- return(rv); } + /* Check for new mail in incoming folders */ + + int + new_mail_incfolder(state,command) + struct pine *state; + int command; + { + char *folder_checked = NULL; + char list_of_folders[30][32] = {'\0'}; + char message[1024] = {'\0'}; + int number_of_folders = 0; + int is_selected[30] = {0}; + int index = 0; + int i; + FOLDER_S *inc_fld; + + if ((!state->force_check_now) || (state->checking_incfld)){ + state->force_check_now = 1; /* I'll be back, but wait a moment */ + return -1; + } + + i = ps_global->in_init_seq; + ps_global->in_init_seq = 0; /* force output of cue during check */ + check_cue_display("+"); /* Show something to indicate delay */ + MoveCursor(state->ttyo->screen_rows -FOOTER_ROWS(state),0); + fflush(stdout); + ps_global->in_init_seq = i; /* restore original value */ + state->checking_incfld = 1; + if(state->context_current){ + char nextfolder[MAXPATH]; + MAILSTREAM *nextstream = NULL; + long recent_cnt; + CONTEXT_S *incoming_folder_context = state->context_current; + + while (1){ + if (incoming_folder_context->prev) + incoming_folder_context = incoming_folder_context->prev; + else + break; + } + strcpy(nextfolder, state->inbox_name); + + for(index = folder_index(nextfolder, + incoming_folder_context, FI_FOLDER) + 1; + index > 0 && index < folder_total(FOLDERS(incoming_folder_context)) + && (inc_fld = folder_entry(index, FOLDERS(incoming_folder_context))) + && !inc_fld->isdir; index++){ + + strcpy(nextfolder, FLDR_NAME(inc_fld)); + folder_checked = next_folder_check(&nextstream, nextfolder, nextfolder, + incoming_folder_context, &recent_cnt, FALSE,inc_fld); + + if ((folder_checked)){ + number_of_folders++; + strcat(list_of_folders[number_of_folders],folder_checked); + is_selected[number_of_folders] = index; + } + } + if(number_of_folders > 0){ + strcat(message,"New message in folder"); + if (!state->last_message) + state->last_message = cpystr(message); + strcat(message,(number_of_folders > 1) ? "s " : " "); + state->notified = TRUE; + if (number_of_folders > 1){ + for (i = 1; (i <= (number_of_folders - 2)); i++){ + strcat(message,"\""); + strcat(message,list_of_folders[i]); + state->notified = state->notified && folder_in_message_list(list_of_folders[i]); + if (!state->notified) + select_incoming_folder(incoming_folder_context,is_selected[i]); + strcat(message,"\", "); + } + strcat(message,"\""); + strcat(message,list_of_folders[number_of_folders - 1]); + state->notified = state->notified && folder_in_message_list(list_of_folders[number_of_folders - 1]); + if (!state->notified) + select_incoming_folder(incoming_folder_context, + is_selected[number_of_folders - 1]); + strcat(message,"\" and \""); + strcat(message,list_of_folders[number_of_folders]); + + state->notified = state->notified && folder_in_message_list(list_of_folders[number_of_folders]); + if (!state->notified) + select_incoming_folder(incoming_folder_context, + is_selected[number_of_folders]); + strcat(message,"\""); + } + else{ + strcat(message,"\""); + strcat(message,list_of_folders[1]); + state->notified = state->notified && folder_in_message_list(list_of_folders[1]); + if (!state->notified) + select_incoming_folder(incoming_folder_context, is_selected[1]); + strcat(message,"\""); + } + state->last_message = cpystr(message); + state->notified = (state->notified && (number_of_folders <= state->number_of_folders)); + if ((!state->notified && !folder_in_message_list(state->cur_folder)) || (command == MC_FORCECHECK)){ + state->done = FALSE; + state->number_of_folders = number_of_folders; + if (strlen(message) < (state->ttyo->screen_cols - 2)){ + if (command != MC_FORCECHECK){ + q_status_message(SM_ASYNC | SM_DING, 0, 60, message); + icon_text(message); + } + else + q_status_message(SM_ORDER, 0, 2, message); + } + else{ + message[0] = '\0'; + strcat(message,"You have New message in your Incoming Folders."); + if (strlen(message) < (state->ttyo->screen_cols - 2)){ + if (command != MC_FORCECHECK){ + q_status_message(SM_ASYNC | SM_DING, 0, 60, message); + icon_text(message); + } + else + q_status_message(SM_ORDER, 0, 2, message); + } + } + } + } + else{ + if ((command == MC_FORCECHECK) && + (state->vars[V_INCOMING_FOLDERS_CHECK].current_val.p)) + q_status_message(SM_ORDER, 0, 2, + "There are no new messages in Incoming Folders"); + state->last_message = NULL; + } + } + state->checking_incfld = 0; + check_cue_display(" "); /* Erase the + added before */ + MoveCursor(state->ttyo->screen_rows -FOOTER_ROWS(state),0); + incoming_folders_new_mail = number_of_folders; + return number_of_folders; + } + + void + select_incoming_folder(context,index) + CONTEXT_S *context; + int index; + { + FOLDER_S *f; + + dprint(2, (debugfile, "select_incoming_folder called, index = %d\n", + index)); + if ((f = folder_entry(index, FOLDERS(context))) && !f->selected) + f->selected = !f->selected; + } + + + char * + folder_in_list(folder) + char * folder; + { + int length = strlen(folder) + 4; + char *result; + int i; + + result = (char *) fs_get((length)*sizeof(char)); + + result[0] = ' '; /* a space */ + result[1] = '\"'; /* quotes */ + for (i = 0; i < strlen(folder); i++) + result[i+2] = folder[i]; + result[length - 2] = '\"'; + result[length - 1] = '\0'; + return result; + } + + + int + folder_in_message_list(folder) + char *folder; + { + int rv = 0; + char *folderquoted = folder_in_list(folder); + + if (ps_global->last_message && *ps_global->last_message + && strstr(ps_global->last_message, folderquoted)) + rv = 1; + if (folderquoted) + fs_give((void **)&folderquoted); + return rv; + } + diff -rc pine4.52/pine/other.c pine4.52.I.USE/pine/other.c *** pine4.52/pine/other.c Wed Nov 27 15:22:54 2002 --- pine4.52.I.USE/pine/other.c Tue Jan 14 13:13:52 2003 *************** *** 340,347 **** char *checkbox_pretty_value PROTO((struct pine *, CONF_S *)); char *color_pretty_value PROTO((struct pine *, CONF_S *)); char *radio_pretty_value PROTO((struct pine *, CONF_S *)); ! char *sort_pretty_value PROTO((struct pine *, CONF_S *)); ! char *generalized_sort_pretty_value PROTO((struct pine *, CONF_S *, int)); char *yesno_pretty_value PROTO((struct pine *, CONF_S *)); char *sigfile_pretty_value PROTO((struct pine *, CONF_S *)); void set_radio_pretty_vals PROTO((struct pine *, CONF_S **)); --- 340,347 ---- char *checkbox_pretty_value PROTO((struct pine *, CONF_S *)); char *color_pretty_value PROTO((struct pine *, CONF_S *)); char *radio_pretty_value PROTO((struct pine *, CONF_S *)); ! char *sort_pretty_value PROTO((struct pine *, CONF_S *, int)); ! char *generalized_sort_pretty_value PROTO((struct pine *, CONF_S *, int, int)); char *yesno_pretty_value PROTO((struct pine *, CONF_S *)); char *sigfile_pretty_value PROTO((struct pine *, CONF_S *)); void set_radio_pretty_vals PROTO((struct pine *, CONF_S **)); *************** *** 1431,1437 **** if(lv < (j = strlen(sort_name(ps->sort_types[i])))) lv = j; ! decode_sort(pval, &def_sort, &def_sort_rev); for(j = 0; j < 2; j++){ for(i = 0; ps->sort_types[i] != EndofList; i++){ --- 1431,1437 ---- if(lv < (j = strlen(sort_name(ps->sort_types[i])))) lv = j; ! decode_sort(pval, &def_sort, &def_sort_rev, 0); for(j = 0; j < 2; j++){ for(i = 0; ps->sort_types[i] != EndofList; i++){ *************** *** 1446,1451 **** --- 1446,1498 ---- } } } + else if(vtmp == &ps->vars[V_THREAD_SORT_KEY]){ /* radio case */ + SortOrder thread_def_sort; + int thread_def_sort_rev; + + ctmpa->flags |= CF_NOSELECT; + ctmpa->keymenu = &config_radiobutton_keymenu; + ctmpa->tool = NULL; + + /* put a nice delimiter before list */ + new_confline(&ctmpa)->var = NULL; + ctmpa->varnamep = ctmpb; + ctmpa->keymenu = &config_radiobutton_keymenu; + ctmpa->help = NO_HELP; + ctmpa->tool = radiobutton_tool; + ctmpa->valoffset = 12; + ctmpa->flags |= CF_NOSELECT; + ctmpa->value = cpystr("Set Thread Sort Options"); + + new_confline(&ctmpa)->var = NULL; + ctmpa->varnamep = ctmpb; + ctmpa->keymenu = &config_radiobutton_keymenu; + ctmpa->help = NO_HELP; + ctmpa->tool = radiobutton_tool; + ctmpa->valoffset = 12; + ctmpa->flags |= CF_NOSELECT; + ctmpa->value = cpystr("--- ----------------------"); + + /* find longest value's name */ + for(lv = 0, i = 0; ps->sort_types[i] != EndofList; i++) + if(lv < (j = strlen(sort_name(ps->sort_types[i])))) + lv = j; + + decode_sort(pval, &thread_def_sort, &thread_def_sort_rev, 1); + + for(j = 0; j < 2; j++){ + for(i = 0; ps->sort_types[i] != EndofList; i++){ + new_confline(&ctmpa)->var = vtmp; + ctmpa->varnamep = ctmpb; + ctmpa->keymenu = &config_radiobutton_keymenu; + ctmpa->help = config_help(vtmp - ps->vars, 0); + ctmpa->tool = radiobutton_tool; + ctmpa->valoffset = 12; + ctmpa->varmem = i + (j * EndofList); + ctmpa->value = pretty_value(ps, ctmpa); + } + } + } else if(vtmp == &ps->vars[V_USE_ONLY_DOMAIN_NAME]){ /* yesno case */ ctmpa->keymenu = &config_yesno_keymenu; ctmpa->tool = yesno_tool; *************** *** 1592,1597 **** --- 1639,1653 ---- } } + pval = PVAL(&ps->vars[V_THREAD_SORT_KEY], ew); + if(vsave[V_THREAD_SORT_KEY].saved_user_val.p && pval + && strcmp(vsave[V_THREAD_SORT_KEY].saved_user_val.p, pval)){ + if(!mn_get_mansort(ps_global->msgmap)){ + clear_index_cache(); + reset_sort_order(SRT_VRB); + } + } + treat_color_vars_as_text = 0; free_saved_config(ps, &vsave, expose_hidden_config); #ifdef _WINDOWS *************** *** 1743,1749 **** CONF_S *ctmp; if(!(cl && *cl && ! ((*cl)->var == &ps->vars[V_SORT_KEY] || standard_radio_var(ps, (*cl)->var) || (*cl)->var == startup_ptr))) return; --- 1799,1806 ---- CONF_S *ctmp; if(!(cl && *cl && ! (((*cl)->var == &ps->vars[V_SORT_KEY]) || ! ((*cl)->var == &ps->vars[V_THREAD_SORT_KEY]) || standard_radio_var(ps, (*cl)->var) || (*cl)->var == startup_ptr))) return; *************** *** 2625,2630 **** --- 2682,2688 ---- if(reinit_contexts){ free_contexts(&ps_global->context_list); init_folders(ps_global); + init_newsrc(ps_global); } return; *************** *** 2783,2788 **** --- 2841,2847 ---- if(reinit_contexts){ free_contexts(&ps_global->context_list); init_folders(ps_global); + init_newsrc(ps_global); } } *************** *** 6168,6174 **** int multicol; { char tmp[MAXPATH+1]; ! int cmd, i, j, ch = 'x', done = 0, changes = 0; int retval = 0; int km_popped = 0, stay_in_col = 0; struct key_menu *km = NULL; --- 6227,6233 ---- int multicol; { char tmp[MAXPATH+1]; ! int cmd, i, j, k = 1, ch = 'x', done = 0, changes = 0; int retval = 0; int km_popped = 0, stay_in_col = 0; struct key_menu *km = NULL; *************** *** 6211,6216 **** --- 6270,6276 ---- } /*----------- Check for new mail -----------*/ + if (!ps->send_immediately){ if(new_mail(0, NM_TIMING(ch), NM_STATUS_MSG | NM_DEFER_SORT) >= 0) ps->mangled_header = 1; *************** *** 6329,6337 **** #ifdef _WINDOWS mswin_setscrollcallback(NULL); #endif - cmd = menu_command(ch, km); - if(km_popped) switch(cmd){ case MC_NONE: --- 6389,6412 ---- #ifdef _WINDOWS mswin_setscrollcallback(NULL); #endif + } /* send_immediately */ + + if (ps->send_immediately){ + ch = (char) ps->free_initial_cmds[k++]; + if (ch == 'n') + cmd = MC_CHARDOWN; + if (ch == 'p') + cmd = MC_CHARDOWN; + if (ch == '\r'){ + cmd = MC_CHOICE; + role_select_tool(ps, cmd, &screen->current, 512); + } + if (ch == '\030') /* ^X, bye */ + goto end; + } + else + cmd = menu_command(ch, km); if(km_popped) switch(cmd){ case MC_NONE: *************** *** 6990,6996 **** break; } } ! screen->current = first_confline(screen->current); free_conflines(&screen->current); return(retval); --- 7065,7071 ---- break; } } ! end: screen->current = first_confline(screen->current); free_conflines(&screen->current); return(retval); *************** *** 7133,7138 **** --- 7208,7215 ---- return(h_config_nntp_server); case V_INBOX_PATH : return(h_config_inbox_path); + case V_INCOMING_FOLDERS_CHECK : + return(h_config_check_inc_fld); case V_PRUNED_FOLDERS : return(h_config_pruned_folders); case V_DEFAULT_FCC : *************** *** 7165,7174 **** --- 7242,7277 ---- return(h_config_fcc_rule); case V_SORT_KEY : return(h_config_sort_key); + case V_THREAD_SORT_KEY : + return(h_config_thread_sort_key); case V_AB_SORT_RULE : return(h_config_ab_sort_rule); case V_FLD_SORT_RULE : return(h_config_fld_sort_rule); + case V_COMPOSE_RULES: + return(h_config_compose_rules); + case V_FORWARD_RULES: + return(h_config_forward_rules); + case V_REPLY_RULES: + return(h_config_reply_rules); + case V_INDEX_RULES: + return(h_config_index_rules); + case V_REPLACE_RULES: + return(h_config_replace_rules); + case V_REPLY_INDENT_RULES: + return(h_config_reply_indent_rules); + case V_REPLY_LEADIN_RULES: + return(h_config_reply_leadin_rules); + case V_RESUB_RULES: + return(h_config_resub_rules); + case V_SAVE_RULES: + return(h_config_save_rules); + case V_SMTP_RULES: + return(h_config_smtp_rules); + case V_SORT_RULES: + return(h_config_sort_rules); + case V_STARTUP_RULES: + return(h_config_startup_rules); case V_CHAR_SET : return(h_config_char_set); case V_EDITOR : *************** *** 8787,8793 **** /* clear all hidden and collapsed flags */ set_lflags(ps->mail_stream, ps->msgmap, MN_COLL | MN_CHID, 0); ! if(SEP_THRDINDX() && SORT_IS_THREADED()) unview_thread(ps, ps->mail_stream, ps->msgmap); if(SORT_IS_THREADED() && (SEP_THRDINDX() || COLL_THRDS())) --- 8890,8896 ---- /* clear all hidden and collapsed flags */ set_lflags(ps->mail_stream, ps->msgmap, MN_COLL | MN_CHID, 0); ! if(SEP_THRDINDX() && SORT_IS_THREADED()) unview_thread(ps, ps->mail_stream, ps->msgmap); if(SORT_IS_THREADED() && (SEP_THRDINDX() || COLL_THRDS())) *************** *** 8906,8912 **** } set_current_val((*cl)->var, TRUE, TRUE); ! if(decode_sort(ps->VAR_SORT_KEY, &def_sort, &def_sort_rev) != -1){ ps->def_sort = def_sort; ps->def_sort_rev = def_sort_rev; } --- 9009,9015 ---- } set_current_val((*cl)->var, TRUE, TRUE); ! if(decode_sort(ps->VAR_SORT_KEY, &def_sort, &def_sort_rev,0) != -1){ ps->def_sort = def_sort; ps->def_sort_rev = def_sort_rev; } *************** *** 8915,8920 **** --- 9018,9054 ---- ps->mangled_body = 1; /* BUG: redraw it all for now? */ rv = 1; } + else if((*cl)->var == &ps->vars[V_THREAD_SORT_KEY]){ + SortOrder thread_def_sort; + int thread_def_sort_rev; + + thread_def_sort_rev = (*cl)->varmem >= (short) EndofList; + thread_def_sort = (SortOrder) ((*cl)->varmem - (thread_def_sort_rev + * EndofList)); + sprintf(tmp_20k_buf, "%s%s", sort_name(thread_def_sort), + (thread_def_sort_rev) ? "/Reverse" : ""); + + if((*cl)->var->cmdline_val.p) + fs_give((void **)&(*cl)->var->cmdline_val.p); + + if(apval){ + if(*apval) + fs_give((void **)apval); + + *apval = cpystr(tmp_20k_buf); + } + + set_current_val((*cl)->var, TRUE, TRUE); + if(decode_sort(ps->VAR_THREAD_SORT_KEY, &thread_def_sort, + &thread_def_sort_rev, 1) != -1){ + ps->thread_def_sort = thread_def_sort; + ps->thread_def_sort_rev = thread_def_sort_rev; + } + + set_radio_pretty_vals(ps, cl); + ps->mangled_body = 1; /* BUG: redraw it all for now? */ + rv = 1; + } else q_status_message(SM_ORDER | SM_DING, 3, 6, "Programmer botch! Unknown radiobutton type."); *************** *** 10387,10393 **** else if(standard_radio_var(ps, v) || v == startup_ptr) return(radio_pretty_value(ps, cl)); else if(v == &ps->vars[V_SORT_KEY]) ! return(sort_pretty_value(ps, cl)); else if(v == &ps->vars[V_SIGNATURE_FILE]) return(sigfile_pretty_value(ps, cl)); else if(v == &ps->vars[V_USE_ONLY_DOMAIN_NAME]) --- 10521,10529 ---- else if(standard_radio_var(ps, v) || v == startup_ptr) return(radio_pretty_value(ps, cl)); else if(v == &ps->vars[V_SORT_KEY]) ! return(sort_pretty_value(ps, cl, 0)); ! else if(v == &ps->vars[V_THREAD_SORT_KEY]) ! return(sort_pretty_value(ps, cl, 1)); else if(v == &ps->vars[V_SIGNATURE_FILE]) return(sigfile_pretty_value(ps, cl)); else if(v == &ps->vars[V_USE_ONLY_DOMAIN_NAME]) *************** *** 11056,11074 **** char * ! sort_pretty_value(ps, cl) struct pine *ps; CONF_S *cl; { ! return(generalized_sort_pretty_value(ps, cl, 1)); } char * ! generalized_sort_pretty_value(ps, cl, default_ok) struct pine *ps; CONF_S *cl; int default_ok; { char tmp[MAXPATH]; char *pvalnorm, *pvalexc, *pval; --- 11192,11212 ---- char * ! sort_pretty_value(ps, cl, thread) struct pine *ps; CONF_S *cl; + int thread; { ! return(generalized_sort_pretty_value(ps, cl, 1, thread)); } char * ! generalized_sort_pretty_value(ps, cl, default_ok, thread) struct pine *ps; CONF_S *cl; int default_ok; + int thread; { char tmp[MAXPATH]; char *pvalnorm, *pvalexc, *pval; *************** *** 11118,11124 **** } else if(fixed){ pval = v->fixed_val.p; ! decode_sort(pval, &var_sort, &var_sort_rev); is_the_one = (var_sort_rev == line_sort_rev && var_sort == line_sort); sprintf(tmp, "(%c) %s%-*s%*s%s", --- 11256,11262 ---- } else if(fixed){ pval = v->fixed_val.p; ! decode_sort(pval, &var_sort, &var_sort_rev, thread); is_the_one = (var_sort_rev == line_sort_rev && var_sort == line_sort); sprintf(tmp, "(%c) %s%-*s%*s%s", *************** *** 11129,11137 **** is_the_one ? " (value is fixed)" : ""); } else if(is_set_for_this_level){ ! decode_sort(pval, &var_sort, &var_sort_rev); is_the_one = (var_sort_rev == line_sort_rev && var_sort == line_sort); ! decode_sort(pvalexc, &exc_sort, &exc_sort_rev); the_exc_one = (editing_normal_which_isnt_except && pvalexc && exc_sort_rev == line_sort_rev && exc_sort == line_sort); sprintf(tmp, "(%c) %s%-*s%*s%s", --- 11267,11275 ---- is_the_one ? " (value is fixed)" : ""); } else if(is_set_for_this_level){ ! decode_sort(pval, &var_sort, &var_sort_rev, thread); is_the_one = (var_sort_rev == line_sort_rev && var_sort == line_sort); ! decode_sort(pvalexc, &exc_sort, &exc_sort_rev, thread); the_exc_one = (editing_normal_which_isnt_except && pvalexc && exc_sort_rev == line_sort_rev && exc_sort == line_sort); sprintf(tmp, "(%c) %s%-*s%*s%s", *************** *** 11149,11155 **** } else{ if(pvalexc){ ! decode_sort(pvalexc, &exc_sort, &exc_sort_rev); is_the_one = (exc_sort_rev == line_sort_rev && exc_sort == line_sort); sprintf(tmp, "( ) %s%-*s%*s%s", --- 11287,11293 ---- } else{ if(pvalexc){ ! decode_sort(pvalexc, &exc_sort, &exc_sort_rev, thread); is_the_one = (exc_sort_rev == line_sort_rev && exc_sort == line_sort); sprintf(tmp, "( ) %s%-*s%*s%s", *************** *** 11160,11166 **** } else{ pval = v->current_val.p; ! decode_sort(pval, &var_sort, &var_sort_rev); is_the_one = ((pval || default_ok) && var_sort_rev == line_sort_rev && var_sort == line_sort); --- 11298,11304 ---- } else{ pval = v->current_val.p; ! decode_sort(pval, &var_sort, &var_sort_rev, thread); is_the_one = ((pval || default_ok) && var_sort_rev == line_sort_rev && var_sort == line_sort); *************** *** 11357,11363 **** --- 11495,11513 ---- cl->value = pretty_value(ps, cl); } + if (f->id == F_ENHANCED_THREAD && ps->mail_stream + && SORT_IS_THREADED()){ + refresh_sort(ps->msgmap, SRT_NON); + if (COLL_THRDS()) /* sortring by thread destroys collapsed info */ + kolapse_thread(ps, ps->mail_stream, ps->msgmap,'[', 0); + if(SEP_THRDINDX() && SORT_IS_THREADED() && ps->viewing_a_thread){ + unview_thread(ps, ps->mail_stream, ps->msgmap); + view_thread(ps, ps->mail_stream, ps->msgmap, 0); + ps_global->next_screen = SCREEN_FUN_NULL; + } + } + /* * Handle any features that need special attention here... */ *************** *** 12325,12333 **** else if(revert && var == &ps->vars[V_SORT_KEY]){ int def_sort_rev; ! decode_sort(VAR_SORT_KEY, &ps->def_sort, &def_sort_rev); ps->def_sort_rev = def_sort_rev; } else if(var == &ps->vars[V_THREAD_MORE_CHAR] || var == &ps->vars[V_THREAD_EXP_CHAR] || var == &ps->vars[V_THREAD_LASTREPLY_CHAR]){ --- 12475,12489 ---- else if(revert && var == &ps->vars[V_SORT_KEY]){ int def_sort_rev; ! decode_sort(VAR_SORT_KEY, &ps->def_sort, &def_sort_rev, 0); ps->def_sort_rev = def_sort_rev; } + else if(revert && var == &ps->vars[V_THREAD_SORT_KEY]){ + int thread_def_sort_rev; + + decode_sort(VAR_THREAD_SORT_KEY, &ps->thread_def_sort, &thread_def_sort_rev, 1); + ps->thread_def_sort_rev = thread_def_sort_rev; + } else if(var == &ps->vars[V_THREAD_MORE_CHAR] || var == &ps->vars[V_THREAD_EXP_CHAR] || var == &ps->vars[V_THREAD_LASTREPLY_CHAR]){ *************** *** 12381,12386 **** --- 12537,12543 ---- else if(var == &ps->vars[V_NNTP_SERVER]){ free_contexts(&ps_global->context_list); init_folders(ps_global); + init_newsrc(ps_global); } else if(var == &ps->vars[V_USE_ONLY_DOMAIN_NAME]){ init_hostname(ps); *************** *** 12780,12813 **** if(!(nonempty_patterns(rflags, &pstate) && first_pattern(&pstate))){ q_status_message(SM_ORDER, 0, 3, "No roles available. Use Setup/Rules to add roles."); return(ret); } ! ! if(alt_compose){ menu_init_binding(&role_select_km, 'C', MC_CHOICE, "C", "[ComposeAs]", DEFAULT_KEY); menu_add_binding(&role_select_km, ctrl('J'), MC_CHOICE); menu_add_binding(&role_select_km, ctrl('M'), MC_CHOICE); ! } ! else{ menu_init_binding(&role_select_km, 'S', MC_CHOICE, "S", "[Select]", DEFAULT_KEY); menu_add_binding(&role_select_km, ctrl('J'), MC_CHOICE); menu_add_binding(&role_select_km, ctrl('M'), MC_CHOICE); ! } ! if(alt_compose){ helptitle = "HELP FOR SELECTING A ROLE TO COMPOSE AS"; help = h_role_select; ! } ! else{ helptitle = "HELP FOR SELECTING A ROLE NICKNAME"; help = h_role_nick_select; } - for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ --- 12937,12975 ---- if(!(nonempty_patterns(rflags, &pstate) && first_pattern(&pstate))){ + if (!ps->send_immediately) q_status_message(SM_ORDER, 0, 3, "No roles available. Use Setup/Rules to add roles."); + else{ + printf("No roles available. Use Setup/Rules to add roles."); + exit(-1); + } return(ret); } ! if (!ps->send_immediately){ ! if(alt_compose){ menu_init_binding(&role_select_km, 'C', MC_CHOICE, "C", "[ComposeAs]", DEFAULT_KEY); menu_add_binding(&role_select_km, ctrl('J'), MC_CHOICE); menu_add_binding(&role_select_km, ctrl('M'), MC_CHOICE); ! } ! else{ menu_init_binding(&role_select_km, 'S', MC_CHOICE, "S", "[Select]", DEFAULT_KEY); menu_add_binding(&role_select_km, ctrl('J'), MC_CHOICE); menu_add_binding(&role_select_km, ctrl('M'), MC_CHOICE); ! } ! if(alt_compose){ helptitle = "HELP FOR SELECTING A ROLE TO COMPOSE AS"; help = h_role_select; ! } ! else{ helptitle = "HELP FOR SELECTING A ROLE NICKNAME"; help = h_role_nick_select; + } } for(pat = first_pattern(&pstate); pat; pat = next_pattern(&pstate)){ *************** *** 16890,16896 **** pval = PVAL(&sort_act_var, ew); if(pval) ! decode_sort(pval, &def_sort, &def_sort_rev); /* allow user to set their default sort order */ new_confline(&ctmp)->var = &sort_act_var; --- 17052,17058 ---- pval = PVAL(&sort_act_var, ew); if(pval) ! decode_sort(pval, &def_sort, &def_sort_rev, 0); /* allow user to set their default sort order */ new_confline(&ctmp)->var = &sort_act_var; *************** *** 16900,16906 **** ctmp->tool = role_sort_tool; ctmp->valoffset = 12; ctmp->varmem = -1; ! ctmp->value = generalized_sort_pretty_value(ps, ctmp, 0); for(j = 0; j < 2; j++){ for(i = 0; ps->sort_types[i] != EndofList; i++){ --- 17062,17068 ---- ctmp->tool = role_sort_tool; ctmp->valoffset = 12; ctmp->varmem = -1; ! ctmp->value = generalized_sort_pretty_value(ps, ctmp, 0, 0); for(j = 0; j < 2; j++){ for(i = 0; ps->sort_types[i] != EndofList; i++){ *************** *** 16912,16918 **** ctmp->valoffset = 12; ctmp->varmem = i + (j * EndofList); ctmp->value = generalized_sort_pretty_value(ps, ctmp, ! 0); } } --- 17074,17080 ---- ctmp->valoffset = 12; ctmp->varmem = i + (j * EndofList); ctmp->value = generalized_sort_pretty_value(ps, ctmp, ! 0, 0); } } *************** *** 17719,17725 **** (*result)->patgrp->stat_8bitsubj = PAT_STAT_EITHER; if(sort_act){ ! decode_sort(sort_act, &def_sort, &def_sort_rev); (*result)->action->sort_is_set = 1; (*result)->action->sortorder = def_sort; (*result)->action->revsort = (def_sort_rev ? 1 : 0); --- 17881,17887 ---- (*result)->patgrp->stat_8bitsubj = PAT_STAT_EITHER; if(sort_act){ ! decode_sort(sort_act, &def_sort, &def_sort_rev, 0); (*result)->action->sort_is_set = 1; (*result)->action->sortorder = def_sort; (*result)->action->revsort = (def_sort_rev ? 1 : 0); *************** *** 19921,19926 **** --- 20083,20093 ---- if(apval) *apval = (role && role->nick) ? cpystr(role->nick) : NULL; + + if (ps_global->role) + fs_give((void **)&ps_global->role); + if (role && role->nick) + ps_global->role = cpystr(role->nick); if((*cl)->value) fs_give((void **)&((*cl)->value)); diff -rc pine4.52/pine/pine.c pine4.52.I.USE/pine/pine.c *** pine4.52/pine/pine.c Wed Nov 27 15:22:54 2002 --- pine4.52.I.USE/pine/pine.c Tue Jan 14 13:13:53 2003 *************** *** 239,244 **** --- 239,245 ---- pine_state = (struct pine *)fs_get(sizeof (struct pine)); memset((void *)pine_state, 0, sizeof(struct pine)); ps_global = pine_state; + ps_global->thread_def_sort = SortDate; ps_global->def_sort = SortArrival; ps_global->sort_types[0] = SortSubject; ps_global->sort_types[1] = SortArrival; *************** *** 251,261 **** --- 252,271 ---- ps_global->sort_types[8] = SortScore; ps_global->sort_types[9] = SortThread; ps_global->sort_types[10] = EndofList; + ps_global->number_of_folders = 0; + ps_global->in_pico = 0; + ps_global->in_fld_list = 0; + ps_global->force_check_now = 1; + ps_global->delay = 1; + ps_global->last_message = NULL; + ps_global->done = TRUE; ps_global->atmts = (ATTACH_S *) fs_get(sizeof(ATTACH_S)); ps_global->atmts_allocated = 1; ps_global->atmts->description = NULL; ps_global->low_speed = 1; ps_global->init_context = -1; + ps_global->exiting = 0; + ps_global->role = NULL; mn_init(&ps_global->msgmap, 0L); init_init_vars(ps_global); ps_global->time_of_last_input = time((time_t *)0); *************** *** 330,336 **** pine_args(pine_state, argc, argv, &args); #ifndef _WINDOWS ! if(!isatty(0)){ /* * monkey with descriptors so our normal tty i/o routines don't * choke... --- 340,346 ---- pine_args(pine_state, argc, argv, &args); #ifndef _WINDOWS ! if((!pine_state->send_immediately) && !isatty(0)){ /* * monkey with descriptors so our normal tty i/o routines don't * choke... *************** *** 481,486 **** --- 491,501 ---- } init_vars(pine_state); + if (args.action == aaFolder && !args.data.folder && + ps_global->send_immediately){ + printf("No value for To: field specified\n"); + exit(-1); + } if(ps_global->convert_sigs){ if(convert_sigs_to_literal(ps_global, 0) == -1){ *************** *** 624,630 **** init_signals(); /*--- input side ---*/ ! if(init_tty_driver(pine_state)){ #if !defined(DOS) && !defined(OS2) /* always succeeds under DOS! */ fprintf(stderr, "Can't access terminal or input is not a terminal. "); fprintf(stderr, "Redirection of\nstandard input is not allowed. For "); --- 639,645 ---- init_signals(); /*--- input side ---*/ ! if((!pine_state->send_immediately) && (init_tty_driver(pine_state))){ #if !defined(DOS) && !defined(OS2) /* always succeeds under DOS! */ fprintf(stderr, "Can't access terminal or input is not a terminal. "); fprintf(stderr, "Redirection of\nstandard input is not allowed. For "); *************** *** 633,640 **** #endif } - /*--- output side ---*/ rv = config_screen(&(pine_state->ttyo)); #if !defined(DOS) && !defined(OS2) /* always succeeds under DOS! */ if(rv){ --- 648,655 ---- #endif } /*--- output side ---*/ + if (!ps_global->send_immediately){ rv = config_screen(&(pine_state->ttyo)); #if !defined(DOS) && !defined(OS2) /* always succeeds under DOS! */ if(rv){ *************** *** 659,675 **** exit(-1); } #endif if(F_ON(F_BLANK_KEYMENU,ps_global)) FOOTER_ROWS(ps_global) = 1; init_screen(); ! init_keyboard(pine_state->orig_use_fkeys); strcpy(pine_state->inbox_name, INBOX_NAME); init_folders(pine_state); /* digest folder spec's */ pine_state->in_init_seq = 0; /* so output (& ClearScreen) show up */ pine_state->dont_use_init_cmds = 1; /* don't use up initial_commands yet */ ClearScreen(); #ifdef DEBUG --- 674,696 ---- exit(-1); } #endif + } + else + fake_config_screen(&(pine_state->ttyo)); if(F_ON(F_BLANK_KEYMENU,ps_global)) FOOTER_ROWS(ps_global) = 1; + if (!pine_state->send_immediately){ init_screen(); ! init_keyboard(pine_state->orig_use_fkeys);} strcpy(pine_state->inbox_name, INBOX_NAME); init_folders(pine_state); /* digest folder spec's */ + init_newsrc(pine_state); /* initialize .newsrc-server files */ pine_state->in_init_seq = 0; /* so output (& ClearScreen) show up */ pine_state->dont_use_init_cmds = 1; /* don't use up initial_commands yet */ + if (!pine_state->send_immediately) ClearScreen(); #ifdef DEBUG *************** *** 704,710 **** goodnight_gracey(pine_state, exit_val); } ! if(args.action == aaFolder && (pine_state->first_time_user || pine_state->show_new_version)){ pine_state->mangled_header = 1; show_main_screen(pine_state, 0, FirstMenu, &main_keymenu, 0, (Pos *)NULL); --- 725,731 ---- goodnight_gracey(pine_state, exit_val); } ! if(!pine_state->send_immediately && args.action == aaFolder && (pine_state->first_time_user || pine_state->show_new_version)){ pine_state->mangled_header = 1; show_main_screen(pine_state, 0, FirstMenu, &main_keymenu, 0, (Pos *)NULL); *************** *** 815,821 **** --- 836,851 ---- int len, good_addr = 1; int exit_val = 0; BUILDER_ARG fcc; + ACTION_S *role; + if ((pine_state->in_init_seq) && (pine_state->send_immediately)){ + if (((char) pine_state->free_initial_cmds[0]) == '#'){ + role_select_screen(pine_state, &role, 1); + } + else role = NULL; + } + else role = NULL; + if(pine_state->in_init_seq){ pine_state->in_init_seq = pine_state->save_in_init_seq = 0; clear_cursor_pos(); *************** *** 850,856 **** memset(&fcc, 0, sizeof(fcc)); if(good_addr){ ! compose_mail(addr, fcc.tptr, NULL, args.data.mail.attachlist, stdin_getc); } else{ --- 880,886 ---- memset(&fcc, 0, sizeof(fcc)); if(good_addr){ ! compose_mail(addr, fcc.tptr, role, args.data.mail.attachlist, stdin_getc); } else{ *************** *** 884,889 **** --- 914,920 ---- pine_state->mail_stream = NULL; pine_state->inbox_stream = NULL; pine_state->mangled_screen = 1; + pine_state->subject = NULL; if(args.action == aaURL){ url_tool_t f; *************** *** 952,957 **** --- 983,989 ---- "mail folder"); } + if (!pine_state->send_immediately) fflush(stdout); if(pine_state->in_init_seq){ *************** *** 1103,1109 **** pine_state->in_init_seq = pine_state->save_in_init_seq; pine_state->dont_use_init_cmds = 0; ! clear_cursor_pos(); if(pine_state->give_fixed_warning) q_status_message(SM_ASYNC, 0, 10, --- 1135,1142 ---- pine_state->in_init_seq = pine_state->save_in_init_seq; pine_state->dont_use_init_cmds = 0; ! if (!pine_state->send_immediately) ! clear_cursor_pos(); if(pine_state->give_fixed_warning) q_status_message(SM_ASYNC, 0, 10, *************** *** 2940,2946 **** { int quit = 0; ! dprint(1, (debugfile, "\n\n ---- QUIT SCREEN ----\n")); if(F_ON(F_CHECK_MAIL_ONQUIT,ps_global) && new_mail(1, VeryBadTime, NM_STATUS_MSG | NM_DEFER_SORT) >= 0 --- 2973,2980 ---- { int quit = 0; ! dprint(1, (debugfile, "\n\n ---- QUIT SCREEN ----\n")); ! ps_global->in_pico = 1; /* we are leaving anyway */ if(F_ON(F_CHECK_MAIL_ONQUIT,ps_global) && new_mail(1, VeryBadTime, NM_STATUS_MSG | NM_DEFER_SORT) >= 0 *************** *** 3006,3011 **** --- 3040,3046 ---- pine_state->msgmap = pine_state->inbox_msgmap; pine_state->expunge_count = 0L; pine_state->dead_stream = pine_state->dead_inbox; + sprintf(pine_state->cur_folder, pine_state->inbox_name); expunge_and_close(pine_state->inbox_stream, NULL, pine_state->inbox_name, &final_msg); mn_give(&pine_state->msgmap); *************** *** 3052,3063 **** else strcpy(msg, pf); end_stream_cache(); end_screen(msg, exit_val); end_titlebar(); end_keymenu(); ! end_keyboard(F_ON(F_USE_FK,pine_state)); end_tty_driver(pine_state); #if !defined(DOS) && !defined(OS2) kbdestroy(kbesc); --- 3087,3099 ---- else strcpy(msg, pf); + if (!pine_state->send_immediately){ end_stream_cache(); end_screen(msg, exit_val); end_titlebar(); end_keymenu(); ! end_keyboard(F_ON(F_USE_FK,pine_state));} end_tty_driver(pine_state); #if !defined(DOS) && !defined(OS2) kbdestroy(kbesc); *************** *** 3662,3675 **** was_invisible = (mc->spare || mc->spare4) ? 1 : 0; if(chk_thrd_cnt = ((msgs->visible_threads >= 0L) && THRD_INDX_ENABLED() && (f & MN_HIDE) && (mc->spare != v))){ - thrd = fetch_thread(stream, rawno); if(thrd && thrd->top){ ! if(thrd->top == thrd->rawno) topthrd = thrd; else ! topthrd = fetch_thread(stream, thrd->top); } if(topthrd){ --- 3698,3715 ---- was_invisible = (mc->spare || mc->spare4) ? 1 : 0; + thrd = fetch_thread(stream, rawno); + if (thrd && !thrd->next){ + if ((f & MN_HIDE) || (f & MN_CHID)) + thrd->flags = v; + } if(chk_thrd_cnt = ((msgs->visible_threads >= 0L) && THRD_INDX_ENABLED() && (f & MN_HIDE) && (mc->spare != v))){ if(thrd && thrd->top){ ! if(top_thread(stream,thrd->top) == thrd->rawno) topthrd = thrd; else ! topthrd = fetch_thread(stream, top_thread(stream,thrd->top)); } if(topthrd){ *************** *** 3962,3968 **** --- 4002,4023 ---- panic(buf2); } + /* return the newsrc corresponding to the server */ + + char * + pine_set_newsrc (stream,tmp,newsrc) + MAILSTREAM *stream; + char *tmp; + char *newsrc; + { + /* At this time we just want to return the name suggested by c-client, + * we don't do any effort to change the idea of c-client, maybe in future + * versions this will change + */ + return tmp; + } + /* * Pine wrapper around mail_open. If we have the PREFER_ALT_AUTH flag turned * on, we need to set the TRYALT flag before trying the open. *************** *** 3999,4004 **** --- 4054,4061 ---- dprint(9, (debugfile, "pine_mail_open: attempting to re-use stream\n")); } + + flags |= OP_MULNEWSRC; /* * When we pass a stream to mail_open, it will either re-use it or diff -rc pine4.52/pine/pine.h pine4.52.I.USE/pine/pine.h *** pine4.52/pine/pine.h Thu Dec 19 14:05:44 2002 --- pine4.52.I.USE/pine/pine.h Tue Jan 14 13:33:38 2003 *************** *** 456,461 **** --- 456,462 ---- #define NM_STATUS_MSG 0x01 #define NM_DEFER_SORT 0x02 + #define DF_THREAD_SORT_KEY "date" /* * Macro to help compare two chars without regard to case *************** *** 522,527 **** --- 523,529 ---- , V_SMTP_SERVER , V_NNTP_SERVER , V_INBOX_PATH + , V_INCOMING_FOLDERS_CHECK , V_ARCHIVED_FOLDERS , V_PRUNED_FOLDERS , V_DEFAULT_FCC *************** *** 539,544 **** --- 541,547 ---- , V_SAVED_MSG_NAME_RULE , V_FCC_RULE , V_SORT_KEY + , V_THREAD_SORT_KEY , V_AB_SORT_RULE , V_FLD_SORT_RULE , V_GOTO_DEFAULT_RULE *************** *** 549,554 **** --- 552,569 ---- , V_THREAD_MORE_CHAR , V_THREAD_EXP_CHAR , V_THREAD_LASTREPLY_CHAR + , V_COMPOSE_RULES + , V_FORWARD_RULES + , V_REPLY_RULES + , V_INDEX_RULES + , V_REPLACE_RULES + , V_REPLY_INDENT_RULES + , V_REPLY_LEADIN_RULES + , V_RESUB_RULES + , V_SAVE_RULES + , V_SMTP_RULES + , V_SORT_RULES + , V_STARTUP_RULES , V_CHAR_SET , V_EDITOR , V_SPELLER *************** *** 721,726 **** --- 736,744 ---- #define VAR_INBOX_PATH vars[V_INBOX_PATH].current_val.p #define GLO_INBOX_PATH vars[V_INBOX_PATH].global_val.p #define VAR_INCOMING_FOLDERS vars[V_INCOMING_FOLDERS].current_val.l + #define VAR_INCOMING_FOLDERS_CHECK vars[V_INCOMING_FOLDERS_CHECK].current_val.l + #define GLO_INCOMING_FOLDERS_CHECK vars[V_INCOMING_FOLDERS_CHECK].global_val.l + #define USR_INCOMING_FOLDERS_CHECK vars[V_INCOMING_FOLDERS_CHECK].user_val.l #define VAR_FOLDER_SPEC vars[V_FOLDER_SPEC].current_val.l #define GLO_FOLDER_SPEC vars[V_FOLDER_SPEC].global_val.l #define VAR_NEWS_SPEC vars[V_NEWS_SPEC].current_val.l *************** *** 770,779 **** --- 788,836 ---- #define VAR_SORT_KEY vars[V_SORT_KEY].current_val.p #define GLO_SORT_KEY vars[V_SORT_KEY].global_val.p #define COM_SORT_KEY vars[V_SORT_KEY].cmdline_val.p + #define VAR_THREAD_SORT_KEY vars[V_THREAD_SORT_KEY].current_val.p + #define GLO_THREAD_SORT_KEY vars[V_THREAD_SORT_KEY].global_val.p + #define COM_THREAD_SORT_KEY vars[V_THREAD_SORT_KEY].cmdline_val.p #define VAR_AB_SORT_RULE vars[V_AB_SORT_RULE].current_val.p #define GLO_AB_SORT_RULE vars[V_AB_SORT_RULE].global_val.p #define VAR_FLD_SORT_RULE vars[V_FLD_SORT_RULE].current_val.p #define GLO_FLD_SORT_RULE vars[V_FLD_SORT_RULE].global_val.p + #define VAR_COMPOSE_RULES vars[V_COMPOSE_RULES].current_val.l + #define GLO_COMPOSE_RULES vars[V_COMPOSE_RULES].global_val.l + #define USR_COMPOSE_RULES vars[V_COMPOSE_RULES].user_val.l + #define VAR_FORWARD_RULES vars[V_FORWARD_RULES].current_val.l + #define GLO_FORWARD_RULES vars[V_FORWARD_RULES].global_val.l + #define USR_FORWARD_RULES vars[V_FORWARD_RULES].user_val.l + #define VAR_REPLY_RULES vars[V_REPLY_RULES].current_val.l + #define GLO_REPLY_RULES vars[V_REPLY_RULES].global_val.l + #define USR_REPLY_RULES vars[V_REPLY_RULES].user_val.l + #define VAR_INDEX_RULES vars[V_INDEX_RULES].current_val.l + #define GLO_INDEX_RULES vars[V_INDEX_RULES].global_val.l + #define USR_INDEX_RULES vars[V_INDEX_RULES].user_val.l + #define VAR_REPLACE_RULES vars[V_REPLACE_RULES].current_val.l + #define GLO_REPLACE_RULES vars[V_REPLACE_RULES].global_val.l + #define USR_REPLACE_RULES vars[V_REPLACE_RULES].user_val.l + #define VAR_REPLY_INDENT_RULES vars[V_REPLY_INDENT_RULES].current_val.l + #define GLO_REPLY_INDENT_RULES vars[V_REPLY_INDENT_RULES].global_val.l + #define USR_REPLY_INDENT_RULES vars[V_REPLY_INDENT_RULES].user_val.l + #define VAR_REPLY_LEADIN_RULES vars[V_REPLY_LEADIN_RULES].current_val.l + #define GLO_REPLY_LEADIN_RULES vars[V_REPLY_LEADIN_RULES].global_val.l + #define USR_REPLY_LEADIN_RULES vars[V_REPLY_LEADIN_RULES].user_val.l + #define VAR_RESUB_RULES vars[V_RESUB_RULES].current_val.l + #define GLO_RESUB_RULES vars[V_RESUB_RULES].global_val.l + #define USR_RESUB_RULES vars[V_RESUB_RULES].user_val.l + #define VAR_SAVE_RULES vars[V_SAVE_RULES].current_val.l + #define GLO_SAVE_RULES vars[V_SAVE_RULES].global_val.l + #define USR_SAVE_RULES vars[V_SAVE_RULES].user_val.l + #define VAR_SMTP_RULES vars[V_SMTP_RULES].current_val.l + #define GLO_SMTP_RULES vars[V_SMTP_RULES].global_val.l + #define USR_SMTP_RULES vars[V_SMTP_RULES].user_val.l + #define VAR_SORT_RULES vars[V_SORT_RULES].current_val.l + #define GLO_SORT_RULES vars[V_SORT_RULES].global_val.l + #define USR_SORT_RULES vars[V_SORT_RULES].user_val.l + #define VAR_STARTUP_RULES vars[V_STARTUP_RULES].current_val.l + #define GLO_STARTUP_RULES vars[V_STARTUP_RULES].global_val.l + #define USR_STARTUP_RULES vars[V_STARTUP_RULES].user_val.l #define VAR_CHAR_SET vars[V_CHAR_SET].current_val.p #define GLO_CHAR_SET vars[V_CHAR_SET].global_val.p #define VAR_EDITOR vars[V_EDITOR].current_val.l *************** *** 1005,1010 **** --- 1062,1068 ---- F_FULL_AUTO_EXPUNGE, F_EXPUNGE_MANUALLY, F_AUTO_READ_MSGS, + F_AUTO_READ_MSGS_RULES, F_AUTO_FCC_ONLY, F_READ_IN_NEWSRC_ORDER, F_SELECT_WO_CONFIRM, *************** *** 1017,1022 **** --- 1075,1081 ---- F_ALT_ED_NOW, F_SHOW_DELAY_CUE, F_AUTO_OPEN_NEXT_UNREAD, + F_AUTO_CIRCULAR_TAB, F_SELECTED_SHOWN_BOLD, F_QUOTE_ALL_FROMS, F_AUTO_INCLUDE_IN_REPLY, *************** *** 1033,1038 **** --- 1092,1098 ---- F_DISABLE_PIPES_IN_TEMPLATES, F_ATTACHMENTS_IN_REPLY, F_ENABLE_INCOMING, + F_ENABLE_INCOMING_CHECK, F_NO_NEWS_VALIDATION, F_QUELL_EXTRA_POST_PROMPT, F_DISABLE_TAKE_LASTFIRST, *************** *** 1055,1060 **** --- 1115,1121 ---- F_AUTO_REPLY_TO, F_VERBOSE_POST, F_FCC_ON_BOUNCE, + F_USE_DOMAIN_NAME, F_USE_SENDER_NOT_X, F_BLANK_KEYMENU, F_CUSTOM_PRINT, *************** *** 1134,1142 **** --- 1195,1205 ---- F_DISABLE_SHARED_NAMESPACES, F_EXPOSE_HIDDEN_CONFIG, F_ALT_COMPOSE_MENU, + F_ALT_REPLY_MENU, F_ALWAYS_SPELL_CHECK, F_QUELL_TIMEZONE, F_COLOR_LINE_IMPORTANT, + F_ENHANCED_THREAD, F_SLASH_COLL_ENTIRE, F_ENABLE_FULL_HDR_AND_TEXT, F_DISABLE_2022_JP_CONVERSIONS, *************** *** 1674,1680 **** SortSubject2, SortScore, SortThread, EndofList} SortOrder; #define refresh_sort(M,S) sort_folder((M), mn_get_sort(M), \ ! mn_get_revsort(M), (S)) /* * The two structs below hold all knowledge regarding --- 1737,1743 ---- SortSubject2, SortScore, SortThread, EndofList} SortOrder; #define refresh_sort(M,S) sort_folder((M), mn_get_sort(M), \ ! mn_get_revsort(M), (S), 1) /* * The two structs below hold all knowledge regarding *************** *** 1716,1721 **** --- 1779,1785 ---- unsigned long nextthd; /* next thread, only tops have this */ unsigned long prevthd; /* previous thread, only tops have this */ unsigned long top; /* top of this thread */ + unsigned long toploose; /* top of this thread, if is loose */ unsigned long head; /* head of the whole thread list */ } PINETHRD_S; *************** *** 1941,1949 **** iTime24, iTime12, iCurDate, iCurDateIso, iCurDateIsoS, iCurTime24, iCurTime12, iMessNo, iAtt, iMsgID, iSubject, ! iSize, iSizeComma, iSizeNarrow, iDescripSize, iNewsAndTo, iToAndNews, iNewsAndRecips, iRecipsAndNews, iFromTo, iFromToNotNews, iFrom, iTo, iSender, iCc, iNews, iRecips, iMailbox, iAddress, iInit, iCursorPos, iDay2Digit, iMon2Digit, iYear2Digit, iSTime, iKSize, --- 2005,2015 ---- iTime24, iTime12, iCurDate, iCurDateIso, iCurDateIsoS, iCurTime24, iCurTime12, iMessNo, iAtt, iMsgID, iSubject, ! iFolder, iFlag, iCollection, iRole, ! iSize, iSizeComma, iSizeNarrow, iDescripSize, iSizeThread, iNewsAndTo, iToAndNews, iNewsAndRecips, iRecipsAndNews, iFromTo, iFromToNotNews, iFrom, iTo, iSender, iCc, iNews, iRecips, + iNick, iAddressTo, iBcc, iLcc, iFfrom, iFadd, iMailbox, iAddress, iInit, iCursorPos, iDay2Digit, iMon2Digit, iYear2Digit, iSTime, iKSize, *************** *** 1961,1972 **** } INDEX_PARSE_T; /* these are flags for the what_for field in INDEX_PARSE_T */ ! #define FOR_NOTHING 0x00 ! #define FOR_INDEX 0x01 ! #define FOR_REPLY_INTRO 0x02 ! #define FOR_TEMPLATE 0x04 /* or for signature */ ! #define DELIM_USCORE 0x10 ! #define DELIM_PAREN 0x20 #define DEFAULT_REPLY_INTRO "default" --- 2027,2048 ---- } INDEX_PARSE_T; /* these are flags for the what_for field in INDEX_PARSE_T */ ! #define FOR_NOTHING 0x0000 ! #define FOR_INDEX 0x0001 ! #define FOR_REPLY_INTRO 0x0002 ! #define FOR_TEMPLATE 0x0004 /* or for signature */ ! #define FOR_STARTUP 0x0008 /* for rules */ ! #define DELIM_USCORE 0x0010 ! #define DELIM_PAREN 0x0020 ! #define FOR_SAVE 0x0040 /* for rules */ ! #define FOR_FOLDER 0x0080 /* for rules */ ! #define FOR_RULE 0x0100 /* for rules */ ! #define FOR_TRIM 0x0200 /* for rules */ ! #define FOR_RESUB 0x0400 /* for rules */ ! #define FOR_REPLACE 0x0800 /* for rules */ ! #define FOR_SORT 0x1000 /* for rules */ ! #define FOR_FLAG 0x2000 /* for rules */ ! #define FOR_COMPOSE 0x4000 /* for rules */ #define DEFAULT_REPLY_INTRO "default" *************** *** 2330,2340 **** --- 2406,2431 ---- #define MC_NO 796 #define MC_NOT 797 #define MC_COLLAPSE 798 + #define MC_NEXTHREAD 799 + #define MC_PRETHREAD 800 + #define MC_CTHREAD 801 + #define MC_OTHREAD 802 + #define MC_KOLAPSE 803 + #define MC_EXPTHREAD 804 + #define MC_DELTHREAD 805 + #define MC_UNDTHREAD 806 + #define MC_SELTHREAD 807 + #define MC_SSUTHREAD 808 + #define MC_DSUTHREAD 809 + #define MC_USUTHREAD 810 + #define MC_SORTHREAD 811 /* * Some standard Key/Command Bindings */ + #define MC_IFAUTOCHECK 812 + #define MC_FORCECHECK 813 #define NULL_MENU {NULL, NULL, {MC_NONE}, KS_NONE} #define HELP_MENU {"?", "Help", \ {MC_HELP, 2, {'?',ctrl('G')}}, \ *************** *** 2987,2993 **** --- 3078,3092 ---- #define HEX_CHAR2(C) HEX_ARRAY[(C) & 0xf] + typedef struct extra_rule { + char *data; /* The actual data entered by the user */ + char *context; /* Context in which we are looking for the rule */ + } EXTRA_RULES; + typedef struct rule { + char *result; /* The result of the rule */ + int number; /* The number of the rule that succeded, -1 if not */ + } RULE_RESULT; /*---------------------------------------------------------------------- *************** *** 3024,3033 **** --- 3123,3135 ---- MSGNO_S *msgmap; /* message num mapping into stream */ + char *role; /* role used when composing */ + long new_mail_count; long expunge_count; long first_unseen; + int exiting; unsigned read_predicted:1; unsigned mail_box_changed:1; *************** *** 3036,3041 **** --- 3138,3152 ---- char cur_folder[MAXPATH+1]; char last_unambig_folder[MAXPATH+1]; + char *last_message; + int notified; + int number_of_folders; + int in_pico; + int in_fld_list; + int force_check_now; + int checking_incfld; + int delay; + int done; /* to avoid changing ps->number_of_folders down twice */ ATTACH_S *atmts; int atmts_allocated; int remote_abook_validity; /* minutes, -1=never, 0=only on opens */ *************** *** 3058,3063 **** --- 3169,3176 ---- unsigned start_in_context:1; /* start fldr_scrn in current cntxt */ unsigned io_error_on_stream:1; /* last write on mail_stream failed */ unsigned def_sort_rev:1; /* true if reverse sort is default */ + unsigned thread_def_sort_rev:1; /* true if reverse sort is default in thread screen */ + unsigned msgmap_thread_def_sort_rev:1; /* true if reverse sort is being used in thread screen */ unsigned restricted:1; unsigned show_dot_names:1; *************** *** 3153,3158 **** --- 3266,3272 ---- short init_context; int *initial_cmds; /* cmds to execute on startup */ + int *initial_cmds_backup; /* backup to cmds to execute on startup */ int *free_initial_cmds; /* used to free when done */ char c_client_error[300]; /* when nowhow_error is set and PARSE */ *************** *** 3190,3195 **** --- 3304,3311 ---- EditWhich ew_for_other_take; SortOrder def_sort, /* Default sort type */ + thread_def_sort, /* Default Sort Type in Thread Screen */ + msgmap_thread_sort, sort_types[22]; int last_expire_year, last_expire_month; *************** *** 3200,3205 **** --- 3316,3324 ---- int composer_fillcol; + char *subject; /* Subject of the message when entered from command line */ + + int send_immediately; /* Means that ^X,y is the sequence of initial keystrokes */ time_t time_of_last_input; int hours_to_timeout; *************** *** 3814,3819 **** --- 3933,3942 ---- int folder_complete PROTO((CONTEXT_S *, char *, int *)); char *folder_as_breakout PROTO((CONTEXT_S *, char *)); void init_folders PROTO((struct pine *)); + void init_newsrc PROTO((struct pine *)); + void init_newsrc PROTO((struct pine *)); + void init_newsrc_file PROTO((CONTEXT_S *)); + char *get_newsrc_name PROTO((CONTEXT_S *)); int news_in_folders PROTO((struct variable *)); CONTEXT_S *new_context PROTO((char *, int *)); void free_contexts PROTO((CONTEXT_S **)); *************** *** 3829,3834 **** --- 3952,3959 ---- char *folder_is_nick PROTO((char *, void *)); char *next_folder PROTO((MAILSTREAM **, char *, char *,CONTEXT_S *, long *, int *)); + char *next_folder_check PROTO((MAILSTREAM **, char *, char *,CONTEXT_S *, + long *, int , FOLDER_S *)); void init_inbox_mapping PROTO((char *, CONTEXT_S *)); int news_build PROTO((char *, char **, char **, BUILDER_ARG *, int *)); char *news_group_selector PROTO((char **)); *************** *** 3882,3888 **** int write_pinerc PROTO((struct pine *, EditWhich)); int var_in_pinerc PROTO((char *)); void free_pinerc_lines PROTO((PINERC_LINE **)); ! int decode_sort PROTO((char *, SortOrder *, int *)); void dump_global_conf PROTO((void)); void dump_new_pinerc PROTO((char *)); int set_variable PROTO((int, char *, int, int, EditWhich)); --- 4007,4013 ---- int write_pinerc PROTO((struct pine *, EditWhich)); int var_in_pinerc PROTO((char *)); void free_pinerc_lines PROTO((PINERC_LINE **)); ! int decode_sort PROTO((char *, SortOrder *, int *, int)); void dump_global_conf PROTO((void)); void dump_new_pinerc PROTO((char *)); int set_variable PROTO((int, char *, int, int, EditWhich)); *************** *** 3955,3961 **** int process_cmd PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, CmdWhere, int *)); int apply_command PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, ! int, int)); int menu_command PROTO((int, struct key_menu *)); void menu_init_binding PROTO((struct key_menu *, int, int, char *, char *, int)); --- 4080,4086 ---- int process_cmd PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, CmdWhere, int *)); int apply_command PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int, ! int, int, int)); int menu_command PROTO((int, struct key_menu *)); void menu_init_binding PROTO((struct key_menu *, int, int, char *, char *, int)); *************** *** 4040,4046 **** do_index_border PROTO((CONTEXT_S *, char *, MAILSTREAM *, MSGNO_S *, IndexType, int *, int)); char *sort_name PROTO((SortOrder)); ! void sort_folder PROTO((MSGNO_S *, SortOrder, int, unsigned)); int percent_sorted PROTO((void)); void msgno_init PROTO((MSGNO_S **, long)); void msgno_give PROTO((MSGNO_S **)); --- 4165,4171 ---- do_index_border PROTO((CONTEXT_S *, char *, MAILSTREAM *, MSGNO_S *, IndexType, int *, int)); char *sort_name PROTO((SortOrder)); ! void sort_folder PROTO((MSGNO_S *, SortOrder, int, unsigned, int)); int percent_sorted PROTO((void)); void msgno_init PROTO((MSGNO_S **, long)); void msgno_give PROTO((MSGNO_S **)); *************** *** 4061,4067 **** void free_pine_elt PROTO((PINELT_S **)); SEARCHSET *build_searchset PROTO((MAILSTREAM *)); void collapse_or_expand PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, ! unsigned long)); PINETHRD_S *fetch_thread PROTO((MAILSTREAM *, unsigned long)); PINETHRD_S *fetch_head_thread PROTO((MAILSTREAM *)); int view_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); --- 4186,4192 ---- void free_pine_elt PROTO((PINELT_S **)); SEARCHSET *build_searchset PROTO((MAILSTREAM *)); void collapse_or_expand PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, ! unsigned long, int)); PINETHRD_S *fetch_thread PROTO((MAILSTREAM *, unsigned long)); PINETHRD_S *fetch_head_thread PROTO((MAILSTREAM *)); int view_thread PROTO((struct pine *, MAILSTREAM *, MSGNO_S *, int)); *************** *** 4144,4149 **** --- 4269,4278 ---- void check_point_change PROTO(()); void reset_check_point PROTO((void)); void zero_new_mail_count PROTO((void)); + int new_mail_incfolder PROTO((struct pine *, int)); + char *folder_in_list PROTO((char *)); + void select_incoming_folder PROTO((CONTEXT_S *,int)); + int folder_in_message_list PROTO((char *)); /*-- os.c --*/ int can_access_in_path PROTO((char *, char *, int)); *************** *** 4272,4277 **** --- 4401,4407 ---- int get_lflag PROTO((MAILSTREAM *, MSGNO_S *, long, int)); int set_lflag PROTO((MAILSTREAM *, MSGNO_S *, long, int, int)); void warn_other_cmds PROTO(()); + char *pine_set_newsrc PROTO ((MAILSTREAM *, char *, char *)); MAILSTREAM *pine_mail_open PROTO((MAILSTREAM *, char *, long)); long pine_mail_create PROTO((MAILSTREAM *, char *)); void pine_mail_close PROTO((MAILSTREAM *)); *************** *** 4288,4294 **** ENVELOPE *, ADDRESS **, ADDRESS **, ADDRESS **, ADDRESS **,int *)); int reply_news_test PROTO((ENVELOPE *, ENVELOPE *)); ! int reply_text_query PROTO((struct pine *, long, char **)); BODY *reply_body PROTO((MAILSTREAM *, ENVELOPE *, BODY *, long, char *, void *, char *, int, ACTION_S *, int, REDRAFT_POS_S **)); --- 4418,4424 ---- ENVELOPE *, ADDRESS **, ADDRESS **, ADDRESS **, ADDRESS **,int *)); int reply_news_test PROTO((ENVELOPE *, ENVELOPE *)); ! int reply_text_query PROTO((struct pine *, long, ENVELOPE *, char **)); BODY *reply_body PROTO((MAILSTREAM *, ENVELOPE *, BODY *, long, char *, void *, char *, int, ACTION_S *, int, REDRAFT_POS_S **)); *************** *** 4454,4459 **** --- 4584,4590 ---- void removing_leading_white_space PROTO((char *)); void removing_leading_and_trailing_white_space PROTO((char *)); int removing_double_quotes PROTO((char *)); + void removing_extra_stuff PROTO((char *)); char *skip_white_space PROTO((char *)); char *skip_to_white_space PROTO((char *)); char *removing_quotes PROTO((char *)); *************** *** 4618,4623 **** --- 4749,4755 ---- void MoveCursor PROTO((int, int)); void NewLine PROTO((void)); int config_screen PROTO((struct ttyo **)); + void fake_config_screen PROTO((struct ttyo **)); void init_screen PROTO((void)); void end_screen PROTO((char *, int)); void outchar PROTO((int)); diff -rc pine4.52/pine/pine.hlp pine4.52.I.USE/pine/pine.hlp *** pine4.52/pine/pine.hlp Thu Jan 9 11:33:51 2003 --- pine4.52.I.USE/pine/pine.hlp Tue Jan 14 13:13:55 2003 *************** *** 2565,2571 **** --- 2565,2573 ----
  • FAQs on Pine Locking
  • FEATURE: allow-changing-from
  • FEATURE: auto-move-read-msgs +
  • FEATURE: auto-move-read-msgs-using-rules
  • FEATURE: auto-open-next-unread +
  • FEATURE: enable-circular-tab
  • FEATURE: combined-addrbook-display
  • FEATURE: combined-folder-display
  • FEATURE: combined-subdirectory-display *************** *** 2712,2717 **** --- 2714,2720 ----
  • OPTION: Selectable Item Color
  • OPTION: Sending-Filters
  • OPTION: Sort-Key +
  • OPTION: Thread-Sort-Key
  • OPTION: Speller
  • OPTION: Status Color
  • OPTION: Status-Message-Delay *************** *** 13679,13685 **** This set of special tokens may be used in the "Index-Format" option, in the "Reply-Leadin" option, ! in signature files, and in template files used in "roles". Some of them aren't available in all situations. --- 13682,13688 ---- This set of special tokens may be used in the "Index-Format" option, in the "Reply-Leadin" option, ! in signature files, in the "new-rules" option, and in template files used in "roles". Some of them aren't available in all situations. *************** *** 13690,13696 ****

    !

    Tokens Available for all Cases

    SUBJECT
    --- 13693,13699 ----

    !

    Tokens Available for all Cases (with the exception, maybe, of new-rules)

    SUBJECT
    *************** *** 13712,13717 **** --- 13715,13727 ---- For example, "mailbox@domain". +
    ADDRESSTO
    +
    + This is similar to the "TO" token, only it is always the + email address, never the personal name. + For example, "mailbox@domain". +
    +
    MAILBOX
    This is the same as the "ADDRESS" except that the *************** *** 14137,14142 **** --- 14147,14160 ----

    +
    SIZETHREAD
    +
    + This token represents the total size of the thread for a collapsed thread + or the size of the branch for an expanded thread. The field is omitted for + messages that are not top of threads nor branches and it defaults to + the SIZE token when your folders is not sorted by thread. +
    +
    SIZENARROW
    This token represents the total size, in bytes, of the message. *************** *** 14260,14265 **** --- 14278,14355 ----

    +

    Tokens Available Only for New-Rules

    + +
    +
    FOLDER
    +
    + Name of the folder where the rule will be applied +
    +
    + +
    +
    COLLECTION
    +
    + Name of the collection list where the rule will be applied. +
    +
    + +
    +
    ROLE
    +
    + Name of the Role used to reply a message. +
    +
    + +
    +
    BCC
    +
    + Not implemented yet, but it will be implemented in future versions. It will + be used for compose + reply + forward + rules. +
    +
    + +
    +
    LCC
    +
    + This is the value of the Lcc: field at the moment that you start the composition. +
    +
    + +
    +
    FORWARDFROM
    +
    + This corresponds to the personal name (or address if there's no personal + name) of the person who sent the message that you are forwarding. +
    +
    + +
    +
    FORWARDADDRESS
    +
    + This is the address of the person that sent the message that you + are forwarding. +
    +
    + + + + +
    +
    FLAG
    +
    + A string containing the value of all the flags associated to a specific + message. The possible values of allowed flags are "*" for Important, "N" + for recent or new, "U" for unseen or unread, "R" for seen or read, "A" for + answered and "D" for deleted. See an example of its use in the + new rules explanation and example help. +
    +
    + +

    Token Available Only for Templates and Signatures

    *************** *** 14919,14924 **** --- 15009,15031 ---- be combined with the other fields if you'd like. + ====== h_config_check_inc_fld ====== + + + OPTION: incoming-folders-to-check + + +

    OPTION: incoming-folders-to-check

    +

    + if you set this option and + enable-check-incoming-folders then you can use this option to write a space + separate list of incoming folders where you want new mail to be + checked. If you want all your incoming folders to be checked just write a + "*" as the value for this option. +

    + <End of help on this topic> + + ======= h_address_format ======= *************** *** 16414,16419 **** --- 16521,16562 ---- <End of help on this topic> + ====== h_config_thread_sort_key ===== + + + OPTION: Thread-Sort-Key + + +

    OPTION: Thread-Sort-Key

    + + This option determines the order in which threads will be displayed. You + can choose from the following options. + +

    +

    + +

    Each type of sort may also be reversed. Normal default is by + "Date" (which is the same as Thread). Also sort by Subject is + equivalent to sort by OrderedSubject. + +

    +

    + <End of help on this topic> + + ====== h_config_other_startup ===== *************** *** 16562,16567 **** --- 16705,17363 ---- <End of help on this topic> + ====== h_config_compose_rules ===== + + + OPTION: Compose-Rule + + +

    OPTION: Compose-Rule

    + +

    At this time, this option is used to generate values for signature + files that is not possible to do with the use of + roles. + +

    For example, you can have a rule like:
    + _TO_ >> {Peter Flinstones} => _SIGNATURE_{~/.petersignature} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_forward_rules ===== + + + OPTION: Forward-Rule + + +

    OPTION: Forward-Rule

    + +

    At this time this option can be used to trim values of some fields, + for example it can be used in the following way: + +

    + _ROLE_ == {work} => _LCC_ := _TRIM_{_FORWARDFROM_ <_FORWARDADDRESS_>} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_reply_rules ===== + + + OPTION: Reply-Rule + + +

    OPTION: Reply-Rule

    + +

    At this time, this option is not used, and it will be + implemented in a future version of Pine. + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_index_rules ===== + + + OPTION: Index-Rule + + +

    OPTION: Index-Rule

    + +

    This option is used to superseed the value of the option index-format for specific folders. In + this form you can have different index-formats for different folders. For + example an entry here may be: + +

    + _FOLDER_ == {INBOX} => _INDEX_{IMAPSTATUS DATE FROM(33%) SIZE SUBJECT(67%)} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_replace_rules ===== + + + OPTION: Replace-Rule + + +

    OPTION: Replace-Rule

    + +

    This option is used to have Pine print different values for specific + tokens in the index-format. For example you + can replace strings like "To: newsgroup" by your name. + +

    Here are examples of possible rules:
    + _FOLDER_ != {sent-mail} && _NICK_ != {} => _FROM_ := _REPLACE_{_FROM_ (_NICK_)} + +

    or if you receive messages with tags that contain arbitrary numbers, and + you want them removed from the index (but not from the subject), use a rule + like the following
    + _FOLDER_ == {INBOX} => _SUBJECT_ := _REXTRIM_{\[some-tag-here #[0-9].*\]} + +

    You can also use this configuration option to remove specific strings of + the index display screen, so that you can trim unnecessary information in + your index. + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_reply_leadin_rules ===== + + + OPTION: Reply-Leadin-Rule + + +

    OPTION: Reply-Leadin-Rule

    + +

    This option is used to have Pine generate a different + reply-leadin string dependent either on + the person you are replying to, or the folder where the message is being + replied is in, or both. + +

    Here there are examples of how this can be used. One can use the definition + below to post to newsgroups and the pine-info mailing list, say: +

    + _FOLDER_ << {pine-info;_NEWS_} => _REPLY_{*** _FROM_ _ADDRESS_("_FROM_" "" "(_ADDRESS_) ")wrote in_NEWS_("" " the" "") _FOLDER_ _NEWS_("" "list " "")_SMARTDATE_("Today" "today" "on _LONGDATE_"):} + +

    Here there is an example that one can use to change the reply indent string + to reply people that speak spanish. +

    + _FROM_{Condorito;Quico} => _REPLY_{*** _FROM_ (_ADDRESS_) escribió _SMARTDATE_("Today" "hoy" "en _LONGDATE_"):} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_resub_rules ===== + + + OPTION: Replace-Subject-Rule + + +

    OPTION: Replace-Subject-Rule

    + +

    This option is used to have Pine generate a different subject when + replying rather than the one Pine would generate automatically. Notice + that you should consider starting this generated reply subject with the + "Re: " string, so that no mail reading program gets confused with your + subject reply string. + +

    Here there are a couple of examples about how to use this + configuration option: + +

    In order to have messages with empty subject to be replied with the message + "your message" use the rule
    +

    _SUBJECT_ == {} => _RESUB_{Re: your message}
    + +

    If you want to trim some parts of the subject when you reply use the + rule
    +

    _SUBJECT_ >> {[one];two} => _TRIM_{[;];two}
    + +

    this rule removes the brackets "[" and "]" whenever the string "[one]" + appears in it, it also removes the word "two" from it. + +

    You can also use this configuration option to customize reply subjects + according to the sender of the message. + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + ====== h_config_sort_rules ===== + + + OPTION: Sort-Rule + + +

    OPTION: Sort-Rule

    + +

    This option is used to have Pine sort different folders in different orders + and thus override the value already set in the + sort-key configuration option. + +

    Here's an example of the way it can be used. In this case all incoming + folders are mailing lists, except for INBOX, so we sort INBOX by arrival + (which is the default type of sort), but we want all the rest of mailing + lists and newsgroups to be sorted by thread. + +

    + _COLLECTION_ >> {Incoming-Folders;News} && _FOLDER_ != {INBOX} => _SORT_{tHread} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + + ====== h_config_save_rules ===== + + + OPTION: Save-Rules + + +

    OPTION: Save-Rules

    + +

    This option is used to specify which folder should be used to save a + message depending either on the folder the message is in, who the message + is from, or text that the message contains in specific headers (Cc:, + Subject:, etc). + +

    If this option is set and the + auto-move-read-msgs configuration + option is also set then these definitions will be used to move messages + from your INBOX when exiting Pine. + +

    Here there are some examples
    + _FLAG_ >> {D} -> Trash
    + _FROM_ == {U2} -> Bono
    + _FOLDER_ == {comp.mail.pine} -> pine-stuff
    + _NICK_ != {} -> _NICK_/_NICK_ + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + + ====== h_config_reply_indent_rules ===== + + + OPTION: Reply-indent-Rule + + +

    OPTION: Reply-indent-Rule

    + +

    This option is used to specify which reply-indent-string is to be used + when replying to an e-mail. If none of the rules are successful, the result in + the variable reply-indent-string + is used. + +

    The associated function to this configuration option is called "RESTR" (for + REply STRing). Some examples of its use are:
    + _FROM_ == {Your Boss} => _RESTR_{"> "}
    + _FROM_ == {My Wife} => _RESTR_{":* "}
    + _FROM_ == {Perter Flinstone;Wilma Flinstone} => _RESTR_{"_INIT_ > "}
    + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + + ====== h_config_smtp_rules ===== + + + OPTION: SMTP-Rule + + +

    OPTION: SMTP-Rule

    + +

    This option is used to specify which SMTP server should be used when + sending a message, if this rule is not defined, or the execution of the rule + results in no server selected, then Pine will look for + the value from the + "smtp-server" configuration + option according to the rules used in that variable. + +

    The function associated to this configuration option is _SMTP_, an example + of the use of this function is
    + _ADDRESSTO_ == {peter@bedrock.com} => _SMTP_{smtp.bedrock.com} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + + ====== h_config_startup_rules ===== + + + OPTION: Startup-Rule + + +

    OPTION: Startup-Rule

    + +

    This option is used when a folder is being opened. You can use it to + specify its incoming-startup-rule and override + Pine's global value set for all folders. + +

    An example of the usage of this option is:
    + _FOLDER_ == {Lynx;pine-info;_NEWS_} => _STARTUP_{first-unseen} + +

    This configuration option is just one of many that allow you to + override the value of some global configurations within Pine. There is a + help text explaining how to define all of them, which you can read by + following this link. + +

    <End of help on this topic> + + + + ====== h_config_new_rules ===== + + + OPTION: New Rules Explained + + +

    OPTION: New Rules Explained

    + + This is a quite powerful option. Here you can define rules that override + the values of any other global rule you have globally set in pine. + +

    + For example, you can set your folders to be sorted in a certain way when + you open them (say by Arrival). You may not want to be this the behavior + of, say, a Newsgroup, maybe you would like there to have your folder to be + automatically ordered by Ordered Subject. The purpose of this feature is + to accomplish exactly that. You can use this option for defining such + exception and make Pine automatically sort your favorite Newsgroup by + Ordered Subject. + +

    + On the other hand you may be suscribed to a mailing list, and maybe you + don't care to see in the index the size of the messages, however in other + lists you may want to see the size of the messages. You can use this + configuration for changing the way the index is displayed in a folder. + +

    + Also there may be a mailing list that identifies itself by adding a + certain string to its subject which makes difficult to read the total + subject, so you may want to delete that string from the subject whenever + it appears. You can do that also with this configuration. + +

    + You may also want to make your reply-leadin-string person or folder + dependent. You can do this with this feature (part of this feature can be + accomplised with the roles definitions, but roles are not the right tool + to do this as you will see). + +

    + Every rule has three parts, a condition, a separator and an action. The + action is what will happen if the condition of the rule is satisified. + +

    + Here is an example: + +

    + _FROM_ == {Fred Flinstone} => _SAVE_{Fred} + +

    + Here the separator is "=>". Whatever is to the left of the separator + is the condition (that is to say _FROM_ == {Fred Flinstone}) and to the + right is the action (_SAVE_{Fred}). The condition means that the rule will + be applied only if the message that you are reading is from "Fred + Flinstone", and the action will be that you will be offered to save it in + the folder "Fred", whenever you press the letter "S" to save a message. + +

    + The separator is always "=>", with one exception to be seen later. + But for the most part this will be the only one you'll ever need. + +

    + Now let us see how to do it. There are 10 functions already defined for + you. These are: _INDEX_, _REPLACE_, _REPLY_, _RESUB_, _SAVE_, _SIGNATURE_, + _SORT_, _STARTUP_, _TRIM_ and _REXTRIM_. The parameter of a function has + to be enclosed between "{" and "}", so for example you can specify + _SAVE_{saved-messages} as a valid sentence. + +

    + At the end of the document you will find more examples.Here is a short + description of what each function does: + +

    +

      +
    • _INDEX_ : This function takes as an argument an index-format, and + makes that the index-format for the specified folder. +
    • _REPLACE_ : This function replaces the subject/from of the given e-mail by + another subject/from only when displaying the index. +
    • _REPLY_ : This function takes as an argument a definition of a + reply-leadin-string and makes this the reply-leading-string of the + specified folder or person. +
    • _RESTR_ : This function takes as an argument the value of the + reply-indent-string to be used to answer the message being replied to. +
    • _RESUB_ : This function replaces the subject of the given e-mail by + another subject only when replying to a message. +
    • _SAVE_ : The save function takes as an argument the name of a + possibly non existing folder, whenever you want to save a message, that + folder will be offered for you to save. +
    • _SIGNATURE_ : This function takes as an argument a signature file and + uses that file as the signature for the message you are about to + compose/reply/forward. +
    • _SMTP_ : This function takes as an argument the definition of a + SMTP server. +
    • _SORT_ : This function takes as an argument a Sort Style, and sorts a + specified folder in that sort order. +
    • _TRIM_ : This function takes as an argument a list of strings that + you want removed from another string. At this time this only works for + _FROM_ and _SUBJECT_. +
    • _REXTRIM_ : Same as _TRIM_ but its argument is one and + only one extended regular expression. +
    • _STARTUP_ : This function takes as an argument an + incoming-startup-rule, and open an specified folder using that rule. +
    + +

    + You must me wondering how to define the person/folder over who to apply + the action. This is done in the condition. When you specify a rule, the + rule is only executed if the condition is satisfied. In another words for + the rule: + +

    + _FROM_ == {Fred Flinstone} => _SAVE_{Fred} + +

    + it will only be applied if the from is "Fred Flinstone", if the From is + "Wilma Flinstone" the rule will be skipped. + +

    In order to test a condition you can use the following tokens (in + alphabetical order): _ADDRESS_,_CC_, _FOLDER_, _FROM_,_NICK_, _ROLE, + _SENDER_, _SUBJECT_ and _TO_. The token will always be tested against what + it is between "{" and "}" in the condition, this part of the condition is + called the "condition set". The definition of each token can be found + here. + +

    + You can also test in different ways, you can + use the following "test operands": <<, !<, >>, !>, == + and !=. All of them are two strings long. Here is the meaning of them: + +

    +

      +
    • << : It tests if the value of the token is contained in + the condition set. Here for example if the condition set were equal to + "Freddy", then the condition: _NICK_ << {Freddy}, would be true if + the value of _NICK_ were "Fred", "red" or "Freddy". You are just looking + for substrings here. +
    • >> : It tests if the value of the token contains the value of + the condition set. Here for example if the condittion set were equal to + "Fred", then the condition: _FROM_ >> {Fred}, would be true if + the value of _FROM_ were "Fred Flinstone" or "Fred P. Flinstone" or "Freddy". +
    • == : It tests if the value of the token is exactly equal to the value + of the set condition. For example _NICK_ == {Fred} will be false if the value + of _NICK_ is "Freddy" or "red". +
    • !< : This is true only when << is false and viceversa. +
    • !> : This is true only when >> is false and viceversa. +
    • != : This is true only when == is false and viceversa. +
    + +

    + Now let us say that you want the same action to be applied to more than + one person or folder, say you want "folder1" and "folder2" to be sorted by + Ordered Subject upon entering. Then you can list them all of them in the + condition part separting them by a ";". Here is the way to do it. + +

    + _FOLDER_ << {folder1; folder2} => _SORT_{OrderedSubj} + +

    + Here is the first subtelty about these definitions. Notice that the + following rule: + +

    + _FOLDER_ == {folder1; folder2} => _SORT_{OrderedSubj} + +

    works only for "folder1" but not for "folder2". This is because the + comparison of the name of the folder is done with whatever is in between + "{", ";" or "}", so in the above rule you would be testing
    + "folder2" == " folder2". The extra space makes the difference. + The reason why the first rule does not fail is because + "folder2" << " folder2" is actually + true. If something ever fails this may be something to look into. + +

    + Here are a few examples of what we have talked about before. + +

    + _NICK_ == {lisa;kika} => _SAVE_{_NICK_/_NICK_}
    + This means that if the nick is lisa, it will + save the message in the folder "lisa/lisa", and if the nick + is "kika", it will save the message in the folder "kika/kika" + +

    + _FOLDER_ == {Lynx} -> lynx
    + This, is an abreviation of the following rule:
    + _FOLDER_ == {Lynx} => _SAVE_{lynx}
    + (note the change in separator from "=>" to "->"). In the future + I will use that abreviation. + +

    _FOLDER_ << {comp.mail.pine; pine-info; pine-alpha} -> pine
    + Any message in the folders "comp.mail.pine", "pine-info" or "pine-alpha" + will be saved to the folder "pine". + +

    _FROM_ << {Nancy this-address-is-valid McGough} -> pine
    + Any message whose From field contains + "Nancy this-address-is-valid McGough" will be saved in the folder pine. + +

    _FOLDER_ << {Lynx; pine-info; comp.mail.pine} => + _INDEX_{IMAPSTATUS MSGNO DATE FROMORTO(33%) SUBJECT(66%)}
    Use a + different index-format for the folders "Lynx", "pine-info" and + "comp.mail.pine", where the size is not present. + +

    _FOLDER_ == {Lynx;pine-info} => _REPLY_{*** _FROM_ (_ADDRESS_) + wrote in the _FOLDER_ list _SMARTDATE_("Today" "today" "on + _LONGDATE_"):}
    If a message is in one of the incoming folders "Lynx" + or "pine-info", create a reply-leadin-string that acknowledges that. Note + the absence of "," in the function _SMARTDATE_. For example answering to a + message in the pine-info list would look like: + +

    + *** Steve Hubert (hubert@cac.washington.edu) wrote in the pine-info list today: + +

    + However replying for a message in the Lynx list would look: + +

    + *** mattack@area.com (mattack@area.com) wrote in the Lynx list today: + +

    + If you write in more than one language you can use this feature to create + Reply-leadin-strings in different languages. + +

    Note that at least for people you can create particular + reply-leadin-string using the role features, but it does not work as this + one does. This seems to be the right way to do it. + +

    _FOLDER_ << {Lynx; comp.mail.pine; pine_info; pine-alpha} => + _SORT_{OrderedSubj}
    This means upon opening, sort the folders "Lynx", + "comp.mail.pine", etc in ordered subject. All the others use the default + sort order. You can not sort in reverse in this form. The possible + arguments of this function are listed in the definition of the + default-sort-rule (Arrival, scorE, siZe, etc). + +

    The last examples use the function _TRIM_ which has a special form. + This function can only be used in the index list. + +

    _FOLDER_ << {Lynx} => _SUBJECT_ := _TRIM_{lynx-dev }
    In + the folder "Lynx" eliminate from the subject the string "lynx-dev " (with + the space at the end). For example a message whose subject is "Re: + lynx-dev unvisited Visited Links", would be shown in the index with + subject: "Re: unvisited Visited Links", making the subject shorter and + giving the same information. + +

    _FROM_ >> {Nancy this-address-is-valid McGough} => _FROM_ := + _TRIM_{this-address-is-valid }
    Remove the part "this address-is-valid" + from the _FROM_, so when displaying in the index the real From (Nancy + McGough) will appear. Notice that if in the above rule you change the + action by:
    + _FROM_ := _TRIM_{Nancy ;address; McGough} you will get the + output "this-is-valid" + +

    _SUBJECT_ == {} => _RESUB_{Re: your mail without subject} + If there is no subject in the message, use the subject "Re: your mail + wiyhout subject" as a subject for the reply message. + +

    You can add more complexity to your rules by checking more than one + conditions before a rule is executed. For example: Assume that you want to + answer every email that contains the string "bug report", with the subject + "Re: About your bug report", you could make + +

    + _SUBJECT_ == {bug report} => _RESUB_{Re: About your _SUBJECT_} + +

    The problem with this construction is that if the person emails you + back, then the next time you answer the message the subject will be: "Re: + About your Re: About your bug report", so it grew. You may want to avoid + this growth by using the following rule: + +

    + _SUBJECT_ >> {bug report} && _SUBJECT_ !> {Re: } => _RESUB_{Re: About your _SUBJECT_}
    + +

    + which will only add the string "Re: About your" only the first time the + message is replied. + +

    + Say your personal name is "Fred Flinstones", and assume that you don't + like to see "To: comp.mail.pine" in every post you make to this newsgroup, + but instead would like to see it as everyone else sees it.
    + _FOLDER_ == {comp.mail.pine} && _FROM_ == {Fred Flinstones} => _FROM_ := _REPLACE_{_FROM_} + +

    + You can also list your index by nick, in the following way:
    + _NICK_ != {} => _FROM_ := _REPLACE_{_NICK_} + +

    + If you want to open the folder "pine-info" in the first non-read message + use the rule:
    + _FOLDER_ == {pine-info} => _STARTUP_{first-unseen} + +

    + If you want to move your deleted messages to a folder, called "Trash", use + the following rule:
    + _FLAG_ >> {D} -> Trash + +

    + The reason why the above test is not "_FLAG_ == {D}" is because that would mean + that this is the only flag set in the message. It's better to test by containment in this case. + +

    If you want to use a specific signature when you are in a specific collection + use the following rule:
    + _COLLECTION_ == {Mail} => _SIGNATURE_{/full/path/to/.signature} + +

    Finally about the question of which rule will be executed. Only the + first rule that matches will be executed. It is important to notice though + that "saving" rules do not compete with "sorting" rules. So the first + "saving" rule that matches will be executed in the case of saving and so + on. + +

    Here are some things to do still: +

      +
    • Add more sorting methods to _SORT_ +
    • To make _TRIM_ compatible with more tokens (_TO_, _SENDER_, etc) +
    • To make this list dissapear! +
    + +

    +

    + <End of help on this topic> + + ====== h_config_char_set ===== *************** *** 19758,19763 **** --- 20554,20579 ---- <End of help on this topic> + ====== h_config_enable_check_incoming ====== + + + FEATURE: enable-check-incoming-folders + + +

    FEATURE: enable-check-incoming-folders

    + If you have enabled incoming + folders then setting this feature allows you to check for new mail in + these. A message stating that new mail was received and in which folders + will be written in the screen. You can decide which incoming folders you + want to check for new mail, and the list of them has to be entered in the + setting incoming-folders-to-check + +

    +

    + + ====== h_config_attach_in_reply ====== *************** *** 19951,19956 **** --- 20767,20788 ---- <End of help on this topic> + ====== h_config_use_domain ===== + + + FEATURE: return-path-uses-domain-name + + +

    FEATURE: return-path-uses-domain-name

    + + If you enable this configuration option Pine will use your domain name and your + username in that domain name to construct your Return-Path header, if not Pine + will use the address that you have set in the From: field to construct it. + +

    + <End of help on this topic> + + ====== h_config_use_sender_not_x ===== *************** *** 20326,20331 **** --- 21158,21208 ---- <End of help on this topic> + ====== h_config_alt_reply_menu ===== + + + FEATURE: alternate-reply-menu + + +

    FEATURE: alternate-reply-menu

    + + This feature controls the menu that is displayed when Reply is selected. + If set, a list of options will be presented, with each option representing + the type of composition that could be used. This feature is most useful + for users who want to avoid being prompted with each option separately, or + would like to override some defaults set in your configuration for the + message that you are replying (e.g. you may have set the option to strip + signatures, but for the message you are answering you would like not to do + that) + +

    + The way this feature works is as follows. Initially you get the question + if you want to include the message, and in the menu you will see several + options, each option is accompanied by some text explaining what will + happen if you press return to continue. For example, if you read the text + "S Strip Sig", it means that if you press return the signature will be + stripped off the message you are replying, if you press "S", then the + message will change to "S No Strip", which means that if you press RETURN, + the signature will not be stripped off from the message. + +

    + The possible options are: + +

      +
    1. T : To use the reply-to field, instead of the From: field to direct your + replied message. +
    2. S : To strip the signature from a message, only available is the feature + enable-sigdashes or the + strip-from-sigdashes-on-reply option are + enabled. + +
    3. R : To set a role, if you do not want Pine to set one automatically for you + or would like to set one when you can not select any. +
    +

    + <End of help on this topic> + + ====== h_config_del_from_dot ===== *************** *** 21093,21098 **** --- 21970,21998 ---- <End of help on this topic> + ====== h_config_auto_read_msgs_rules ===== + + + FEATURE: auto-move-read-msgs-using-rules + + +

    FEATURE: auto-move-read-msgs-using-rules

    + This feature controls an aspect of Pine's behavior upon quitting. If set, + and the + "read-message-folder" + option is also set, then Pine will automatically transfer all read + messages to the designated folder using the rules that you have defined in + your + "save-rules" and mark + them as deleted in the INBOX. Messages in the INBOX marked with an + "N" (meaning New, or unseen) are not affected. +

    +

    + <End of help on this topic> + + ====== h_config_auto_fcc_only ===== *************** *** 21729,21734 **** --- 22629,22655 ---- <End of help on this topic> + ====== h_config_circular_tab ===== + + + FEATURE: enable-circular-tab + + +

    FEATURE: enable-circular-tab

    + +

    + This Feature is like + "auto-open-next-unread", + in the sense that you can use TAB to browse through all of your Incoming + Folders checking for new mail. Once it gets to the last folder of the + collection it goes back to check again until it returns to the original + folder where it started. +

    + <End of help on this topic> + + ====== h_config_auto_include_reply ===== *************** *** 23530,23535 **** --- 24451,24472 ----

    + <End of help on this topic> + + + ====== h_config_enhanced_thread ===== + + + FEATURE: enhanced-fancy-thread-support + + +

    FEATURE: enhanced-fancy-thread-support

    + + If this option is set certain commands in Pine will operate in loose + threads too. For example, the command ^D marks a thread deleted, but if + this feature is set, it will remove all threads that share the same missing + parent with this thread. + <End of help on this topic> diff -rc pine4.52/pine/reply.c pine4.52.I.USE/pine/reply.c *** pine4.52/pine/reply.c Mon Jan 6 13:09:04 2003 --- pine4.52.I.USE/pine/reply.c Tue Jan 14 13:13:57 2003 *************** *** 62,67 **** --- 62,70 ---- #include "headers.h" + static ACTION_S *role_chosen; + static int strip; + static int use_reply_to; /* *************** *** 272,278 **** if(!times){ /* only first time */ char *p = cpystr(prefix); ! if((include_text=reply_text_query(pine_state,totalm,&prefix)) < 0) goto done_early; /* edited prefix? */ --- 275,281 ---- if(!times){ /* only first time */ char *p = cpystr(prefix); ! if((include_text=reply_text_query(pine_state,totalm,env,&prefix)) < 0) goto done_early; /* edited prefix? */ *************** *** 303,308 **** --- 306,334 ---- else if(i == 0) goto done_early; + if (ps_global->role) + fs_give((void **)&ps_global->role); + + /* Setup possible role */ + rflags = ROLE_REPLY; + role = role_chosen; + if(!role_chosen && nonempty_patterns(rflags, &dummy)){ + if(!times) + /* setup default role */ + role = set_role_from_msg(pine_state, rflags, seq[times], NULL); + + if(confirm_role(rflags, &role)) + role = combine_inherited_role(role); + else{ /* cancel reply */ + role = NULL; + cmd_cancelled("Reply"); + goto done_early; + } + } + + if (role) + ps_global->role = cpystr(role->nick); /* remember the role */ + /*------------ Format the subject line ---------------*/ if(outgoing->subject){ /* *************** *** 315,325 **** outgoing->subject = cpystr("Re: several messages"); } } ! else ! outgoing->subject = reply_subject(env->subject, NULL); } - reply_seed(pine_state, outgoing, env, saved_from, saved_to, saved_cc, saved_resent, &fcc, flags & RSF_FORCE_REPLY_ALL); --- 341,363 ---- outgoing->subject = cpystr("Re: several messages"); } } ! else{ ! RULE_RESULT *rule; ! ! rule = (RULE_RESULT *) ! get_result_rule(ps_global->vars[V_RESUB_RULES].current_val.l, ! FOR_RULE | FOR_RESUB | FOR_TRIM , env); ! if (rule){ ! outgoing->subject = cpystr(rule->result); ! if (rule->result) ! fs_give((void **)&rule->result); ! fs_give((void **)&rule); ! } ! else ! outgoing->subject = reply_subject(env->subject, NULL); ! } } reply_seed(pine_state, outgoing, env, saved_from, saved_to, saved_cc, saved_resent, &fcc, flags & RSF_FORCE_REPLY_ALL); *************** *** 333,354 **** */ env = mail_fetchstructure(pine_state->mail_stream, seq[times], NULL); - /* Setup possible role */ - rflags = ROLE_REPLY; - if(nonempty_patterns(rflags, &dummy)){ - if(!times) - /* setup default role */ - role = set_role_from_msg(pine_state, rflags, seq[times], NULL); - - if(confirm_role(rflags, &role)) - role = combine_inherited_role(role); - else{ /* cancel reply */ - role = NULL; - cmd_cancelled("Reply"); - goto done_early; - } - } - if(role){ q_status_message1(SM_ORDER, 3, 4, "Replying using role \"%.200s\"", role->nick); --- 371,376 ---- *************** *** 693,701 **** * nobody else. */ if(env->reply_to && !addr_lists_same(env->reply_to, env->from) ! && (F_ON(F_AUTO_REPLY_TO, ps_global) ! || ((*flags) & RSF_FORCE_REPLY_TO) ! || (ret = want_to(FRM_PMT,'y','x',NO_HELP,WT_SEQ_SENSITIVE)) == 'y')) ap = reply_cp_addr(ps, msgno, section, "reply-to", *saved_from, (ADDRESS *) NULL, env->reply_to, 1); else --- 715,724 ---- * nobody else. */ if(env->reply_to && !addr_lists_same(env->reply_to, env->from) ! && ((use_reply_to == -2) || (use_reply_to == 1) ! ||((*flags) & RSF_FORCE_REPLY_TO) ! ||(F_OFF(F_ALT_REPLY_MENU,ps_global) && ! (ret = want_to(FRM_PMT,'y','x',NO_HELP,WT_SEQ_SENSITIVE)) == 'y'))) ap = reply_cp_addr(ps, msgno, section, "reply-to", *saved_from, (ADDRESS *) NULL, env->reply_to, 1); else *************** *** 946,952 **** prompt_fodder); } ! cmd = radio_buttons(prompt, -FOOTER_ROWS(ps_global), ekey, 'y', 'x', help, RB_NORM); switch(cmd){ --- 969,976 ---- prompt_fodder); } ! cmd = ps_global->send_immediately ? 'n' : ! radio_buttons(prompt, -FOOTER_ROWS(ps_global), ekey, 'y', 'x', help, RB_NORM); switch(cmd){ *************** *** 1564,1571 **** ENVELOPE *env; { char *prefix, *repl, *p, buf[MAX_PREFIX+1], pbf[MAX_SUBSTITUTION+1]; ! strncpy(buf, ps_global->VAR_REPLY_STRING, sizeof(buf)-1); buf[sizeof(buf)-1] = '\0'; /* set up the prefix to quote included text */ --- 1588,1616 ---- ENVELOPE *env; { char *prefix, *repl, *p, buf[MAX_PREFIX+1], pbf[MAX_SUBSTITUTION+1]; + char reply_string[MAX_PREFIX+1]; ! { RULE_RESULT *rule; ! rule = (RULE_RESULT *) ! get_result_rule(ps_global->vars[V_REPLY_INDENT_RULES].current_val.l, ! FOR_RULE | FOR_COMPOSE , env); ! if (rule){ ! strncpy(reply_string,rule->result,sizeof(reply_string)); ! reply_string[sizeof(reply_string)-1] = '\0'; ! if (rule->result) ! fs_give((void **)&rule->result); ! fs_give((void **)&rule); ! } ! else ! if ((ps_global->VAR_REPLY_STRING) && (ps_global->VAR_REPLY_STRING[0])){ ! strncpy(reply_string,ps_global->VAR_REPLY_STRING, sizeof(reply_string)-1); ! reply_string[sizeof(reply_string)-1] = '\0'; ! } ! else ! strncpy(reply_string,"> ",sizeof("> ")); ! } ! ! strncpy(buf, reply_string, sizeof(buf)-1); buf[sizeof(buf)-1] = '\0'; /* set up the prefix to quote included text */ *************** *** 1621,1630 **** int reply_quote_str_contains_tokens() { ! return(ps_global->VAR_REPLY_STRING && ps_global->VAR_REPLY_STRING[0] && ! (strstr(ps_global->VAR_REPLY_STRING, from_token) || ! strstr(ps_global->VAR_REPLY_STRING, nick_token) || ! strstr(ps_global->VAR_REPLY_STRING, init_token))); } /* --- 1666,1696 ---- int reply_quote_str_contains_tokens() { ! char *reply_string; ! ! reply_string = (char *) malloc( 80*sizeof(char)); ! { RULE_RESULT *rule; ! rule = (RULE_RESULT *) ! get_result_rule(ps_global->vars[V_REPLY_INDENT_RULES].current_val.l, ! FOR_RULE | FOR_COMPOSE, (ENVELOPE *)NULL); ! if (rule){ ! reply_string = cpystr(rule->result); ! if (rule->result) ! fs_give((void **)&rule->result); ! fs_give((void **)&rule); ! } ! else ! if ((ps_global->VAR_REPLY_STRING) && (ps_global->VAR_REPLY_STRING[0])){ ! strncpy(reply_string,ps_global->VAR_REPLY_STRING, sizeof(reply_string)-1); ! reply_string[sizeof(reply_string)-1] = '\0'; ! } ! else ! reply_string = cpystr("> "); ! } ! return(reply_string && reply_string[0] && ! (strstr(reply_string, from_token) || ! strstr(reply_string, nick_token) || ! strstr(reply_string, init_token))); } /* *************** *** 1634,1679 **** * 0 if we're NOT to include the text * -1 on cancel or error */ int ! reply_text_query(ps, many, prefix) struct pine *ps; long many; char **prefix; { int ret, edited = 0; ! static ESCKEY_S rtq_opts[] = { ! {'y', 'y', "Y", "Yes"}, ! {'n', 'n', "N", "No"}, ! {-1, 0, NULL, NULL}, /* may be overridden below */ ! {-1, 0, NULL, NULL} ! }; if(F_ON(F_AUTO_INCLUDE_IN_REPLY, ps) ! && F_OFF(F_ENABLE_EDIT_REPLY_INDENT, ps)) return(1); while(1){ ! sprintf(tmp_20k_buf, "Include %s%soriginal message%s in Reply%s%s%s? ", (many > 1L) ? comatose(many) : "", (many > 1L) ? " " : "", (many > 1L) ? "s" : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? " (using \"" : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? *prefix : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? "\")" : ""); ! if(F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps)){ ! rtq_opts[2].ch = ctrl('R'); ! rtq_opts[2].rval = 'r'; ! rtq_opts[2].name = "^R"; ! rtq_opts[2].label = "Edit Indent String"; } ! else ! rtq_opts[2].ch = -1; switch(ret = radio_buttons(tmp_20k_buf, ps->ttyo->screen_rows > 4 ? -FOOTER_ROWS(ps_global) : -1, ! rtq_opts, (edited || F_ON(F_AUTO_INCLUDE_IN_REPLY, ps)) ? 'y' : 'n', 'x', NO_HELP, RB_SEQ_SENSITIVE)){ --- 1700,1804 ---- * 0 if we're NOT to include the text * -1 on cancel or error */ + + #define MAX_REPLY_OPTIONS 8 + int ! reply_text_query(ps, many, env, prefix) struct pine *ps; long many; + ENVELOPE *env; char **prefix; { int ret, edited = 0; ! static ESCKEY_S compose_style[MAX_REPLY_OPTIONS]; ! int ekey_num; + role_chosen = NULL; + strip = 1; + use_reply_to = F_ON(F_AUTO_REPLY_TO, ps) ? -2 : -1; + + /* there are four values: -2, 1 : use reply to + -1, 0 : do not use reply to + the only difference is that negative values are set by us and non negative + values are set by users */ + if(F_ON(F_AUTO_INCLUDE_IN_REPLY, ps) ! && F_OFF(F_ENABLE_EDIT_REPLY_INDENT, ps) && F_OFF(F_ALT_REPLY_MENU,ps)) return(1); while(1){ ! sprintf(tmp_20k_buf,"Include %s%soriginal message%s in Reply%s%s%s%s%s? ", (many > 1L) ? comatose(many) : "", (many > 1L) ? " " : "", (many > 1L) ? "s" : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? " (using \"" : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? *prefix : "", + role_chosen ? "\" and role \"" : "", + role_chosen ? role_chosen->nick : "", F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps) ? "\")" : ""); ! ekey_num = 0; ! compose_style[ekey_num].ch = 'y'; ! compose_style[ekey_num].rval = 'y'; ! compose_style[ekey_num].name = "Y"; ! compose_style[ekey_num++].label = "Yes"; ! ! compose_style[ekey_num].ch = 'n'; ! compose_style[ekey_num].rval = 'n'; ! compose_style[ekey_num].name = "N"; ! compose_style[ekey_num++].label = "No"; ! ! if (F_ON(F_ENABLE_EDIT_REPLY_INDENT, ps)){ ! compose_style[ekey_num].ch = ctrl('R'); ! compose_style[ekey_num].rval = 'r'; ! compose_style[ekey_num].name = "^R"; ! compose_style[ekey_num++].label = "Indent Str" ; ! } ! ! ! ! /***** Alternate Reply Menu ********/ ! ! if (F_ON(F_ALT_REPLY_MENU, ps)){ ! unsigned which_help; ! ! if (F_ON(F_ENABLE_STRIP_SIGDASHES, ps) || ! F_ON(F_ENABLE_SIGDASHES, ps)){ ! compose_style[ekey_num].ch = 's'; ! compose_style[ekey_num].rval = 's'; ! compose_style[ekey_num].name = "S"; ! if (!strip) ! compose_style[ekey_num++].label = "No Strip"; ! else ! compose_style[ekey_num++].label = "Strip Sig"; ! } ! ! compose_style[ekey_num].ch = 'r'; ! compose_style[ekey_num].rval = 'R'; ! compose_style[ekey_num].name = "R"; ! compose_style[ekey_num++].label = "Set Role"; ! ! if(env && env->reply_to && !addr_lists_same(env->reply_to, env->from)){ ! compose_style[ekey_num].ch = 't'; ! compose_style[ekey_num].rval = 't'; ! compose_style[ekey_num].name = "T"; ! compose_style[ekey_num++].label = ((use_reply_to == -2) || ! (use_reply_to == 1)) ! ? "UseRepTo" : "NoRepTo"; ! } } ! compose_style[ekey_num].ch = -1; ! compose_style[ekey_num].name = NULL; ! compose_style[ekey_num].label = NULL; + + /***** End Alt Reply Menu *********/ + switch(ret = radio_buttons(tmp_20k_buf, ps->ttyo->screen_rows > 4 ? -FOOTER_ROWS(ps_global) : -1, ! compose_style, (edited || F_ON(F_AUTO_INCLUDE_IN_REPLY, ps)) ? 'y' : 'n', 'x', NO_HELP, RB_SEQ_SENSITIVE)){ *************** *** 1681,1686 **** --- 1806,1847 ---- cmd_cancelled("Reply"); return(-1); + case 't': + if (use_reply_to < 0) + use_reply_to = F_ON(F_AUTO_REPLY_TO, ps); + use_reply_to = (use_reply_to + 1) % 2; + break; + + case 's': + if (F_ON(F_ENABLE_STRIP_SIGDASHES, ps) || + F_ON(F_ENABLE_SIGDASHES, ps)){ + strip = (strip + 1) % 2; + } + else + q_status_message1(SM_ORDER, 3, 4, + "Invalid rval \'%s\'", pretty_command(ret)); + break; + + case 'R': + { + void (*prev_screen)() = ps->prev_screen, + (*redraw)() = ps->redrawer; + ps->redrawer = NULL; + ps->next_screen = SCREEN_FUN_NULL; + if(role_select_screen(ps, &role_chosen, 1) < 0){ + cmd_cancelled("Reply"); + ps->next_screen = prev_screen; + ps->redrawer = redraw; + return -1; + } + ps->next_screen = prev_screen; + ps->redrawer = redraw; + if(role_chosen) + role_chosen = combine_inherited_role(role_chosen); + } + (*ps->redrawer)(); + break; + case 'r': if(prefix && *prefix){ int done = 0; *************** *** 2191,2196 **** --- 2352,2361 ---- buf[0] = '\0'; switch(type){ + case iFfrom: + addr = env && env->sparep ? env->sparep : NULL; + break; + case iFrom: addr = env ? env->from : NULL; break; *************** *** 2597,2602 **** --- 2762,2773 ---- break; + case iRole: + if (ps_global->role) + sprintf(buf, ps_global->role); + break; + + case iFfrom: case iFrom: case iTo: case iCc: *************** *** 2603,2611 **** --- 2774,2840 ---- case iSender: case iRecips: case iInit: + if (env) get_addr_data(env, type, buf, maxlen); break; + case iFolder: + sprintf(buf,ps_global->cur_folder); + break; + + case iCollection: + sprintf(buf,ps_global->context_current->nickname); + break; + + case iFlag: + {MESSAGECACHE *mc; + int msg_no = mn_m2raw(ps_global->msgmap, mn_get_cur(ps_global->msgmap)); + mc = mail_elt(ps_global->mail_stream, msg_no); + sprintf(buf,"%s%s%s%s",mc->flagged ? "*" : "", + mc->recent ? (mc->seen ? "R" : "N") : (mc->seen) ? "R" : "U", + mc->answered ? "A" : "", + mc->deleted ? "D" : "" ); + } + break; + + case iNick: + { + ADDRESS *tmp_adr = NULL; + if (env){ + tmp_adr = env->from ? copyaddr(env->from) + : env->sender ? copyaddr(env->sender) : NULL; + get_nickname_from_addr(tmp_adr,buf,maxlen); + mail_free_address(&tmp_adr); + } + } + break; + + case iAddressTo: + case iFadd: + { + ADDRESS *sparep = (type == iAddressTo) + ? ((env && env->to) + ? copyaddr(env->to) + : NULL) + : ((env && env->sparep) + ? copyaddr((ADDRESS *)env->sparep) + : NULL); + + if(sparep && sparep->mailbox && sparep->mailbox[0] && + strlen(sparep->mailbox) <= maxlen){ + strcpy(buf, sparep->mailbox); + if(sparep->host && + sparep->host[0] && + sparep->host[0] != '.' && + strlen(buf) + strlen(sparep->host) + 1 <= maxlen){ + strcat(buf, "@"); + strcat(buf, sparep->host); + } + } + } + + break; + case iAddress: case iMailbox: if(env && env->from && env->from->mailbox && env->from->mailbox[0] && *************** *** 2623,2628 **** --- 2852,2862 ---- break; + case iLcc: /* fake it, there are not enough spare pointers */ + if (env && env->date) + sprintf(buf,env->date); + break; + case iNews: get_news_data(env, type, buf, maxlen); break; *************** *** 2728,2735 **** char *filtered = NULL; int len; - strncpy(buf, ps_global->VAR_REPLY_INTRO, MAX_DELIM); buf[MAX_DELIM] = '\0'; /* preserve exact default behavior from before */ if(!strcmp(buf, DEFAULT_REPLY_INTRO)){ --- 2962,2981 ---- char *filtered = NULL; int len; + { RULE_RESULT *rule; + rule = (RULE_RESULT *) + get_result_rule(ps_global->VAR_REPLY_LEADIN_RULES, + FOR_RULE | FOR_REPLY_INTRO, env); + if (rule){ + strncpy(buf, rule->result, MAX_DELIM); + if (rule->result) + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + else + strncpy(buf, ps_global->VAR_REPLY_INTRO, MAX_DELIM); + } buf[MAX_DELIM] = '\0'; /* preserve exact default behavior from before */ if(!strcmp(buf, DEFAULT_REPLY_INTRO)){ *************** *** 2959,2964 **** --- 3205,3212 ---- if(is_sig){ /* + * First we check if there is a rule about signatures, if there is + * use it, otherwise keep going and do the following: * If role->litsig is set, we use it; * Else, if VAR_LITERAL_SIG is set, we use that; * Else, if role->sig is set, we use that; *************** *** 2972,2985 **** * there is no reason to mix them, so we don't provide support to * do so. */ ! if(role && role->litsig) ! literal_sig = role->litsig; ! else if(ps_global->VAR_LITERAL_SIG) ! literal_sig = ps_global->VAR_LITERAL_SIG; ! else if(role && role->sig) ! sigfile = role->sig; ! else ! sigfile = ps_global->VAR_SIGNATURE_FILE; } else if(role && role->template) sigfile = role->template; --- 3220,3246 ---- * there is no reason to mix them, so we don't provide support to * do so. */ ! { RULE_RESULT *rule; ! rule = (RULE_RESULT *) ! get_result_rule(ps_global->vars[V_COMPOSE_RULES].current_val.l, ! FOR_RULE | FOR_COMPOSE, env); ! if (rule){ ! sigfile = cpystr(rule->result); ! if (rule->result) ! fs_give((void **)&rule->result); ! fs_give((void **)&rule); ! } ! } ! if (!sigfile){ ! if(role && role->litsig) ! literal_sig = role->litsig; ! else if(ps_global->VAR_LITERAL_SIG) ! literal_sig = ps_global->VAR_LITERAL_SIG; ! else if(role && role->sig) ! sigfile = role->sig; ! else ! sigfile = ps_global->VAR_SIGNATURE_FILE; ! } } else if(role && role->template) sigfile = role->template; *************** *** 3176,3182 **** } } /* these are all from the envelope */ ! else if(pt->what_for & FOR_REPLY_INTRO) repl = get_reply_data(env,pt->ctype,subbuf,sizeof(subbuf)-1); if(*p == LPAREN){ /* if-else construct */ --- 3437,3443 ---- } } /* these are all from the envelope */ ! else if(pt->what_for & (FOR_REPLY_INTRO| FOR_RULE)) repl = get_reply_data(env,pt->ctype,subbuf,sizeof(subbuf)-1); if(*p == LPAREN){ /* if-else construct */ *************** *** 3629,3637 **** } } ! if(role) q_status_message1(SM_ORDER, 3, 4, "Forwarding using role \"%.200s\"", role->nick); if(role && role->template){ char *filtered; --- 3890,3903 ---- } } ! if (ps_global->role) ! fs_give((void **)&ps_global->role); ! ! if(role){ q_status_message1(SM_ORDER, 3, 4, "Forwarding using role \"%.200s\"", role->nick); + ps_global->role = cpystr(role->nick); + } if(role && role->template){ char *filtered; *************** *** 3827,3832 **** --- 4093,4099 ---- #if defined(DOS) && !defined(_WINDOWS) free((void *)reserve); #endif + outgoing->sparep = env && env->from ? (ADDRESS *)copyaddr(env->from) : NULL; pine_send(outgoing, &body, "FORWARD MESSAGE", role, NULL, reply.flags ? &reply : NULL, redraft_pos, NULL, NULL, FALSE); *************** *** 4706,4713 **** } if(prefix){ ! if(F_ON(F_ENABLE_SIGDASHES, ps_global) || ! F_ON(F_ENABLE_STRIP_SIGDASHES, ps_global)){ dashdata = 0; filters[i].filter = gf_line_test; filters[i++].data = gf_line_test_opt(sigdash_strip, &dashdata); --- 4973,4980 ---- } if(prefix){ ! if(strip && (F_ON(F_ENABLE_SIGDASHES, ps_global) || ! F_ON(F_ENABLE_STRIP_SIGDASHES, ps_global))){ dashdata = 0; filters[i].filter = gf_line_test; filters[i++].data = gf_line_test_opt(sigdash_strip, &dashdata); diff -rc pine4.52/pine/send.c pine4.52.I.USE/pine/send.c *** pine4.52/pine/send.c Wed Jan 8 12:01:33 2003 --- pine4.52.I.USE/pine/send.c Tue Jan 14 13:13:58 2003 *************** *** 366,371 **** --- 366,376 ---- role->nick = cpystr("Default Role"); } + if (ps_global->role) + fs_give((void **)&ps_global->role); + + ps_global->role = cpystr(role->nick); + compose_mail(NULL, NULL, role, NULL, NULL); free_action(&role); pine_state->next_screen = prev_screen; *************** *** 569,576 **** } ps_global->next_screen = prev_screen; ps_global->redrawer = redraw; ! if(role) role = combine_inherited_role(role); } break; case 'f': --- 574,585 ---- } ps_global->next_screen = prev_screen; ps_global->redrawer = redraw; ! if (ps_global->role) ! fs_give((void **)&ps_global->role); ! if(role){ role = combine_inherited_role(role); + ps_global->role = cpystr(role->nick); + } } break; case 'f': *************** *** 836,841 **** --- 845,851 ---- if(given_to) rfc822_parse_adrlist(&outgoing->to, given_to, ps_global->maildomain); + outgoing->subject = ps_global->subject; outgoing->message_id = generate_message_id(); /* *************** *** 866,874 **** } } ! if(role) q_status_message1(SM_ORDER, 3, 4, "Composing using role \"%.200s\"", role->nick); /* * The type of storage object allocated below is vitally --- 876,890 ---- } } ! if (ps_global->role) ! fs_give((void **)&ps_global->role); ! ! ! if(role){ q_status_message1(SM_ORDER, 3, 4, "Composing using role \"%.200s\"", role->nick); + ps_global->role = cpystr(role->nick); + } /* * The type of storage object allocated below is vitally *************** *** 974,983 **** if(lcc) fs_give((void **)&lcc); mail_free_envelope(&outgoing); pine_free_body(&body); free_redraft_pos(&redraft_pos); ! free_action(&role); } --- 990,1000 ---- if(lcc) fs_give((void **)&lcc); + if (!ps_global->send_immediately){ mail_free_envelope(&outgoing); pine_free_body(&body); free_redraft_pos(&redraft_pos); ! free_action(&role);} } *************** *** 2073,2079 **** static struct headerentry he_template[]={ {"From : ", "From", h_composer_from, 10, 0, NULL, build_address, NULL, NULL, addr_book_compose, "To AddrBk", NULL, ! 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, KS_TOADDRBOOK}, {"Reply-To: ", "Reply To", h_composer_reply_to, 10, 0, NULL, build_address, NULL, NULL, addr_book_compose, "To AddrBk", NULL, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, KS_TOADDRBOOK}, --- 2090,2096 ---- static struct headerentry he_template[]={ {"From : ", "From", h_composer_from, 10, 0, NULL, build_address, NULL, NULL, addr_book_compose, "To AddrBk", NULL, ! 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, KS_TOADDRBOOK}, {"Reply-To: ", "Reply To", h_composer_reply_to, 10, 0, NULL, build_address, NULL, NULL, addr_book_compose, "To AddrBk", NULL, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, KS_TOADDRBOOK}, *************** *** 2179,2189 **** #define N_OURREPLYTO 20 #define N_OURHDRS 21 #define N_SENDER 22 /* this is used in pine_send and pine_simple_send */ /* name::type::canedit::writehdr::localcopy::rcptto */ static PINEFIELD pf_template[] = { ! {"From", Address, 0, 1, 1, 0}, {"Reply-To", Address, 0, 1, 1, 0}, {"To", Address, 1, 1, 1, 1}, {"cc", Address, 1, 1, 1, 1}, --- 2196,2208 ---- #define N_OURREPLYTO 20 #define N_OURHDRS 21 #define N_SENDER 22 + #define CAN_EDIT(x) (!((x)->never_allow_changing_from) && \ + F_ON(F_ALLOW_CHANGING_FROM, (x))) /* this is used in pine_send and pine_simple_send */ /* name::type::canedit::writehdr::localcopy::rcptto */ static PINEFIELD pf_template[] = { ! {"From", Address, 1, 1, 1, 0}, {"Reply-To", Address, 0, 1, 1, 0}, {"To", Address, 1, 1, 1, 1}, {"cc", Address, 1, 1, 1, 1}, *************** *** 2321,2327 **** *p = *(p+4); pf->type = pf_template[i].type; ! pf->canedit = pf_template[i].canedit; pf->rcptto = pf_template[i].rcptto; pf->writehdr = pf_template[i].writehdr; pf->localcopy = pf_template[i].localcopy; --- 2340,2346 ---- *p = *(p+4); pf->type = pf_template[i].type; ! pf->canedit = (i == N_FROM) ? CAN_EDIT(ps_global) : pf_template[i].canedit; pf->rcptto = pf_template[i].rcptto; pf->writehdr = pf_template[i].writehdr; pf->localcopy = pf_template[i].localcopy; *************** *** 3006,3011 **** --- 3025,3032 ---- pbf = &pbuf1; standard_picobuf_setup(pbf); + pbf->auto_cmds = ps_global->initial_cmds_backup; /* save the list of commands */ + /* * Cancel any pending initial commands since pico uses a different * input routine. If we didn't cancel them, they would happen after *************** *** 3436,3441 **** --- 3457,3467 ---- he->rich_header = 0; } } + if (F_ON(F_ALLOW_CHANGING_FROM, ps_global) && + !ps_global->never_allow_changing_from){ + he->display_it = 1; /* show it */ + he->rich_header = 0; + } he_from = he; break; *************** *** 3543,3548 **** --- 3569,3593 ---- removing_trailing_white_space(pf->textbuf); (void)removing_double_quotes(pf->textbuf); build_address(pf->textbuf, &addr, NULL, NULL, NULL); + if (!strncmp(pf->name,"Lcc",3) && addr && *addr){ + RULE_RESULT *rule; + + outgoing->date = cpystr(addr); + rule = (RULE_RESULT *) + get_result_rule(ps_global->VAR_FORWARD_RULES, + FOR_RULE|FOR_COMPOSE|FOR_TRIM, outgoing); + if (rule){ + addr = cpystr(rule->result); + removing_trailing_white_space(addr); + (void)removing_extra_stuff(addr); + if (rule->result) + fs_give((void **)&rule->result); + fs_give((void **)&rule); + } + if (outgoing->date) + fs_give((void **)&outgoing->date); + } + rfc822_parse_adrlist(pf->addr, addr, ps_global->maildomain); fs_give((void **)&addr); *************** *** 4042,4050 **** --- 4087,4098 ---- /* turn off user input timeout when in composer */ saved_user_timeout = ps_global->hours_to_timeout; ps_global->hours_to_timeout = 0; + ps_global->in_pico = 1; /* in */ dprint(1, (debugfile, "\n ---- COMPOSER ----\n")); editor_result = pico(pbf); + ps_global->force_check_now = 0; /* do not check incoming folders now */ dprint(4, (debugfile, "... composer returns (0x%x)\n", editor_result)); + ps_global->in_pico = 0; /* out */ ps_global->hours_to_timeout = saved_user_timeout; #if defined(DOS) && !defined(_WINDOWS) *************** *** 4112,4118 **** if(outgoing->return_path) mail_free_address(&outgoing->return_path); ! outgoing->return_path = rfc822_cpy_adr(outgoing->from); /* * Don't ever believe the sender that is there. --- 4160,4168 ---- if(outgoing->return_path) mail_free_address(&outgoing->return_path); ! outgoing->return_path = F_ON(F_USE_DOMAIN_NAME,ps_global) ! ? rfc822_cpy_adr(generate_from()) ! : rfc822_cpy_adr(outgoing->from); /* * Don't ever believe the sender that is there. *************** *** 4810,4815 **** --- 4860,4867 ---- /*----- Mail Post FAILED, back to composer -----*/ if(result & (P_MAIL_LOSE | P_FCC_LOSE)){ dprint(1, (debugfile, "Send failed, continuing\n")); + if (ps_global->send_immediately) + exit(EXIT_FAILURE); if(result & P_FCC_LOSE){ /* *************** *** 4839,4844 **** --- 4891,4897 ---- update_answered_flags(reply); /*----- Signed, sealed, delivered! ------*/ + if (!ps_global->send_immediately) q_status_message(SM_ORDER, 0, 3, pine_send_status(result, fcc, tmp_20k_buf, NULL)); *************** *** 6413,6421 **** char error_buf[200], *error_mess = NULL, *postcmd; ADDRESS *a; ENVELOPE *fake_env = NULL; ! int addr_error_count, we_cancel = 0; long smtp_opts = 0L; ! char *verbose_file = NULL; BODY *bp = NULL; PINEFIELD *pf; --- 6466,6474 ---- char error_buf[200], *error_mess = NULL, *postcmd; ADDRESS *a; ENVELOPE *fake_env = NULL; ! int addr_error_count, we_cancel = 0, num_servers = 0, num_alt_servers = 0, num_rules = 0, added_rules = -1; long smtp_opts = 0L; ! char *verbose_file = NULL, **smtp_list; BODY *bp = NULL; PINEFIELD *pf; *************** *** 6541,6560 **** * was either none specified or we decided not to use it. So, * if there's an smtp-server defined anywhere, */ ! if(alt_smtp_servers && alt_smtp_servers[0] && alt_smtp_servers[0][0]){ /*---------- SMTP ----------*/ dprint(4, (debugfile, "call_mailer: via TCP (%s)\n", ! alt_smtp_servers[0])); TIME_STAMP("smtp-open start (tcp)", 1); ! sending_stream = smtp_open(alt_smtp_servers, smtp_opts); } - else if(ps_global->VAR_SMTP_SERVER && ps_global->VAR_SMTP_SERVER[0] - && ps_global->VAR_SMTP_SERVER[0][0]){ - /*---------- SMTP ----------*/ - dprint(4, (debugfile, "call_mailer: via TCP\n")); - TIME_STAMP("smtp-open start (tcp)", 1); - sending_stream = smtp_open(ps_global->VAR_SMTP_SERVER, smtp_opts); - } else if(postcmd = smtp_command(ps_global->c_client_error)){ char *cmdlist[2]; --- 6594,6673 ---- * was either none specified or we decided not to use it. So, * if there's an smtp-server defined anywhere, */ ! ! /* First we check for rules and make a list using the rules */ ! if(ps_global->VAR_SMTP_SERVER && ps_global->VAR_SMTP_SERVER[0] ! && ps_global->VAR_SMTP_SERVER[0][0]) ! while (ps_global->VAR_SMTP_SERVER[num_servers]) num_servers++; ! ! if(alt_smtp_servers && alt_smtp_servers[0] ! && alt_smtp_servers[0][0]) ! while (alt_smtp_servers[num_alt_servers]) num_alt_servers++; ! ! if(ps_global->VAR_SMTP_RULES && ps_global->VAR_SMTP_RULES[0] ! && ps_global->VAR_SMTP_RULES[0][0]) ! while (ps_global->VAR_SMTP_RULES[num_rules]) num_rules++; ! ! if(num_rules){ ! int i = 0, j = 0; ! ! added_rules = 0; ! smtp_list = (char **) fs_get ((num_rules + num_servers + num_alt_servers + 1)*sizeof(char*)); ! for (i = 0; i < num_rules; i++){ ! char *rule_result = (char *) process_rule(ps_global->VAR_SMTP_RULES[i],FOR_RULE | FOR_COMPOSE, header->env); ! if (rule_result && *rule_result){ ! smtp_list[j++] = cpystr(rule_result); ! added_rules++; ! } ! } ! } ! ! if(num_alt_servers){ ! int i = 0, j; ! ! if (added_rules < 0){ ! smtp_list = (char **) fs_get ((num_alt_servers + num_servers + 1)*sizeof(char*)); ! added_rules = 0; ! } ! ! j = added_rules; ! ! while (alt_smtp_servers[i] && ! alt_smtp_servers[i][0]){ ! smtp_list[j++] = cpystr(alt_smtp_servers[i++]); ! added_rules++; ! } ! } ! ! if(num_servers){ ! int i = 0, j; ! ! if (added_rules < 0){ ! smtp_list = (char **) fs_get ((num_servers + 1)*sizeof(char*)); ! added_rules = 0; ! } ! ! j = added_rules; ! ! while (ps_global->VAR_SMTP_SERVER[i] && ! ps_global->VAR_SMTP_SERVER[i][0]){ ! smtp_list[j++] = cpystr(ps_global->VAR_SMTP_SERVER[i++]); ! added_rules++; ! } ! } ! ! if (added_rules < 0){ ! smtp_list = (char **) fs_get (sizeof(char*)); ! added_rules = 0; ! } ! smtp_list[added_rules] = NULL; ! if(smtp_list && smtp_list[0] && smtp_list[0][0]){ /*---------- SMTP ----------*/ dprint(4, (debugfile, "call_mailer: via TCP (%s)\n", ! smtp_list[0])); TIME_STAMP("smtp-open start (tcp)", 1); ! sending_stream = smtp_open(smtp_list, smtp_opts); } else if(postcmd = smtp_command(ps_global->c_client_error)){ char *cmdlist[2]; *************** *** 6752,6757 **** --- 6865,6872 ---- q_status_message(SM_ORDER | SM_DING, 4, 7, error_mess); dprint(1, (debugfile, "call_mailer ERROR: %s\n", error_mess)); + if (ps_global->send_immediately) + printf("%s\n",error_mess); return(-1); } else{ diff -rc pine4.52/pine/signals.c pine4.52.I.USE/pine/signals.c *** pine4.52/pine/signals.c Wed Nov 27 15:22:56 2002 --- pine4.52.I.USE/pine/signals.c Tue Jan 14 13:13:58 2003 *************** *** 86,91 **** --- 86,93 ---- init_signals() { dprint(9, (debugfile, "init_signals()\n")); + if (ps_global->send_immediately) + return; init_sighup(); now_handling_alarms++; #ifdef _WINDOWS *************** *** 605,610 **** --- 607,614 ---- percent_done_t pc_func; int init_msg; { + int res; + unsigned char c; int retval = 1; if(!now_handling_alarms) *************** *** 656,669 **** slots_used = max(0, min(space_left-3, 10)); if(percent_done_ptr && slots_used >= 4){ sprintf(progress, "%s |%*s|", busy_message, slots_used, ""); ! q_status_message(SM_ORDER, 0, 1, progress); } else{ dotcount++; sprintf(progress, "%s%*s", busy_message, DISPLAY_CHARS_COLS + 1, ""); ! q_status_message(SM_ORDER, 0, 1, progress); } /* --- 660,677 ---- slots_used = max(0, min(space_left-3, 10)); if(percent_done_ptr && slots_used >= 4){ + if (!ps_global->send_immediately){ sprintf(progress, "%s |%*s|", busy_message, slots_used, ""); ! if (!ps_global->checking_incfld) ! q_status_message(SM_ORDER, 0, 1, progress);} } else{ dotcount++; + if (!ps_global->send_immediately){ sprintf(progress, "%s%*s", busy_message, DISPLAY_CHARS_COLS + 1, ""); ! if (!ps_global->checking_incfld) ! q_status_message(SM_ORDER, 0, 1, progress);} } /* *************** *** 673,679 **** * its min display time yet. In that case, we don't want * to force out the initial message. */ ! display_message('x'); } } --- 681,689 ---- * its min display time yet. In that case, we don't want * to force out the initial message. */ ! if ((!ps_global->send_immediately) ! && (!ps_global->checking_incfld)) ! display_message('x'); } } *************** *** 680,690 **** #ifdef _WINDOWS mswin_setcursor (MSWIN_CURSOR_BUSY); #endif fflush(stdout); } /* set alarm */ ! if(F_OFF(F_DISABLE_ALARM, ps_global)) alarm(seconds); return(retval); --- 690,702 ---- #ifdef _WINDOWS mswin_setcursor (MSWIN_CURSOR_BUSY); #endif + if (!ps_global->send_immediately) fflush(stdout); } /* set alarm */ ! if(F_OFF(F_DISABLE_ALARM, ps_global) && (!ps_global->send_immediately) ! && (!ps_global->checking_incfld)) alarm(seconds); return(retval); *************** *** 721,738 **** right = (slots_used - 4)/2; left = slots_used - 4 - right; sprintf(progress, "%s |%*s100%%%*s|", busy_message, left, "", right, ""); q_status_message(SM_ORDER, message_pri>=2 ? max(message_pri,3) : 0, ! message_pri+2, progress); } else{ sprintf(progress, "%s%*sDONE", busy_message, DISPLAY_CHARS_COLS - 4 + 1, ""); q_status_message(SM_ORDER, message_pri>=2 ? max(message_pri,3) : 0, ! message_pri+2, progress); } } else --- 733,754 ---- right = (slots_used - 4)/2; left = slots_used - 4 - right; + if (!ps_global->send_immediately){ sprintf(progress, "%s |%*s100%%%*s|", busy_message, left, "", right, ""); + if (!ps_global->checking_incfld) q_status_message(SM_ORDER, message_pri>=2 ? max(message_pri,3) : 0, ! message_pri+2, progress);} } else{ + if (!ps_global->send_immediately){ sprintf(progress, "%s%*sDONE", busy_message, DISPLAY_CHARS_COLS - 4 + 1, ""); + if (!ps_global->checking_incfld) q_status_message(SM_ORDER, message_pri>=2 ? max(message_pri,3) : 0, ! message_pri+2, progress);} } } else diff -rc pine4.52/pine/status.c pine4.52.I.USE/pine/status.c *** pine4.52/pine/status.c Wed Nov 27 15:22:56 2002 --- pine4.52.I.USE/pine/status.c Tue Jan 14 13:13:58 2003 *************** *** 151,156 **** --- 151,159 ---- istrncpy(clean_msg, message, mlen); /* does the cleaning */ clean_msg[mlen] = '\0'; + if (ps_global->send_immediately) + return; + /* Hunt to last message -- if same already queued, move on... */ if(new = message_queue){ while(new->next != message_queue) *************** *** 1135,1141 **** char *q2; int rv; ! if(!ps_global->ttyo) return(pre_screen_config_want_to(question, dflt, on_ctrl_C)); #ifdef _WINDOWS if (mswin_usedialog ()) { --- 1138,1144 ---- char *q2; int rv; ! if((!ps_global->ttyo) || (ps_global->send_immediately)) return(pre_screen_config_want_to(question, dflt, on_ctrl_C)); #ifdef _WINDOWS if (mswin_usedialog ()) { diff -rc pine4.52/pine/strings.c pine4.52.I.USE/pine/strings.c *** pine4.52/pine/strings.c Wed Nov 27 15:22:57 2002 --- pine4.52.I.USE/pine/strings.c Tue Jan 14 13:13:58 2003 *************** *** 134,140 **** int rfc2369_parse PROTO((char *, RFC2369_S *)); - /* * Useful def's to help with HEX string conversions */ --- 134,139 ---- *************** *** 5487,5493 **** SortOrder def_sort; int def_sort_rev; ! if(decode_sort(p, &def_sort, &def_sort_rev) != -1){ action->sort_is_set = 1; action->sortorder = def_sort; action->revsort = (def_sort_rev ? 1 : 0); --- 5486,5492 ---- SortOrder def_sort; int def_sort_rev; ! if(decode_sort(p, &def_sort, &def_sort_rev, 0) != -1){ action->sort_is_set = 1; action->sortorder = def_sort; action->revsort = (def_sort_rev ? 1 : 0); *************** *** 9350,9352 **** --- 9349,9383 ---- return(idata); } + + + void + removing_extra_stuff(string) + char *string; + { + char *p = NULL; + int change = 0, length = 0; + + + if(!string) + return; + + for(; *string; string++, length++) + p = ((unsigned char)*string != ',') ? NULL : (!p) ? string : p; + + if(p) + *p = '\0'; + + string -= length; + for (; *string; string++){ + if (change){ + *string = ' '; + change = 0; + } + if ((((unsigned char)*string == ' ') || + ((unsigned char)*string == ',')) && + ((unsigned char)*(string + 1) == ',')) + change++; + } + } + diff -rc pine4.52/pine/osdep/pipe pine4.52.I.USE/pine/osdep/pipe *** pine4.52/pine/osdep/pipe Wed Oct 24 14:21:23 2001 --- pine4.52.I.USE/pine/osdep/pipe Tue Jan 14 13:13:59 2003 *************** *** 418,423 **** --- 418,426 ---- fclose((*syspipe)->in.f); } + if (ps_global->send_immediately) + return(1); + #ifdef SIGCHLD { SigType (*alarm_sig)(); diff -rc pine4.52/pine/osdep/termin.gen pine4.52.I.USE/pine/osdep/termin.gen *** pine4.52/pine/osdep/termin.gen Tue Oct 16 15:34:29 2001 --- pine4.52.I.USE/pine/osdep/termin.gen Tue Jan 14 13:13:59 2003 *************** *** 6,12 **** --- 6,29 ---- int pcpine_oe_cursor PROTO((int, long)); #endif + void + fake_config_screen(tt) + struct ttyo **tt; + { + struct ttyo *ttyo; + ttyo = (struct ttyo *)fs_get(sizeof (struct ttyo)); + + ttyo->header_rows = 2; + ttyo->footer_rows = 3; + ttyo->screen_rows = 24; + ttyo->screen_cols = 80; + + *tt = ttyo; + + } + + /* * Generic tty input routines */ *************** *** 214,220 **** prompt, (escape_list && escape_list[0].ch != -1) ? escape_list[0].label: "")); ! if(!ps_global->ttyo) return(pre_screen_config_opt_enter(string, field_len, prompt, escape_list, help, flags)); --- 231,237 ---- prompt, (escape_list && escape_list[0].ch != -1) ? escape_list[0].label: "")); ! if((!ps_global->ttyo) || (ps_global->send_immediately)) return(pre_screen_config_opt_enter(string, field_len, prompt, escape_list, help, flags));