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

Diff of /imapfilter/filter.c

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

revision 1.10 by lefcha, Fri Feb 13 13:18:37 2004 UTC revision 1.11 by lefcha, Sat Feb 14 19:14:43 2004 UTC
# Line 67  set_filter(char *line, regmatch_t * m) Line 67  set_filter(char *line, regmatch_t * m)
67    
68          init_filter(f);          init_filter(f);
69    
70          strncat(f->key, line + m[1].rm_so,          strncat(f->key, line + m[1].rm_so, min(m[1].rm_eo - m[1].rm_so,
71              min(m[1].rm_eo - m[1].rm_so, KEY_LEN - 1));              KEY_LEN - 1));
72    
73          if (m[2].rm_so != -1) {          if (m[2].rm_so != -1) {
74                  if (!strncasecmp(line + m[2].rm_so + 1, "or", 2))                  if (!strncasecmp(line + m[2].rm_so + 1, "or", 2))
# Line 108  set_action(char *line, regmatch_t * m) Line 108  set_action(char *line, regmatch_t * m)
108                          strncat(curfltr->action.destmbox,                          strncat(curfltr->action.destmbox,
109                              line + m[2].rm_so + 1,                              line + m[2].rm_so + 1,
110                              min(m[2].rm_eo - m[2].rm_so - 2,                              min(m[2].rm_eo - m[2].rm_so - 2,
111                                  MBOX_LEN - 1));                              MBOX_LEN - 1));
112                  else                  else
113                          strncat(curfltr->action.destmbox, line + m[2].rm_so,                          strncat(curfltr->action.destmbox, line + m[2].rm_so,
114                              min(m[2].rm_eo - m[2].rm_so, MBOX_LEN - 1));                              min(m[2].rm_eo - m[2].rm_so, MBOX_LEN - 1));
# Line 119  set_action(char *line, regmatch_t * m) Line 119  set_action(char *line, regmatch_t * m)
119                          strncat(curfltr->action.destmbox,                          strncat(curfltr->action.destmbox,
120                              line + m[3].rm_so + 1,                              line + m[3].rm_so + 1,
121                              min(m[3].rm_eo - m[3].rm_so - 2,                              min(m[3].rm_eo - m[3].rm_so - 2,
122                                  MBOX_LEN - 1));                              MBOX_LEN - 1));
123                  else                  else
124                          strncat(curfltr->action.destmbox, line + m[3].rm_so,                          strncat(curfltr->action.destmbox, line + m[3].rm_so,
125                              min(m[3].rm_eo - m[3].rm_so, MBOX_LEN - 1));                              min(m[3].rm_eo - m[3].rm_so, MBOX_LEN - 1));
# Line 127  set_action(char *line, regmatch_t * m) Line 127  set_action(char *line, regmatch_t * m)
127                  curfltr->action.type = ACTION_RCOPY;                  curfltr->action.type = ACTION_RCOPY;
128                  for (a = accounts; a; a = a->next)                  for (a = accounts; a; a = a->next)
129                          if (!strncasecmp(line + m[4].rm_so, a->key,                          if (!strncasecmp(line + m[4].rm_so, a->key,
130                                  strlen(a->key)))                              strlen(a->key)))
131                                  curfltr->action.raccount = a;                                  curfltr->action.raccount = a;
132                  if (!curfltr->action.raccount)                  if (!curfltr->action.raccount)
133                          return ERROR_PARSER;                          return ERROR_PARSER;
# Line 137  set_action(char *line, regmatch_t * m) Line 137  set_action(char *line, regmatch_t * m)
137                          strncat(curfltr->action.destmbox,                          strncat(curfltr->action.destmbox,
138                              line + m[5].rm_so + 1,                              line + m[5].rm_so + 1,
139                              min(m[5].rm_eo - m[5].rm_so - 2,                              min(m[5].rm_eo - m[5].rm_so - 2,
140                                  MBOX_LEN - 1));                              MBOX_LEN - 1));
141                  else                  else
142                          strncat(curfltr->action.destmbox, line + m[5].rm_so,                          strncat(curfltr->action.destmbox, line + m[5].rm_so,
143                              min(m[5].rm_eo - m[5].rm_so, MBOX_LEN - 1));                              min(m[5].rm_eo - m[5].rm_so, MBOX_LEN - 1));
# Line 145  set_action(char *line, regmatch_t * m) Line 145  set_action(char *line, regmatch_t * m)
145                  curfltr->action.type = ACTION_RMOVE;                  curfltr->action.type = ACTION_RMOVE;
146                  for (a = accounts; a; a = a->next)                  for (a = accounts; a; a = a->next)
147                          if (!strncasecmp(line + m[6].rm_so, a->key,                          if (!strncasecmp(line + m[6].rm_so, a->key,
148                                  strlen(a->key)))                              strlen(a->key)))
149                                  curfltr->action.raccount = a;                                  curfltr->action.raccount = a;
150                  if (!curfltr->action.raccount)                  if (!curfltr->action.raccount)
151                          return ERROR_PARSER;                          return ERROR_PARSER;
# Line 155  set_action(char *line, regmatch_t * m) Line 155  set_action(char *line, regmatch_t * m)
155                          strncat(curfltr->action.destmbox,                          strncat(curfltr->action.destmbox,
156                              line + m[7].rm_so + 1,                              line + m[7].rm_so + 1,
157                              min(m[7].rm_eo - m[7].rm_so - 2,                              min(m[7].rm_eo - m[7].rm_so - 2,
158                                  MBOX_LEN - 1));                              MBOX_LEN - 1));
159                  else                  else
160                          strncat(curfltr->action.destmbox, line + m[7].rm_so,                          strncat(curfltr->action.destmbox, line + m[7].rm_so,
161                              min(m[7].rm_eo - m[7].rm_so, MBOX_LEN - 1));                              min(m[7].rm_eo - m[7].rm_so, MBOX_LEN - 1));
# Line 224  init_mask(mask_t * m) Line 224  init_mask(mask_t * m)
224    
225    
226  /*  /*
227   * A new mask entry was declared, create it and set it's   * A new mask entry was declared, create it and set it's variables accordingly.
  * variables accordingly.  
228   */   */
229  int  int
230  set_mask(char *line, regmatch_t * m, int mmt)  set_mask(char *line, regmatch_t * m, int mmt)

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26