home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / software / utilities / comms / metamail-2.3a / elm113diffs.lha / getline.diff < prev    next >
Text File  |  1992-05-02  |  4KB  |  169 lines

  1. *** Elm113/getline.c    Sun Apr 19 01:49:50 1992
  2. --- new/getline.c    Sat May 02 13:31:23 1992
  3. ***************
  4. *** 14,21 ****
  5. --- 14,26 ----
  6.   Prototype BOOL get_config_entries(void);
  7.   Prototype char *firstnwsp(char *);
  8.   
  9. + #ifndef NOMETAMAIL
  10. + Prototype BOOL isNotTextPlain(char *line);
  11. + Prototype BOOL isNotReadable(char *line);
  12. + #endif
  13.   
  14.   
  15.   struct FlagItem {
  16.     char *MsgID;
  17.     StatusFlag Stat;
  18. ***************
  19. *** 38,45 ****
  20.       static struct FlagItem *flgs;
  21.       struct MailItem *act=NULL,*last;
  22.       static int OldMaxArticle = 0;
  23. !     char TitleString[1024];
  24.   
  25.   #ifdef DEBUG
  26.         fprintf(stderr,"read_home_box: %s\n",FolderName);
  27.   #endif
  28. --- 43,52 ----
  29.       static struct FlagItem *flgs;
  30.       struct MailItem *act=NULL,*last;
  31.       static int OldMaxArticle = 0;
  32. !     char *TitleString;
  33.   
  34. +     if ((TitleString = malloc(MAX_LINELENGTH)) == NULL)
  35. +       clean_exit(20);
  36.   #ifdef DEBUG
  37.         fprintf(stderr,"read_home_box: %s\n",FolderName);
  38.   #endif
  39. ***************
  40. *** 105,112 ****
  41.   
  42.       MaxArticle=0;
  43.   
  44. !     if ((fp=OpenHomeBox())==NULL)
  45.           return(0L);
  46.   
  47.       while (getline(fp,Line,&pos)) {
  48.   #ifdef DEBUG
  49. --- 112,121 ----
  50.   
  51.       MaxArticle=0;
  52.   
  53. !     if ((fp=OpenHomeBox())==NULL) {
  54. !         free(TitleString);
  55.           return(0L);
  56. +     }
  57.   
  58.       while (getline(fp,Line,&pos)) {
  59.   #ifdef DEBUG
  60. ***************
  61. *** 235,240 ****
  62. --- 244,259 ----
  63.               act->Urgent = 1;
  64.               last_data = NULL;
  65.           }
  66. + #ifndef NOMETAMAIL
  67. +         else if (!strnicmp(Line,"Content-type:",13)) {
  68. +             act->NotPlain |= isNotTextPlain(Line + 13);
  69. +             last_data = NULL;
  70. +         }
  71. +         else if (!strnicmp(Line,"Content-Transfer-Encoding:",26)) {
  72. +             act->NotPlain |= isNotReadable(Line + 26);
  73. +             last_data = NULL;
  74. +         }
  75. + #endif
  76.           else if (!strnicmp(Line,"X-Status:",9)) {
  77.               ptr = delete_wspaces_begin(Line+9);
  78.               while (c=*ptr++) {
  79. ***************
  80. *** 369,374 ****
  81. --- 388,394 ----
  82.   #ifdef DEBUG
  83.         fprintf(stderr," got %d message(s) from folder %s (%ld)\n",MaxArticle,FolderName,len);
  84.   #endif
  85. +     free(TitleString);
  86.       return(len);
  87.   }
  88.   
  89. ***************
  90. *** 620,625 ****
  91. --- 640,648 ----
  92.           else if (!strnicmp(line,"ReverseSorting",14))
  93.             ReverseSorting = (!strnicmp(ptr,"Yes",3));
  94.   
  95. +         else if (!strnicmp(line,"ElmToFront",10))
  96. +           ElmToFrontAllowed = (!strnicmp(ptr,"Yes",3));
  97.           else if (!strnicmp(line,"WorkbenchToFront",16))
  98.             WBToFront = (!strnicmp(ptr,"Yes",3));
  99.   
  100. ***************
  101. *** 706,708 ****
  102. --- 729,792 ----
  103.       *s='\0';
  104.   }
  105.   
  106. + #ifndef NOMETAMAIL
  107. + BOOL
  108. + isNotTextPlain(char *line)
  109. + {
  110. +     char *s, *t;
  111. +     if (!line)
  112. +       return(TRUE);
  113. +     while (*line && isspace(*line))
  114. +         line++;
  115. +     t = line + strlen(line);
  116. +     while (t > line && isspace(*--t))
  117. +         ;
  118. +     if (((t - line) == 3) && !strnicmp(line, "text", 4))
  119. +         return(FALSE);
  120. +     if (strnicmp(line, "text/plain", 10))
  121. +         return(TRUE);
  122. +     t = index(line, ';');
  123. +     while (t) {
  124. +         t++;
  125. +         while (*t && isspace(*t))
  126. +             t++;
  127. +         if (!strnicmp(t, "charset", 7)) {
  128. +             s = index(t, '=');
  129. +             if (s) {
  130. +                 s++;
  131. +                 while (*s && isspace(*s))
  132. +                     s++;
  133. +                 if (!strnicmp(s, "us-ascii", 8))
  134. +                     return(FALSE);
  135. +                 if (!strnicmp(s, "iso-8859-1", 10))
  136. +                     return(FALSE);
  137. +             }
  138. +         }
  139. +         t = (char *) index(t, ';');
  140. +     }
  141. +     return(FALSE);  /* no charset, was text/plain */
  142. + }
  143. + BOOL
  144. + isNotReadable(char *line)
  145. + {
  146. +     char *t;
  147. +     if (!line)
  148. +       return(TRUE);
  149. +     while (*line && isspace(*line))
  150. +         line++;
  151. +     t = line + strlen(line);
  152. +     while (t > line && isspace(*--t))
  153. +         ;
  154. +     if (((t - line) == 3) && (!strnicmp(line, "7bit", 4) ||
  155. +                               !strnicmp(line, "8bit", 4)))
  156. +         return(FALSE);
  157. +     return(TRUE);
  158. + }
  159. + #endif
  160.