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

Diff of /imapfilter/request.c

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

revision 1.12 by lefcha, Tue Nov 6 17:41:27 2001 UTC revision 1.13 by lefcha, Thu Nov 8 17:53:53 2001 UTC
# Line 107  int apply_filters(filter_t ** filters) Line 107  int apply_filters(filter_t ** filters)
107    
108          log_info(LOG_FILTER, filters[i]->key);          log_info(LOG_FILTER, filters[i]->key);
109    
110            printf("AAAAAAAAA %c\n", *mesgs);
111    
112          apply_action(mesgs, &(filters[i]->action.type),          apply_action(mesgs, &(filters[i]->action.type),
113                     filters[i]->action.destmbox, filters[i]->action.args);                     filters[i]->action.destmbox, filters[i]->action.args);
# Line 478  int action_list(char *mesgs, char *args) Line 479  int action_list(char *mesgs, char *args)
479   */   */
480  unsigned int convert_messages(char *mesgs)  unsigned int convert_messages(char *mesgs)
481  {  {
482      unsigned int cnt, len;      unsigned int cnt, maxlen;
483      unsigned int start, end, tmp;      unsigned int start, end, tmp;
484      char *cp, *tail = NULL;      char *cp, *tail, *m;
485    
486      cnt = len = start = end = tmp = 0;      cnt = start = end = tmp = 0;
487        maxlen = strlen(mesgs) + 1;
488        tail = NULL;
489    
490      cp = xstrdup(mesgs);      cp = xstrdup(mesgs);
491        m = mesgs;
492    
493      start = (unsigned int) strtoul(cp, &tail, 10);      start = (unsigned int) strtoul(cp, &tail, 10);
494      cnt++;      cnt++;
# Line 499  unsigned int convert_messages(char *mesg Line 503  unsigned int convert_messages(char *mesg
503          if (tmp == end + 1)          if (tmp == end + 1)
504              end++;              end++;
505          else {          else {
506              if (start == end)              if (start == end) {
507                  snprintf(mesgs + len, strlen(mesgs) - len - 1, "%d ",                  xstrncpy(m, ultostr(start, 10), maxlen);
508                           start);                  m += strlen(m);
509              else              } else {
510                  snprintf(mesgs + len, strlen(mesgs) - len - 1,                  xstrncpy(m, ultostr(start, 10), maxlen - 1);
511                           "%d:%d ", start, end);                  m += strlen(m);
512                    *m = ':';
513                    *++m = 0;
514                    xstrncpy(m, ultostr(end, 10), maxlen);
515                    m += strlen(m);
516                }
517    
518              len = strlen(mesgs);              if (tail && m - mesgs < maxlen) {
519                    *m = ' ';
520                    *++m = 0;
521                }
522              start = end = tmp;              start = end = tmp;
523          }          }
524      } while (tmp);      } while (tmp);
525    
     mesgs[len - 1] = 0;  
   
526      free(cp);      free(cp);
527    
528      return cnt;      return cnt;

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26