]> jfr.im git - solanum.git/blobdiff - include/channel.h
Refactor common channel iteration
[solanum.git] / include / channel.h
index a9c0752995bbd800eb80a170f7b4007865c4d3eb..fe8c566cc2a45714eb8780aa1399cb79c9708a3f 100644 (file)
@@ -200,6 +200,15 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
 #define EXTBAN_NOMATCH  0  /* valid mask, no match */
 #define EXTBAN_MATCH    1  /* matches */
 
+int iter_comm_channels_step(rb_dlink_node *pos1, rb_dlink_node *pos2,
+               struct membership **ms1, struct membership **ms2,
+               struct Channel **chptr);
+
+#define ITER_COMM_CHANNELS(pos1, pos2, head1, head2, ms1, ms2, chptr) for ((pos1) = (head1), (pos2) = (head2); \
+               iter_comm_channels_step((pos1), (pos2), &(ms1), &(ms2), &(chptr)); \
+               (ms1) && ((pos1) = (pos1)->next), (ms2) && ((pos2) = (pos2)->next))
+
+
 extern rb_dlink_list global_channel_list;
 void init_channels(void);