Fix warnings about shadowed variables, and use -Wshadow in maintainer mode.
[srvx.git] / src / proto-common.c
index 618643c831414d54d30223a25acf78123c943a6a..3a14c68bdc0670b0371028711c61d30fa8d20273 100644 (file)
@@ -105,7 +105,7 @@ void replay_event_loop(void)
     while (!quit_services) {
         if (!replay_connected) {
             /* this time fudging is to get some of the logging right */
-            self->link = self->boot = now;
+            self->link_time = self->boot = now;
             cManager.uplink->state = AUTHENTICATING;
             irc_introduce(cManager.uplink->password);
             replay_connected = 1;
@@ -442,8 +442,9 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
 
     /* Never send a NOTICE to a channel to one of the services */
     cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
-    if (!pd->is_notice && cf->func && GetUserMode(cn, cf->service) && !IsDeaf(cf->service))
-        cf->func(pd->user, cn, pd->text+1, cf->service);
+    if (cf->func && !pd->is_notice
+        && GetUserMode(cn, cf->service) && !IsDeaf(cf->service))
+        cf->func(pd->user, cn, pd->text+1, cf->service, pd->is_notice);
 
     /* This catches *all* text sent to the channel that the services server sees */
     for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) {
@@ -451,7 +452,7 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
        if (!cf->func)
            break; /* end of list */
        else
-           cf->func(pd->user, cn, pd->text, cf->service);
+           cf->func(pd->user, cn, pd->text, cf->service, pd->is_notice);
     }
 }
 
@@ -537,6 +538,36 @@ reg_mode_change_func(mode_change_func_t handler)
     mcf_list[mcf_used++] = handler;
 }
 
+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);
+    }
+}
+
 struct mod_chanmode *
 mod_chanmode_alloc(unsigned int argc)
 {