소스 검색

* Added cmd_nopass

svn: 532
Bryan Drewery 22 년 전
부모
커밋
4cf92cbe6f
2개의 변경된 파일30개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      misc/help.txt
  2. 27 0
      src/cmds.c

+ 3 - 0
misc/help.txt

@@ -1234,6 +1234,9 @@ See also: w
 %{+mi}See also: chpass%{-}%{+n}, chsecpass%{-}
 ::nick
 See: handle
+:hub:nopass
+###  %bnohelp%b
+   Displays all users who do not have a password set.
 ::note
 ###  %bnote%b <nickname[@bot]> <message>
    Sends a private note to a user on the partyline. If that user is currently

+ 27 - 0
src/cmds.c

@@ -3076,6 +3076,32 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
     }
   }
 }
+
+static void cmd_nopass(struct userrec *u, int idx, char *par)
+{
+  int cnt = 0;
+  struct userrec *cu;
+  char *users = nmalloc(1);
+
+  putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
+
+  users[0] = 0;
+  for (cu = userlist; cu; cu = cu->next) {
+    if (!(cu->flags & USER_BOT)) {
+      if (u_pass_match(cu, "-")) {
+        cnt++;
+        users = nrealloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
+        strcat(users, cu->handle);
+        strcat(users, " ");
+      }
+    }
+  }
+  if (!cnt) 
+    dprintf(idx, "All users have passwords set.\n");
+  else
+    dprintf(idx, "Users without passwords: %s\n", users);
+  nfree(users);
+}
 #endif /* HUB */
 
 static void cmd_pls_ignore(struct userrec *u, int idx, char *par)
@@ -4100,6 +4126,7 @@ cmd_t C_dcc[] =
   {"nettcl",		"a",	(Function) cmd_nettcl,		NULL},
 #endif /* S_TCLCMDS */
   {"newleaf",		"n",	(Function) cmd_newleaf,		NULL},
+  {"nopass",		"m",	(Function) cmd_nopass,		NULL},
 #endif /* HUB */
   {"newpass",		"",	(Function) cmd_newpass,		NULL},
   {"secpass",		"",	(Function) cmd_secpass,		NULL},