Get rid of srvx-broadcast announcements. (They do not scale.)
authorMichael Poole <mdpoole@troilus.org>
Sun, 18 Mar 2007 14:42:49 +0000 (10:42 -0400)
committerMichael Poole <mdpoole@troilus.org>
Sun, 18 Mar 2007 14:42:49 +0000 (10:42 -0400)
src/global.h (MESSAGE_RECIPIENT_ANNOUNCE): Remove.

src/global.c (KEY_ANNOUNCEMENTS_DEFAULT): Remove.
  (global_conf): Remove announcements_default field.
  (message_create): Do not recognize "announce[ment]" target.
  (messageType): Remove MESSAGE_RECIPIENT_ANNOUNCE condition.
  (message_send): Remove MESSAGE_RECIPIENT_ANNOUNCE condition.
  (cmd_notice): Do not recognize "announce[ment]" target.
  (global_conf_read): Do not look up announcements_default key.

src/global.help (TARGET): Remove ANNOUNCEMENT target.

src/nickserv.h (struct handle_info): Remove announcements field.

src/nickserv.c (KEY_ANNOUNCEMENTS): Remove.
  ("NSMSG_INVALID_ANNOUNCE"): Remove.
  ("NSMSG_SET_ANNOUNCEMENTS"): Remove.
  (register_handle): Do not assign to hi->announcements.
  (set_list): Remove ANNOUNCEMENTS from the default list.
  (opt_announcements): Remove.
  (nickserv_saxdb_write): Remove announcements code.
  (nickserv_db_read_handle): Remove announcements code.
  (init_nickserv): Do not register opt_announcements function.

nickserv.help (SET): Remove ANNOUNCEMENTS option.

src/global.c
src/global.h
src/global.help
src/nickserv.c
src/nickserv.h
src/nickserv.help

index d1aea5d46c27e6180c1b61a2d95c9dba4b9f60e9..c7494142797547d71bd82af1e954c4a36f94ec4f 100644 (file)
@@ -32,7 +32,6 @@
 
 /* Global options */
 #define KEY_DB_BACKUP_FREQ     "db_backup_freq"
-#define KEY_ANNOUNCEMENTS_DEFAULT "announcements_default"
 #define KEY_NICK               "nick"
 
 /* Message data */
@@ -93,7 +92,6 @@ static struct log_type *G_LOG;
 static struct
 {
     unsigned long db_backup_frequency;
-    unsigned int announcements_default : 1;
 } global_conf;
 
 #define global_notice(target, format...) send_message(target , global , ## format)
