diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-11-15 23:39:05 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-11-15 23:39:05 +0100 |
commit | 5af90fb735d357a729d02a661c92af6e865b6d3a (patch) | |
tree | a9af27348dacab4c5e21be4434e077f9550ebe3f /parsing.c | |
parent | 4ec55cb9cfcdc8e64fa8f121e49422f8afbf960d (diff) |
Implemented most database queries.
Diffstat (limited to 'parsing.c')
-rw-r--r-- | parsing.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -321,12 +321,27 @@ static void process_file(FILE *f, struct channel_t *channel, struct regexset_t * } } +static void save_users(struct channel_t *channel) { + for(int i = 0; i < USERS_MAX; i++) { + struct user_t *user = &users[i]; + if(!user->nick) + continue; + + while(user) { + if(!user->real_user) + pg_user_set(channel, user); + user = user->next; + } + } +} + void process() { /* Parsing stuff goes here. */ for(int chan_i = 0; chan_i < channel_get_count(); chan_i++) { user_init(); word_init(); struct channel_t *channel = channel_get(chan_i); + int channel_id = pg_channel_get(channel); printf("Channel %s\n", channel->name); struct channel_file_t *file = channel->files; while(file) { @@ -339,15 +354,22 @@ void process() { } else printf("\tParsing %s\n", file->path); + long pos = pg_channel_file_get(channel_id, file); + fseek(f, pos, SEEK_SET); + last_user = NULL; in_monolog = monolog_len = 0; process_file(f, channel, rs); + pg_channel_file_set(channel_id, file, ftell(f)); + fclose(f); file = file->next; } + save_users(channel_id); + user_free(); word_free(); } |