regexec(&global_leading_from_line_regexp, mbox_line, 0, 0, 0) == 0;
}
-int mbox_line_match_search(struct search_condition *condition,
- int mbox_id, const char *mbox_value) {
+int db_line_match_search(struct search_condition *condition,
+ int mbox_id, const char *mbox_value) {
return
(
}
void extract_mail(const char *mail_filename, unsigned long int position_in_mail,
- FILE *output_file) {
+ FILE *output_file) {
char raw_mbox_line[BUFFER_SIZE];
FILE *mail_file;
/* We use the mail leading line time by default, and if we should and
can, we update with the Date: field */
-void update_time(int mbox_id, const char *mbox_value, time_t *t) {
+void update_time(int db_id, const char *db_value, time_t *t) {
const char *c;
struct tm tm;
- if(mbox_id == ID_LEADING_LINE) {
- c = mbox_value;
+ if(db_id == ID_LEADING_LINE) {
+ c = db_value;
while(*c && *c != ' ') c++; while(*c && *c == ' ') c++;
strptime(c, "%a %b %e %k:%M:%S %Y", &tm);
*t = mktime(&tm);
} else {
if(!global_use_leading_time) {
- if(mbox_id == ID_DATE) {
- if(strptime(mbox_value, "%a, %d %b %Y %k:%M:%S", &tm) ||
- strptime(mbox_value, "%d %b %Y %k:%M:%S", &tm)) {
+ if(db_id == ID_DATE) {
+ if(strptime(db_value, "%a, %d %b %Y %k:%M:%S", &tm) ||
+ strptime(db_value, "%d %b %Y %k:%M:%S", &tm)) {
*t = mktime(&tm);
}
}
FILE *db_file;
char raw_db_line[BUFFER_SIZE];
char current_mail_filename[PATH_MAX + 1];
- char mbox_key[TOKEN_BUFFER_SIZE];
+ char db_key[TOKEN_BUFFER_SIZE];
char position_in_file_string[TOKEN_BUFFER_SIZE];
unsigned long int current_position_in_mail;
- const char *mbox_value;
- int mbox_id;
+ const char *db_value;
+ int db_id;
int hits[MAX_NB_SEARCH_CONDITIONS];
int nb_body_conditions, need_time;
int nb_extracted_mails;
strcpy(current_mail_filename, "");
while(fgets(raw_db_line, BUFFER_SIZE, db_file)) {
- mbox_value = parse_token(mbox_key, TOKEN_BUFFER_SIZE, ' ', raw_db_line);
+ db_value = parse_token(db_key, TOKEN_BUFFER_SIZE, ' ', raw_db_line);
- if(strcmp("mail", mbox_key) == 0) {
+ if(strcmp("mail", db_key) == 0) {
if(current_mail_filename[0]) {
if(check_full_mail_match(current_mail_filename,
mail_time,
}
for(n = 0; n < nb_search_conditions; n++) { hits[n] = 0; }
- mbox_value = parse_token(position_in_file_string, TOKEN_BUFFER_SIZE, ' ', mbox_value);
- mbox_value = parse_token(current_mail_filename, PATH_MAX+1, '\n', mbox_value);
+ db_value = parse_token(position_in_file_string, TOKEN_BUFFER_SIZE, ' ', db_value);
+ db_value = parse_token(current_mail_filename, PATH_MAX+1, '\n', db_value);
current_position_in_mail = atol(position_in_file_string);
}
else {
- mbox_id = -1;
- for(m = 0; (m < MAX_ID) && mbox_id == -1; m++) {
- if(strncmp(field_keys[m], mbox_key, strlen(mbox_key)) == 0) {
- mbox_id = m;
+ db_id = -1;
+ for(m = 0; (m < MAX_ID) && db_id == -1; m++) {
+ if(strncmp(field_keys[m], db_key, strlen(db_key)) == 0) {
+ db_id = m;
}
}
for(n = 0; n < nb_search_conditions; n++) {
- hits[n] |= mbox_line_match_search(&search_conditions[n],
- mbox_id, mbox_value);
+ hits[n] |= db_line_match_search(&search_conditions[n],
+ db_id, db_value);
}
if(need_time) {
- update_time(mbox_id, mbox_value, &mail_time);
+ update_time(db_id, db_value, &mail_time);
}
}
}
condition->field_id = -1;
- /* Recently */
+ /* Time condition */
for(k = 0; k < sizeof(time_criteria) / sizeof(struct time_criterion); k++) {
if(strcmp(time_criteria[k].label, search_field) == 0) {