changes to !uset autoinvite behavior, introduction of allchanmsg_func hooks
authoradam <akl@gamesurge.net>
Fri, 9 Apr 2004 01:57:12 +0000 (01:57 +0000)
committeradam <akl@gamesurge.net>
Fri, 9 Apr 2004 01:57:12 +0000 (01:57 +0000)
* changes to !uset autoinvite behavior: the autoinvite flag now works whether or not the channel it is set in is +i/+k.

* introduction of allchanmsg_func hooks: there is now a set of hooks (available via reg_allchanmsg_func()) in place to catch all public channel messages the services server sees.

git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-46

ChangeLog
src/chanserv.c
src/chanserv.help
src/proto-common.c
src/proto.h

index c6fae87a50be1ab62a8f8c6798d1e8daf7b0379d..6d1c85da727b423ce0166076babf238daff3f2ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,23 @@
 # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3
 #
 
+2004-04-09 01:57:12 GMT        adam <akl@gamesurge.net>        patch-46
+
+    Summary:
+      changes to !uset autoinvite behavior, introduction of allchanmsg_func hooks 
+    Revision:
+      srvx--devo--1.3--patch-46
+
+    * changes to !uset autoinvite behavior: the autoinvite flag now works whether or not the channel it is set in is +i/+k.
+    
+    * introduction of allchanmsg_func hooks: there is now a set of hooks (available via reg_allchanmsg_func()) in place to catch all public channel messages the services server sees.
+    
+
+    modified files:
+     ChangeLog src/chanserv.c src/chanserv.help src/proto-common.c
+     src/proto.h
+
+
 2004-04-08 03:42:49 GMT        Michael Poole <mdpoole@troilus.org>     patch-45
 
     Summary:
index 5b5f247db6225ff8d44cfa788f83006c42355a80..db3ac7fc00dbcce9486b4625adf488a92743a385 100644 (file)
@@ -5876,7 +5876,6 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
             if(!IsUserSuspended(channel)
                && IsUserAutoInvite(channel)
                && (channel->access >= channel->channel->lvlOpts[lvlInviteMe])
-               && (cn->modes & (MODE_KEY | MODE_INVITEONLY))
                && !self->burst)
                 irc_invite(chanserv, user, cn);
             continue;
index 27031540c01307ffa39746f7d97fae0f831fbb1a..df5bc01d465b8a68d5c69e9d9fc10db3fb546e94 100644 (file)
          "$bOptions:$b",
          "INFO:       Sets the infoline that $C sends when you join the channel.",
          "NOAUTOOP:   Enable or disable $C automatically opping you upon joining or authenticating.",
-         "AUTOINVITE: $C will invite you to +i/+k channels which you have access to and are not in when you authenticate if this setting is on.",
+        "AUTOINVITE: $C will invite you to this channel if you have access to and are not in when you authenticate if this setting is on.",
          "NOTE: The NoAutoOp setting is equivalent to the !togop command in previous versions of srvx.",
          "$uSee Also:$u set");
 "USET INFO" ("/msg $C USET <#channel> INFO <info>",
index 6a042edbaa22a79ca2b7bf6fd014e4237d8fca5e..2be192905595d907d67d4452bc5c523cb4dd5a69 100644 (file)
@@ -442,6 +442,11 @@ static struct chanmsg_func {
     struct userNode *service;
 } chanmsg_funcs[256]; /* indexed by trigger character */
 
+static struct allchanmsg_func {
+    chanmsg_func_t func;
+    struct userNode *service;
+} allchanmsg_funcs[ALLCHANMSG_FUNCS_MAX];
+
 struct privmsg_desc {
     struct userNode *user;
     char *text;
@@ -455,6 +460,7 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
     struct privmsg_desc *pd = data;
     struct modeNode *mn;
     struct chanmsg_func *cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
+    int x;
 
     /* Don't complain if it can't find the modeNode because the channel might
      * be -n */
@@ -464,6 +470,15 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
     /* Never send a NOTICE to a channel to one of the services */
     if (!pd->is_notice && cf->func && GetUserMode(cn, cf->service))
         cf->func(pd->user, cn, pd->text+1, cf->service);
+
+    /* This catches *all* text sent to the channel that the services server sees */
+    for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) {
+       cf = (struct chanmsg_func *)&allchanmsg_funcs[x];
+       if (!cf->func)
+         break; /* end of list */
+       else
+       cf->func(pd->user, cn, pd->text, cf->service);
+    }
 }
 
 static void
@@ -491,6 +506,19 @@ reg_chanmsg_func(unsigned char prefix, struct userNode *service, chanmsg_func_t
     chanmsg_funcs[prefix].service = service;
 }
 
+void
+reg_allchanmsg_func(struct userNode *service, chanmsg_func_t handler)
+{
+    int x;
+    for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) {
+       if (allchanmsg_funcs[x].func)
+         continue;
+       allchanmsg_funcs[x].func = handler;
+       allchanmsg_funcs[x].service = service;
+       break;
+    }
+}
+
 struct userNode *
 get_chanmsg_bot(unsigned char prefix)
 {
index 3ed37d56608e62eb796ca055462aaac1eeae472f..3b1fb1339678044c5e6172c36062d05378f79126 100644 (file)
@@ -30,6 +30,7 @@
 #define COMBO_NUMERIC_LEN 5   /* 1/2, 1/3 or 2/3 digits for server/client parts */
 #define MAXLEN         512   /* Maximum IRC line length */
 #define MAXNUMPARAMS    200
+#define ALLCHANMSG_FUNCS_MAX  4 /* +1 == 5 potential 'allchanmsg' funcs */
 
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -95,6 +96,7 @@ int parse_line(char *line, int recursive);
 /* Callback notifications for protocol support. */
 typedef void (*chanmsg_func_t) (struct userNode *user, struct chanNode *chan, char *text, struct userNode *bot);
 void reg_chanmsg_func(unsigned char prefix, struct userNode *service, chanmsg_func_t handler);
+void reg_allchanmsg_func(struct userNode *service, chanmsg_func_t handler);
 struct userNode *get_chanmsg_bot(unsigned char prefix);
 
 typedef void (*privmsg_func_t) (struct userNode *user, struct userNode *target, char *text, int server_qualified);