/[imapfilter]/imapfilter/data.c
ViewVC logotype

Diff of /imapfilter/data.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by lefcha, Sat Jul 13 23:03:28 2002 UTC revision 1.29 by lefcha, Thu Jul 25 21:24:39 2002 UTC
# Line 452  int set_action(char *line, regmatch_t * Line 452  int set_action(char *line, regmatch_t *
452                  return ERROR_CONFIG_PARSE;                  return ERROR_CONFIG_PARSE;
453          }          }
454          xfree(cp);          xfree(cp);
455      } else if (!strncasecmp(line + match[1].rm_so, "list", 4)){      } else if (!strncasecmp(line + match[1].rm_so, "list", 4)) {
456          cur_fltr->action.type = FILTER_ACTION_LIST;          cur_fltr->action.type = FILTER_ACTION_LIST;
457      }      }
   
458      if (match[10].rm_so != -1) {      if (match[10].rm_so != -1) {
459          strncat(cur_fltr->action.args, line + match[10].rm_so,          strncat(cur_fltr->action.args, line + match[10].rm_so,
460                  min(match[10].rm_eo - match[10].rm_so, ARGS_LEN - 2));                  min(match[10].rm_eo - match[10].rm_so, ARGS_LEN - 2));
# Line 499  void append_mask(mask_t * node) Line 498  void append_mask(mask_t * node)
498   * A new mask entry was declared, create it and set it's   * A new mask entry was declared, create it and set it's
499   * variables accordingly.   * variables accordingly.
500   */   */
501  int set_mask(char *line, regmatch_t * match)  int set_mask(char *line, regmatch_t * match, int mmt)
502  {  {
503      int n, i, f = 0;      int n;
504      mask_t *node;      mask_t *node;
505      char *bp;      char *bp;
506    
# Line 541  int set_mask(char *line, regmatch_t * ma Line 540  int set_mask(char *line, regmatch_t * ma
540      *(bp + n) = 0;      *(bp + n) = 0;
541      bp += n;      bp += n;
542    
543      /* Body of the search key (string/number). */      if (mmt != MASK_MATCH_1) {
544      for (i = 5; i <= 6; i++)          *(bp++) = ' ';
545    
546            if (mmt != MASK_MATCH_4 && *(line + match[5].rm_so) != '"')
547                *(bp++) = '"';
548            *bp = 0;
549    
550            n = min(match[5].rm_eo - match[5].rm_so,
551                    MASK_BODY_LEN - (bp - node->body) - 2);
552            xstrncpy(bp, line + match[5].rm_so, n);
553            *(bp + n) = 0;
554            bp += n;
555    
556            if (mmt != MASK_MATCH_4 && *(line + match[5].rm_so) != '"')
557                *(bp++) = '"';
558            *bp = 0;
559    
560            if (mmt == MASK_MATCH_3) {
561                *(bp++) = ' ';
562    
563                if (*(line + match[6].rm_so) != '"')
564                    *(bp++) = '"';
565                *bp = 0;
566    
567                n = min(match[6].rm_eo - match[6].rm_so,
568                        MASK_BODY_LEN - (bp - node->body) - 2);
569                xstrncpy(bp, line + match[6].rm_so, n);
570                *(bp + n) = 0;
571                bp += n;
572    
573                if (*(line + match[6].rm_so) != '"')
574                    *(bp++) = '"';
575                *bp = 0;
576            }
577            if (mmt == MASK_MATCH_4 && (strstr(node->body, "OLDER") ||
578                                        strstr(node->body, "NEWER"))) {
579                convert_date(node);
580                bp = node->body + strlen(node->body);
581            }
582        }
583    /*   for (i = 5; i <= 6; i++)
584          if (match[i].rm_so != -1) {          if (match[i].rm_so != -1) {
585              *(bp++) = ' ';              *(bp++) = ' ';
586    
             /* Add '"' if not supplied and search key not a number. */  
587              if (match[6].rm_so == -1 &&              if (match[6].rm_so == -1 &&
588                  (strstr(node->body, "LARGER") ||                  (strstr(node->body, "LARGER") ||
589                   strstr(node->body, "SMALLER") ||                   strstr(node->body, "SMALLER") ||
# Line 571  int set_mask(char *line, regmatch_t * ma Line 608  int set_mask(char *line, regmatch_t * ma
608      if (f && (strstr(node->body, "OLDER") || strstr(node->body, "NEWER"))) {      if (f && (strstr(node->body, "OLDER") || strstr(node->body, "NEWER"))) {
609          convert_date(node);          convert_date(node);
610          bp = node->body + strlen(node->body);          bp = node->body + strlen(node->body);
611      }      }*/
612    
613      append_mask(node);      append_mask(node);
614    
615      cur_fltr->masknum++;      cur_fltr->masknum++;

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26