]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/proto-common.c
Fixed a typo in ROUTING EXAMPLE
[irc/evilnet/x3.git] / src / proto-common.c
index 785485b4958279139d85607c118c0e8e748d77fb..402ea68486011ba5176c9e5794c8b6f666583709 100644 (file)
@@ -108,7 +108,7 @@ void replay_event_loop(void)
     while (!quit_services) {
         if (!replay_connected) {
             /* this time fudging is to get some of the logging right */
     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;
             cManager.uplink->state = AUTHENTICATING;
             irc_introduce(cManager.uplink->password);
             replay_connected = 1;
@@ -333,7 +333,7 @@ static CMD_FUNC(cmd_dummy)
 
 static CMD_FUNC(cmd_error)
 {
 
 static CMD_FUNC(cmd_error)
 {
-    if (argv[1]) log_module(MAIN_LOG, LOG_ERROR, "Error from ircd: %s", argv[1]);
+    if (argv[1]) log_module(MAIN_LOG, LOG_ERROR, "Error: %s", argv[1]);
     log_module(MAIN_LOG, LOG_ERROR, "Error received from uplink, squitting.");
 
     if (cManager.uplink->state != CONNECTED) {
     log_module(MAIN_LOG, LOG_ERROR, "Error received from uplink, squitting.");
 
     if (cManager.uplink->state != CONNECTED) {
@@ -434,7 +434,7 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
 {
     struct privmsg_desc *pd = data;
     struct modeNode *mn;
 {
     struct privmsg_desc *pd = data;
     struct modeNode *mn;
-    struct chanmsg_func *cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
+    struct chanmsg_func *cf;
     int x;
 
     /* Don't complain if it can't find the modeNode because the channel might
     int x;
 
     /* Don't complain if it can't find the modeNode because the channel might
@@ -443,8 +443,9 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
         mn->idle_since = now;
 
     /* Never send a NOTICE to a channel to one of the services */
         mn->idle_since = now;
 
     /* Never send a NOTICE to a channel to one of the services */
-    if (!pd->is_notice && cf->func && ((cn->modes & MODE_REGISTERED) || GetUserMode(cn, cf->service)))
-        cf->func(pd->user, cn, pd->text+1, cf->service); /* XXX- taken out in 1.4rc1 patchset but causes errors */
+    cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
+    if (!pd->is_notice && cf->func)
+        cf->func(pd->user, cn, pd->text+1, cf->service, pd->is_notice);
     else
         spamserv_channel_message(cn, pd->user, pd->text);
 
     else
         spamserv_channel_message(cn, pd->user, pd->text);
 
@@ -454,7 +455,7 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
        if (!cf->func)
          break; /* end of list */
        else
        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);
     }
 }
 
     }
 }
 
@@ -540,6 +541,37 @@ reg_mode_change_func(mode_change_func_t handler)
     mcf_list[mcf_used++] = 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)
 {
 struct mod_chanmode *
 mod_chanmode_alloc(unsigned int argc)
 {