]> jfr.im git - irc/evilnet/x3.git/commitdiff
Added RCHANNELS which will send notices to all registered channels. Also changed...
authorsirvulcan <redacted>
Sat, 27 Dec 2008 03:08:17 +0000 (03:08 +0000)
committersirvulcan <redacted>
Sat, 27 Dec 2008 03:08:17 +0000 (03:08 +0000)
ChangeLog
src/global.c
src/global.h
src/global.help

index d2818230b003842c9050311f3b88c0cd075d2aa0..522259ad4a42da043e9233a235ab9d12371d7b8e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 /***********************************************************************
 X3 ChangeLog
 
+2008-12-27  Neil Spierling  <sirvulcan@sirvulcan.co.nz>
+
+       * src/global.c: Added RCHANNELS which will send notices to all
+       registered channels. Also changed CHANNELS to notice all channels
+       instead of registered ones only.
+
+       * src/global.h: Added RCHANNELS.
+
+       * src/global.help: Added RCHANNELS target.
+
 2008-12-27  Neil Spierling  <sirvulcan@sirvulcan.co.nz>
 
        * src/global.c: Added AUTHED target.
index fa519aaea90f443080eeb236b9c49c32872e0a1d..2a50d50e9aa198408ac6a3e7410c2ad25c9fa10a 100644 (file)
@@ -257,6 +257,8 @@ message_create(struct userNode *user, unsigned int argc, char *argv[])
                flags |= MESSAGE_RECIPIENT_STAFF;
            } else if(!irccasecmp(argv[i], "channels")) {
                flags |= MESSAGE_RECIPIENT_CHANNELS;
+           } else if(!irccasecmp(argv[i], "rchannels")) {
+               flags |= MESSAGE_RECIPIENT_RCHANNELS;
             } else if(!irccasecmp(argv[i], "announcement") || !irccasecmp(argv[i], "announce")) {
                 flags |= MESSAGE_RECIPIENT_ANNOUNCE;
            } else {
@@ -317,6 +319,10 @@ messageType(const struct globalMessage *message)
     {
         return "authed";
     }
+    else if(message->flags & MESSAGE_RECIPIENT_RCHANNELS)
+    {
+        return "rchannels";
+    }
     else
     {
        return "channels";
@@ -360,7 +366,25 @@ message_send(struct globalMessage *message)
 
     if(message->flags & MESSAGE_RECIPIENT_CHANNELS)
     {
-       dict_foreach(channels, notice_channel, message);
+        dict_iterator_t it;
+
+        for (it = dict_first(channels); it; it = iter_next(it)) {
+            struct chanNode *chan = iter_data(it);
+
+            notice_target(chan->name, message);
+        }
+    }
+
+    if(message->flags & MESSAGE_RECIPIENT_RCHANNELS)
+    {
+        dict_iterator_t it;
+
+        for (it = dict_first(channels); it; it = iter_next(it)) {
+            struct chanNode *chan = iter_data(it);
+
+            if (chan->channel_info)
+                notice_target(chan->name, message);
+        }
     }
 
     if(message->flags & MESSAGE_RECIPIENT_LUSERS)
@@ -526,6 +550,8 @@ static GLOBAL_FUNC(cmd_notice)
         target |= MESSAGE_RECIPIENT_ANNOUNCE;
     } else if(!irccasecmp(argv[1], "channels")) {
        target = MESSAGE_RECIPIENT_CHANNELS;
+    } else if(!irccasecmp(argv[1], "rchannels")) {
+       target = MESSAGE_RECIPIENT_RCHANNELS;
     } else {
        global_notice(user, "GMSG_INVALID_TARGET", argv[1]);
        return 0;
@@ -679,7 +705,7 @@ send_messages(struct userNode *user, long mask, int obstreperize)
 
 static GLOBAL_FUNC(cmd_messages)
 {
-    long mask = MESSAGE_RECIPIENT_AUTHED | MESSAGE_RECIPIENT_LUSERS | MESSAGE_RECIPIENT_CHANNELS;
+    long mask = MESSAGE_RECIPIENT_AUTHED | MESSAGE_RECIPIENT_LUSERS | MESSAGE_RECIPIENT_CHANNELS | MESSAGE_RECIPIENT_RCHANNELS;
     unsigned int count;
 
     if(IsOper(user))
index c01688c815b080965e8b67f0d9d80f130affb50d..95fc4f93c7c6310bd9a88a2556d8889f75a15fcb 100644 (file)
@@ -27,6 +27,7 @@
 #define MESSAGE_RECIPIENT_CHANNELS                     0x008
 #define MESSAGE_RECIPIENT_ANNOUNCE                     0x040
 #define MESSAGE_RECIPIENT_AUTHED                0x080
+#define MESSAGE_RECIPIENT_RCHANNELS                    0x100
 
 #define MESSAGE_OPTION_SOURCELESS              0x010
 #define MESSAGE_OPTION_IMMEDIATE               0x020
index 496f789f8ef1cb14107b7bab289f7b99338cc3e7..82a70a52e3fa67e1d6c3db4d7caf94b66e39d994 100644 (file)
@@ -34,4 +34,5 @@
         "$bOPERS$b:      The message will be sent to opers only.",
         "$bSTAFF$b:      The message will be sent to helpers and opers.",
         "$bCHANNELS$b:   The message will be sent to all channels.",
+        "$bRCHANNELS$b:  The message will be sent to all registered channels.",
         "$bALL$b:        A combination of USERS and CHANNELS.");