changeset 1425:b0cfd9ab4b9f

Add a mainloop hook
author Mikael Berthe <mikael@lilotux.net>
date Sun, 17 Feb 2008 21:19:58 +0100
parents bb1cc8902d0e
children a64778f5f26b
files mcabber/src/hooks.c mcabber/src/hooks.h mcabber/src/main.c
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/hooks.c	Sun Feb 17 21:19:48 2008 +0100
+++ b/mcabber/src/hooks.c	Sun Feb 17 21:19:58 2008 +0100
@@ -37,6 +37,21 @@
 
 static const char *COMMAND_ME = "/me ";
 
+void hk_mainloop(void)
+{
+  /*
+  static time_t last;
+  time_t now;
+
+  time(&now);
+
+  if (now > last + 1) {
+    // custom_hook();
+    last = now;
+  }
+  */
+}
+
 void hk_message_in(const char *bjid, const char *resname,
                           time_t timestamp, const char *msg, const char *type,
                           guint encrypted)
--- a/mcabber/src/hooks.h	Sun Feb 17 21:19:48 2008 +0100
+++ b/mcabber/src/hooks.h	Sun Feb 17 21:19:58 2008 +0100
@@ -5,6 +5,7 @@
 #include "jabglue.h"
 
 
+void hk_mainloop(void);
 void hk_message_in(const char *bjid, const char *resname,
                           time_t timestamp, const char *msg, const char *type,
                           guint encrypted);
--- a/mcabber/src/main.c	Sun Feb 17 21:19:48 2008 +0100
+++ b/mcabber/src/main.c	Sun Feb 17 21:19:58 2008 +0100
@@ -510,6 +510,7 @@
         scr_DrawRoster();
 
       jb_main();
+      hk_mainloop();
     }
   }