*** Elm113/getline.c Sun Apr 19 01:49:50 1992 --- new/getline.c Sat May 02 13:31:23 1992 *************** *** 14,21 **** --- 14,26 ---- Prototype BOOL get_config_entries(void); Prototype char *firstnwsp(char *); + #ifndef NOMETAMAIL + Prototype BOOL isNotTextPlain(char *line); + Prototype BOOL isNotReadable(char *line); + #endif + struct FlagItem { char *MsgID; StatusFlag Stat; *************** *** 38,45 **** static struct FlagItem *flgs; struct MailItem *act=NULL,*last; static int OldMaxArticle = 0; ! char TitleString[1024]; #ifdef DEBUG fprintf(stderr,"read_home_box: %s\n",FolderName); #endif --- 43,52 ---- static struct FlagItem *flgs; struct MailItem *act=NULL,*last; static int OldMaxArticle = 0; ! char *TitleString; + if ((TitleString = malloc(MAX_LINELENGTH)) == NULL) + clean_exit(20); #ifdef DEBUG fprintf(stderr,"read_home_box: %s\n",FolderName); #endif *************** *** 105,112 **** MaxArticle=0; ! if ((fp=OpenHomeBox())==NULL) return(0L); while (getline(fp,Line,&pos)) { #ifdef DEBUG --- 112,121 ---- MaxArticle=0; ! if ((fp=OpenHomeBox())==NULL) { ! free(TitleString); return(0L); + } while (getline(fp,Line,&pos)) { #ifdef DEBUG *************** *** 235,240 **** --- 244,259 ---- act->Urgent = 1; last_data = NULL; } + #ifndef NOMETAMAIL + else if (!strnicmp(Line,"Content-type:",13)) { + act->NotPlain |= isNotTextPlain(Line + 13); + last_data = NULL; + } + else if (!strnicmp(Line,"Content-Transfer-Encoding:",26)) { + act->NotPlain |= isNotReadable(Line + 26); + last_data = NULL; + } + #endif else if (!strnicmp(Line,"X-Status:",9)) { ptr = delete_wspaces_begin(Line+9); while (c=*ptr++) { *************** *** 369,374 **** --- 388,394 ---- #ifdef DEBUG fprintf(stderr," got %d message(s) from folder %s (%ld)\n",MaxArticle,FolderName,len); #endif + free(TitleString); return(len); } *************** *** 620,625 **** --- 640,648 ---- else if (!strnicmp(line,"ReverseSorting",14)) ReverseSorting = (!strnicmp(ptr,"Yes",3)); + else if (!strnicmp(line,"ElmToFront",10)) + ElmToFrontAllowed = (!strnicmp(ptr,"Yes",3)); + else if (!strnicmp(line,"WorkbenchToFront",16)) WBToFront = (!strnicmp(ptr,"Yes",3)); *************** *** 706,708 **** --- 729,792 ---- *s='\0'; } + + + #ifndef NOMETAMAIL + BOOL + isNotTextPlain(char *line) + { + char *s, *t; + + if (!line) + return(TRUE); + while (*line && isspace(*line)) + line++; + t = line + strlen(line); + while (t > line && isspace(*--t)) + ; + if (((t - line) == 3) && !strnicmp(line, "text", 4)) + return(FALSE); + if (strnicmp(line, "text/plain", 10)) + return(TRUE); + t = index(line, ';'); + while (t) { + t++; + while (*t && isspace(*t)) + t++; + if (!strnicmp(t, "charset", 7)) { + s = index(t, '='); + if (s) { + s++; + while (*s && isspace(*s)) + s++; + if (!strnicmp(s, "us-ascii", 8)) + return(FALSE); + if (!strnicmp(s, "iso-8859-1", 10)) + return(FALSE); + } + } + t = (char *) index(t, ';'); + } + return(FALSE); /* no charset, was text/plain */ + } + + + + BOOL + isNotReadable(char *line) + { + char *t; + + if (!line) + return(TRUE); + while (*line && isspace(*line)) + line++; + t = line + strlen(line); + while (t > line && isspace(*--t)) + ; + if (((t - line) == 3) && (!strnicmp(line, "7bit", 4) || + !strnicmp(line, "8bit", 4))) + return(FALSE); + return(TRUE); + } + #endif