+static oper_func_t *of_list;
+static unsigned int of_size = 0, of_used = 0;
+
+void
+reg_oper_func(oper_func_t handler)
+{
+ if (of_used == of_size) {
+ if (of_size) {
+ of_size <<= 1;
+ of_list = realloc(of_list, of_size*sizeof(oper_func_t));
+ } else {
+ of_size = 8;
+ of_list = malloc(of_size*sizeof(oper_func_t));
+ }
+ }
+ of_list[of_used++] = handler;
+}
+
+static void
+call_oper_funcs(struct userNode *user)
+{
+ unsigned int n;
+ if (IsLocal(user))
+ return;
+ for (n=0; (n<of_used) && !user->dead; n++)
+ {
+ of_list[n](user);
+ }
+}
+
+static xquery_func_t *xqf_list;
+static unsigned int xqf_size = 0, xqf_used = 0;
+
+void
+reg_xquery_func(xquery_func_t handler)
+{
+ if (xqf_used == xqf_size) {
+ if (xqf_size) {
+ xqf_size <<= 1;
+ xqf_list = realloc(xqf_list, xqf_size*sizeof(xquery_func_t));
+ } else {
+ xqf_size = 8;
+ xqf_list = malloc(xqf_size*sizeof(xquery_func_t));
+ }
+ }
+ xqf_list[xqf_used++] = handler;
+}
+
+static void
+call_xquery_funcs(struct server *source, const char routing[], const char query[])
+{
+ unsigned int n;
+ for (n=0; n < xqf_used; n++)
+ {
+ xqf_list[n](source, routing, query);
+ }
+}
+