projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ae211b
)
Cosmetics, renamed some db-related variables properly.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 23 Mar 2013 16:37:02 +0000
(17:37 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 23 Mar 2013 16:37:02 +0000
(17:37 +0100)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
c07e8a8
..
9c085de
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-249,8
+249,8
@@
int is_a_leading_from_line(char *mbox_line) {
regexec(&global_leading_from_line_regexp, mbox_line, 0, 0, 0) == 0;
}
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
(
return
(
@@
-317,7
+317,7
@@
void update_body_hits(char *mail_filename, int position_in_mail,
}
void extract_mail(const char *mail_filename, unsigned long int position_in_mail,
}
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;
char raw_mbox_line[BUFFER_SIZE];
FILE *mail_file;
@@
-389,20
+389,20
@@
int check_full_mail_match(char *current_mail_filename,
/* We use the mail leading line time by default, and if we should and
can, we update with the Date: field */
/* 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;
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) {
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);
}
}
*t = mktime(&tm);
}
}
@@
-418,11
+418,11
@@
int search_in_db(const char *db_filename,
FILE *db_file;
char raw_db_line[BUFFER_SIZE];
char current_mail_filename[PATH_MAX + 1];
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;
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;
int hits[MAX_NB_SEARCH_CONDITIONS];
int nb_body_conditions, need_time;
int nb_extracted_mails;
@@
-477,9
+477,9
@@
int search_in_db(const char *db_filename,
strcpy(current_mail_filename, "");
while(fgets(raw_db_line, BUFFER_SIZE, db_file)) {
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,
if(current_mail_filename[0]) {
if(check_full_mail_match(current_mail_filename,
mail_time,
@@
-491,26
+491,26
@@
int search_in_db(const char *db_filename,
}
for(n = 0; n < nb_search_conditions; n++) { hits[n] = 0; }
}
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 {
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++) {
}
}
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) {
}
if(need_time) {
- update_time(
mbox_id, mbox
_value, &mail_time);
+ update_time(
db_id, db
_value, &mail_time);
}
}
}
}
}
}
@@
-811,7
+811,7
@@
void init_condition(struct search_condition *condition, const char *full_string,
condition->field_id = -1;
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) {
for(k = 0; k < sizeof(time_criteria) / sizeof(struct time_criterion); k++) {
if(strcmp(time_criteria[k].label, search_field) == 0) {