Преглед изворни кода

Merge branch 'auth-deaf'

* auth-deaf:
  * Fix conflicting DEAF needs
  * Auto set +D/-D depending on authed users
  * Fix DEAF mode being out of sync with new +f auto -D/+D
Bryan Drewery пре 16 година
родитељ
комит
c007acddcf
2 измењених фајлова са 14 додато и 6 уклоњено
  1. 1 0
      doc/UPDATES
  2. 13 6
      src/mod/server.mod/server.c

+ 1 - 0
doc/UPDATES

@@ -92,6 +92,7 @@
   * Floodbots (+f) and Resolvbots (+r) are now listed in cmd_userlist
   * Floodbots (+f) will automatically unDEAF themselves to they can monitor the channel for floods (namely flood-chan).
     Note that this is done about 10 seconds after adding +f to a bot. Removing +f will set DEAF again.
+  * This auto DEAF/UNDEAF works if you auth with the bot and it supports channel cmds
   * Added SHA256 support (cmd_sha256, Auth cmd: sha256)
   * Add cmd_encrypt_fish and cmd_decrypt_fish which uses eggdrop's blowfish (same as FiSH)
   * Add cmd_hash which returns the MD5, SHA1 and SHA256 of the given string.

+ 13 - 6
src/mod/server.mod/server.c

@@ -1011,12 +1011,19 @@ static void server_secondly()
       if (cnt_10 == 9) {
         // Ensure that +D/+f are not conflicting
 
-        // In +D but am +f, need to -D
-        if (deaf_set && doflood(NULL)) {
-          dprintf(DP_SERVER, "MODE %s -%c\n", botname, deaf_char);
-        } else if (!deaf_set && use_deaf && deaf_char) {
-          // Not +D but should be, probably had +f removed.
-          dprintf(DP_SERVER, "MODE %s +%c\n", botname, deaf_char);
+        if (deaf_char) {
+          // +f or auth bots in used need to see channel chatter.
+          bool need_chatter = doflood(NULL) || (Auth::ht_host.size() && auth_chan && strlen(auth_prefix));
+
+          // In +D but am +f, need to -D
+          if (deaf_set && (need_chatter || !use_deaf)) {
+            dprintf(DP_SERVER, "MODE %s -%c\n", botname, deaf_char);
+            deaf_set = 0;
+          } else if (!deaf_set && use_deaf && !need_chatter) {
+            // Not +D but should be, probably had +f removed.
+            dprintf(DP_SERVER, "MODE %s +%c\n", botname, deaf_char);
+            deaf_set = 1;
+          }
         }
 
         cnt_10 = 0;