From 5af90fb735d357a729d02a661c92af6e865b6d3a Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 15 Nov 2010 23:39:05 +0100 Subject: Implemented most database queries. --- parsing.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'parsing.c') diff --git a/parsing.c b/parsing.c index aeec3e6..f0e4fb5 100644 --- a/parsing.c +++ b/parsing.c @@ -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(); } -- cgit v1.2.3