summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-10-20 22:39:00 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2009-10-20 22:39:00 +0200
commit4b3d1128bf96b96322e4b99da4633f44fa49e585 (patch)
treefa379e005e9db47cad073f57e8e6b1c4fb609b6c /main.c
parent27d37093ab87c2a1b8e846b4f4df83bf19ceba4c (diff)
Parse kicks and store number of kicks and times kicked per user.
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.c b/main.c
index ee00240..e30e878 100644
--- a/main.c
+++ b/main.c
@@ -119,6 +119,18 @@ int main(int argc, char **argv) {
struct user_t *user = user_get(nick);
continue;
}
+
+ rc = pcre_exec(rs->kick, rs->kick_e, line, strlen(line), 0, 0, ovector, 30);
+ if(rc > 0) {
+ char nick[NICK_BUFFER_SIZE], victim[NICK_BUFFER_SIZE];
+ pcre_copy_named_substring(rs->kick, line, ovector, rc, "nick", nick, NICK_BUFFER_SIZE);
+ pcre_copy_named_substring(rs->kick, line, ovector, rc, "victim", victim, NICK_BUFFER_SIZE);
+ struct user_t *user = user_get(nick),
+ *victim_user = user_get(victim);
+ user->kicks++;
+ victim_user->kicked++;
+ continue;
+ }
}
fclose(f);