src/irc_chan.c
changeset 87 f0db6ebf18b9
parent 83 c8e2dac08207
child 89 68345a9b99a3
--- a/src/irc_chan.c	Mon Mar 30 01:31:13 2009 +0300
+++ b/src/irc_chan.c	Mon Mar 30 01:31:27 2009 +0300
@@ -12,6 +12,21 @@
 }
 
 /**
+ * Invoke the named irc_chan_callbacks field with the given args
+ */
+#define IRC_CHAN_INVOKE_CALLBACK(chan, _cb_name_, ...)          \
+    do {                                                        \
+        struct chain_head *head;                                \
+                                                                \
+        CHAIN_FOREACH(&(chan)->callbacks, head) {               \
+            const struct irc_chan_callbacks *callbacks = head->chain;       \
+                                                                \
+            if (callbacks->_cb_name_)                           \
+                callbacks->_cb_name_((chan), ## __VA_ARGS__, head->arg);    \
+        }                                                       \
+    } while (0);
+
+/**
  * Add or update a nickname to the irc_chan.users list.
  *
  * If the given nickname already exists in our users list, this does nothing. Otherwise, an irc_user is aquired using