summaryrefslogtreecommitdiff
path: root/parsing.c
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-11-15 23:39:05 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-11-15 23:39:05 +0100
commit5af90fb735d357a729d02a661c92af6e865b6d3a (patch)
treea9af27348dacab4c5e21be4434e077f9550ebe3f /parsing.c
parent4ec55cb9cfcdc8e64fa8f121e49422f8afbf960d (diff)
Implemented most database queries.
Diffstat (limited to 'parsing.c')
-rw-r--r--parsing.c22
1 files changed, 22 insertions, 0 deletions
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();
}