@@ -210,8 +208,6 @@ 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], "announcement") || !irccasecmp(argv[i], "announce")) {
-                flags |= MESSAGE_RECIPIENT_ANNOUNCE;
            } else {
                global_notice(user, "GMSG_INVALID_TARGET", argv[i]);
                return NULL;
@@ -250,10 +246,6 @@ messageType(const struct globalMessage *message)
     {
        return "staff";
     }
-    else if(message->flags & MESSAGE_RECIPIENT_ANNOUNCE)
-    {
-        return "announcement";
-    }
     else if(message->flags & MESSAGE_RECIPIENT_OPERS)
     {
        return "opers";
@@ -305,7 +297,6 @@ message_send(struct globalMessage *message)
 {
     struct userNode *user;
     unsigned long n;
-    dict_iterator_t it;
 
     if(message->flags & MESSAGE_RECIPIENT_CHANNELS)
     {
@@ -318,20 +309,6 @@ message_send(struct globalMessage *message)
        return;
     }
 
-    if(message->flags & MESSAGE_RECIPIENT_ANNOUNCE)
-    {
-        char announce;
-
-        for (it = dict_first(clients); it; it = iter_next(it)) {
-            user = iter_data(it);
-            if (user->uplink == self) continue;
-            announce = user->handle_info ? user->handle_info->announcements : '?';
-            if (announce == 'n') continue;
-            if ((announce == '?') && !global_conf.announcements_default) continue;
-            notice_target(user->nick, message);
-        }
-    }
-
     if(message->flags & MESSAGE_RECIPIENT_OPERS)
     {
        for(n = 0; n < curr_opers.used; n++)
@@ -392,8 +369,6 @@ static GLOBAL_FUNC(cmd_notice)
        target = MESSAGE_RECIPIENT_OPERS;
     } else if(!irccasecmp(argv[1], "staff") || !irccasecmp(argv[1], "privileged")) {
        target |= MESSAGE_RECIPIENT_HELPERS | MESSAGE_RECIPIENT_OPERS;
-    } else if(!irccasecmp(argv[1], "announcement") || !irccasecmp(argv[1], "announce")) {
-        target |= MESSAGE_RECIPIENT_ANNOUNCE;
     } else if(!irccasecmp(argv[1], "channels")) {
        target = MESSAGE_RECIPIENT_CHANNELS;
     } else {
@@ -614,8 +589,6 @@ global_conf_read(void)
 
     str = database_get_data(conf_node, KEY_DB_BACKUP_FREQ, RECDB_QSTRING);
     global_conf.db_backup_frequency = str ? ParseInterval(str) : 7200;
-    str = database_get_data(conf_node, KEY_ANNOUNCEMENTS_DEFAULT, RECDB_QSTRING);
-    global_conf.announcements_default = str ? enabled_string(str) : 1;
 
     str = database_get_data(conf_node, KEY_NICK, RECDB_QSTRING);
     if(global && str)
index b4bf81bb72b55b906daae7d256b1110f698289e5..ecd753a41afe1f5aab36021330bd56152e23509b 100644 (file)
@@ -25,7 +25,6 @@
 #define MESSAGE_RECIPIENT_HELPERS              0x002
 #define MESSAGE_RECIPIENT_OPERS                        0x004
 #define MESSAGE_RECIPIENT_CHANNELS                     0x008
-#define MESSAGE_RECIPIENT_ANNOUNCE                     0x040
 
 #define MESSAGE_OPTION_SOURCELESS              0x010
 #define MESSAGE_OPTION_IMMEDIATE               0x020
index 3887d41c970ce61d8daf6bcee692fdbadcf8a505..4916fef3c4641e807ac43bef470ae82e4400d74b 100644 (file)
@@ -28,7 +28,6 @@
 "TARGET" ("$bTARGET$b",
         "$bTarget$b is used as a sub-command in many commands. It's values are:",
         "$bUSERS$b:      The message will be sent to all users on the network including opers and helpers, but not channels.",
-        "$bANNOUNCEMENT$b: The message will be sent to all users who are configured to receive community announcements.",
         "$bHELPERS$b:    The message will be sent to helpers only.",
         "$bOPERS$b:      The message will be sent to opers only.",
         "$bSTAFF$b:      The message will be sent to helpers and opers.",
index 683fd71afe8af4150958fdd8b890fad50a240fc7..234b6bf7d6f95d430279015ca38d5ab49079382d 100644 (file)
@@ -96,7 +96,6 @@
 #define KEY_ALLOWAUTH "allowauth"
 #define KEY_EPITHET "epithet"
 #define KEY_TABLE_WIDTH "table_width"
-#define KEY_ANNOUNCEMENTS "announcements"
 #define KEY_MAXLOGINS "maxlogins"
 #define KEY_FAKEHOST "fakehost"
 #define KEY_NOTES "notes"
@@ -287,14 +286,12 @@ static const struct message_entry msgtab[] = {
     { "NSMSG_CLONE_AUTH", "Warning: %s (%s@%s) authed to your account." },
     { "NSMSG_SETTING_LIST", "$b$N account settings:$b" },
     { "NSMSG_INVALID_OPTION", "$b%s$b is an invalid account setting." },
-    { "NSMSG_INVALID_ANNOUNCE", "$b%s$b is an invalid announcements value." },
     { "NSMSG_SET_INFO", "$bINFO:         $b%s" },
     { "NSMSG_SET_WIDTH", "$bWIDTH:        $b%d" },
     { "NSMSG_SET_TABLEWIDTH", "$bTABLEWIDTH:   $b%d" },
     { "NSMSG_SET_COLOR", "$bCOLOR:        $b%s" },
     { "NSMSG_SET_PRIVMSG", "$bPRIVMSG:      $b%s" },
     { "NSMSG_SET_STYLE", "$bSTYLE:        $b%s" },
-    { "NSMSG_SET_ANNOUNCEMENTS", "$bANNOUNCEMENTS: $b%s" },
     { "NSMSG_SET_PASSWORD", "$bPASSWORD:     $b%s" },
     { "NSMSG_SET_FLAGS", "$bFLAGS:        $b%s" },
     { "NSMSG_SET_EMAIL", "$bEMAIL:        $b%s" },
@@ -429,7 +426,6 @@ register_handle(const char *handle, const char *passwd, UNUSED_ARG(unsigned long
 
     hi = calloc(1, sizeof(*hi));
     hi->userlist_style = HI_DEFAULT_STYLE;
-    hi->announcements = '?';
     hi->handle = strdup(handle);
     safestrncpy(hi->passwd, passwd, sizeof(hi->passwd));
     hi->infoline = NULL;
@@ -2151,7 +2147,7 @@ set_list(struct userNode *user, struct handle_info *hi, int override)
     unsigned int i;
     char *set_display[] = {
         "INFO", "WIDTH", "TABLEWIDTH", "COLOR", "PRIVMSG", "STYLE",
-        "EMAIL", "ANNOUNCEMENTS", "MAXLOGINS", "LANGUAGE"
+        "EMAIL", "MAXLOGINS", "LANGUAGE"
     };
 
     send_message(user, nickserv, "NSMSG_SETTING_LIST");
@@ -2305,33 +2301,6 @@ static OPTION_FUNC(opt_style)
     return 1;
 }
 
-static OPTION_FUNC(opt_announcements)
-{
-    const char *choice;
-
-    if (argc > 1) {
-        if (enabled_string(argv[1]))
-            hi->announcements = 'y';
-        else if (disabled_string(argv[1]))
-            hi->announcements = 'n';
-        else if (!strcmp(argv[1], "?") || !irccasecmp(argv[1], "default"))
-            hi->announcements = '?';
-        else {
-            send_message(user, nickserv, "NSMSG_INVALID_ANNOUNCE", argv[1]);
-            return 0;
-        }
-    }
-
-    switch (hi->announcements) {
-    case 'y': choice = user_find_message(user, "MSG_ON"); break;
-    case 'n': choice = user_find_message(user, "MSG_OFF"); break;
-    case '?': choice = "default"; break;
-    default: choice = "unknown"; break;
-    }
-    send_message(user, nickserv, "NSMSG_SET_ANNOUNCEMENTS", choice);
-    return 1;
-}
-
 static OPTION_FUNC(opt_password)
 {
     if (!override) {
@@ -2820,11 +2789,6 @@ nickserv_saxdb_write(struct saxdb_context *ctx) {
         assert(hi->id);
 #endif
         saxdb_start_record(ctx, iter_key(it), 0);
-        if (hi->announcements != '?') {
-            flags[0] = hi->announcements;
-            flags[1] = 0;
-            saxdb_write_string(ctx, KEY_ANNOUNCEMENTS, flags);
-        }
         if (hi->cookie) {
             struct handle_cookie *cookie = hi->cookie;
             char *type;
@@ -3481,8 +3445,6 @@ nickserv_db_read_handle(const char *handle, dict_t obj)
     }
     str = database_get_data(obj, KEY_USERLIST_STYLE, RECDB_QSTRING);
     hi->userlist_style = str ? str[0] : HI_STYLE_ZOOT;
-    str = database_get_data(obj, KEY_ANNOUNCEMENTS, RECDB_QSTRING);
-    hi->announcements = str ? str[0] : '?';
     str = database_get_data(obj, KEY_SCREEN_WIDTH, RECDB_QSTRING);
     hi->screen_width = str ? strtoul(str, NULL, 0) : 0;
     str = database_get_data(obj, KEY_TABLE_WIDTH, RECDB_QSTRING);
@@ -4072,7 +4034,6 @@ init_nickserv(const char *nick)
         dict_insert(nickserv_opt_dict, "TITLE", opt_title);
         dict_insert(nickserv_opt_dict, "FAKEHOST", opt_fakehost);
     }
-    dict_insert(nickserv_opt_dict, "ANNOUNCEMENTS", opt_announcements);
     dict_insert(nickserv_opt_dict, "MAXLOGINS", opt_maxlogins);
     dict_insert(nickserv_opt_dict, "LANGUAGE", opt_language);
     dict_insert(nickserv_opt_dict, "KARMA", opt_karma);
index d19f13a25505b8fbd67973a5ea20b44b0e61282e..9e6ba8913977fb7e4ad916265670af47b32abc9b 100644 (file)
@@ -108,7 +108,6 @@ struct handle_info {
     unsigned short screen_width;
     unsigned short table_width;
     unsigned char userlist_style;
-    unsigned char announcements;
     unsigned char maxlogins;
     char passwd[MD5_CRYPT_LENGTH+1];
     char last_quit_host[USERLEN+HOSTLEN+2];
index b4a1b7e06d2aa2776017833ac68fceb93b4d2a5d..a2f59a495c007ddb8fb392314c205092f160e255 100644 (file)
         "/services/nickserv/email_enabled && /services/nickserv/disable_nicks" (
         "/msg $N SET [<setting> [value]]",
         "Changes your account settings for srvx. Settings are:",
-        "$bANNOUNCEMENTS$b: Indicates whether you wish to receive community announcements via the $G service.",
         "$bCOLOR$b: If set, $b$N$b and $b$C$b will use $bbold$b and $uunderlines$u in text they send you.",
         "$bEMAIL$b: Sets (or changes) your email address.",
         "$bINFO$b:  Your infoline for $b$N$b (which can be viewed with the $baccountinfo$b command).",
         "/services/nickserv/email_enabled && !/services/nickserv/disable_nicks" (
         "/msg $N SET [<setting> [value]]",
         "Changes your account settings for srvx. Settings are:",
-        "$bANNOUNCEMENTS$b: Indicates whether you wish to receive community announcements via the $G service.",
         "$bCOLOR$b: If set, $b$N$b and $b$C$b will use $bbold$b and $uunderlines$u in text they send you.",
         "$bEMAIL$b: Sets (or changes) your email address.",
         "$bINFO$b:  Your infoline for $b$N$b (which can be viewed with the $baccountinfo$b command).",
         "!/services/nickserv/email_enabled && /services/nickserv/disable_nicks" (
         "/msg $N SET [<setting> [value]]",
         "Changes your account settings for srvx. Settings are:",
-        "$bANNOUNCEMENTS$b: Indicates whether you wish to receive community announcements via the $G service.",
         "$bCOLOR$b: If set, $b$N$b and $b$C$b will use $bbold$b and $uunderlines$u in text they send you.",
         "$bINFO$b:  Your infoline for $b$N$b (which can be viewed with the $baccountinfo$b command).",
         "$bLANGUAGE$b: Your preferred language for private messages from the services.",
         "!/services/nickserv/email_enabled && !/services/nickserv/disable_nicks" (
         "/msg $N SET [<setting> [value]]",
         "Changes your account settings for srvx. Settings are:",
-        "$bANNOUNCEMENTS$b: Indicates whether you wish to receive community announcements via the $G service.",
         "$bCOLOR$b: If set, $b$N$b and $b$C$b will use $bbold$b and $uunderlines$u in text they send you.",
         "$bINFO$b:  Your infoline for $b$N$b (which can be viewed with the $baccountinfo$b command).",
         "$bLANGUAGE$b: Your preferred language for private messages from the services.",