Просмотр исходного кода

* Added cmd_login to change login display settings seen in .whois for a few versions

svn: 1512
Bryan Drewery 21 лет назад
Родитель
Сommit
25595752a2
3 измененных файлов с 57 добавлено и 1 удалено
  1. 1 0
      doc/UPDATES
  2. 8 1
      misc/help.txt
  3. 48 0
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -64,6 +64,7 @@ This is a summary of ChangeLog basically.
 * +v users are no longer enforced if opped.
 * cmdpasses now require that the old pass be used to clear old pass.
 * cmd_bottree now shows HUBS as yellow.
+* Added cmd_login to change login display settings seen in .whois for a few versions
 
 1.1.9
 

+ 8 - 1
misc/help.txt

@@ -765,7 +765,7 @@ See also: botconfig
 ###  $bconsole$b <user> [channel] [modes]
    This is used to set the console level of another user. This can even be used
    on users who normally would not be able to set their own console mode.%{-}
-
+ 
 See also: color, echo, page, strip
 ::crontab:
 ###  $bcrontab$b <status|delete|show|new> [interval]
@@ -1154,6 +1154,13 @@ See also: netlag
    recommended for use.
  
 See also: unlink, newleaf%{+a}, -bot%{-}
+::login
+###  $blogin$b <banner|bots|channels|whom> [on/off]
+   Sets various login options.
+   Not specifying on/off will display what the setting is the for the specified
+   login entry.
+ 
+See also: echo, color, console, page, strip, whois
 ::match
 ###  $bmatch$b <attr> [channel] [[start] limit]
    This displays all user records with the attributes requested.

+ 48 - 0
src/cmds.c

@@ -2859,6 +2859,53 @@ static void cmd_echo(int idx, char *par)
   console_dostore(idx);
 }
 
+static void cmd_login(int idx, char *par)
+{
+  char *which = NULL;
+  int set = -1, whichbit = 0;
+
+  if (!par[0]) {
+    dprintf(idx, "Usage: login <banner|bots|channels|whom> [on/off]\n");
+    return;
+  }
+
+  which = newsplit(&par);
+
+  if (!egg_strcasecmp(which, "banner"))
+    whichbit = STAT_BANNER;
+  else if (!egg_strcasecmp(which, "bots"))
+    whichbit = STAT_BOTS;
+  else if (!egg_strcasecmp(which, "channels"))
+    whichbit = STAT_CHANNELS;
+  else if (!egg_strcasecmp(which, "whom"))
+    whichbit = STAT_WHOM;
+  else {
+    dprintf(idx, "Unrecognized option '$b%s$b'\n", which);
+    return;
+  }
+
+  if (!par[0]) {
+    dprintf(idx, "'%s' is currently: $b%s$b\n", which, (dcc[idx].status & whichbit) ? "on" : "off");
+    return;
+  }
+
+  if (!egg_strcasecmp(par, "on"))
+    set = 1;
+  else if (!egg_strcasecmp(par, "off"))
+    set = 0;
+  else {
+    dprintf(idx, "Unrecognized setting '$b%s$b'\n", par);
+    return;
+  }
+
+  if (set)
+    dcc[idx].status |= whichbit;
+  else if (!set)
+    dcc[idx].status &= ~whichbit;
+  
+  console_dostore(idx);
+}
+
 static void cmd_color(int idx, char *par)
 {
   int ansi = coloridx(idx);
@@ -4345,6 +4392,7 @@ cmd_t C_dcc[] =
   {"timers",		"a",	(Function) cmd_timers,		NULL},
   {"die",		"n",	(Function) cmd_die,		NULL},
   {"echo",		"",	(Function) cmd_echo,		NULL},
+  {"login",		"",	(Function) cmd_login,		NULL},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL},
   {"handle",		"",	(Function) cmd_handle,		NULL},
   {"nohelp",		"-|-",	(Function) cmd_nohelp,		NULL},