Changeset b699e9b for filter.c


Ignore:
Timestamp:
Dec 24, 2006, 11:37:13 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
8f2ce3a
Parents:
ea67541
git-author:
Nelson Elhage <nelhage@mit.edu> (12/24/06 20:10:44)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/24/06 23:37:13)
Message:
You can now write filters based off arbitrary message attributes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • filter.c

    r15b34fd rb699e9b  
    6666      error=1;
    6767    } else {
    68       if (!strcasecmp(argv[i], "class") ||
    69           !strcasecmp(argv[i], "instance") ||
    70           !strcasecmp(argv[i], "sender") ||
    71           !strcasecmp(argv[i], "recipient") ||
    72           !strcasecmp(argv[i], "body") ||
    73           !strcasecmp(argv[i], "opcode") ||
    74           !strcasecmp(argv[i], "realm") ||
    75           !strcasecmp(argv[i], "type") ||
    76           !strcasecmp(argv[i], "direction") ||
    77           !strcasecmp(argv[i], "hostname") ||
    78           !strcasecmp(argv[i], "login")) {
    79         regexstr=owl_text_substitute(argv[i+1], "%me%", owl_zephyr_get_sender());
    80         owl_filterelement_create_re(fe, argv[i], regexstr);
    81         owl_free(regexstr);
    82         i++;
    83       } else if (!strcasecmp(argv[i], "filter")) {
     68      if (!strcasecmp(argv[i], "filter")) {
    8469        owl_filterelement_create_filter(fe, argv[i+1]);
    8570        i++;
     
    8873        i++;
    8974      } else {
    90         error=1;
    91       }
     75        regexstr=owl_text_substitute(argv[i+1], "%me%", owl_zephyr_get_sender());
     76        owl_filterelement_create_re(fe, argv[i], regexstr);
     77        owl_free(regexstr);
     78        i++;
     79      }
    9280    }
    9381
     
    220208        match="none";
    221209      }
     210    } else {
     211      match = owl_message_get_attribute_value(m,field);
     212      if(match == NULL) match = "";
    222213    }
    223214
Note: See TracChangeset for help on using the changeset viewer.