Check for and use appropriate type of variadic macro arguments.
[srvx.git] / src / mod-snoop.c
index 11a0e55050cc5bb12ae3f5cdf6e6cac97aae30f5..84ecd66c14babfc2484ed5c3a5186e18e448c7d1 100644 (file)
@@ -42,7 +42,6 @@
 #include <arpa/inet.h>
 #endif
 
-extern time_t now;
 static struct {
     struct chanNode *channel;
     struct userNode *bot;
@@ -55,8 +54,12 @@ const char *snoop_module_deps[] = { NULL };
 static int finalized;
 int snoop_finalize(void);
 
-#define SNOOP(FORMAT, ARGS...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp , ## ARGS)
-#define UPDATE_TIMESTAMP() strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&now))
+#if defined(GCC_VARMACROS)
+# define SNOOP(FORMAT, ARGS...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp, ARGS)
+#elif defined(C99_VARMACROS)
+# define SNOOP(FORMAT, ...) send_channel_message(snoop_cfg.channel, snoop_cfg.bot, "%s "FORMAT, timestamp, __VA_ARGS__)
+#endif
+#define UPDATE_TIMESTAMP() do { time_t feh = now; strftime(timestamp, sizeof(timestamp), "[%H:%M:%S]", localtime(&feh)); } while (0)
 
 static void
 snoop_nick_change(struct userNode *user, const char *old_nick) {