Parcourir la source

* Port [3601] to 1.2.14
* Added OSVER entry for bots in .whois


svn: 3603

Bryan Drewery il y a 18 ans
Parent
commit
c4d2cdced3
6 fichiers modifiés avec 29 ajouts et 8 suppressions
  1. 1 0
      doc/UPDATES
  2. 3 1
      src/botcmd.c
  3. 1 0
      src/chanprog.c
  4. 10 6
      src/dcc.c
  5. 13 0
      src/userent.c
  6. 1 1
      src/users.h

+ 1 - 0
doc/UPDATES

@@ -64,6 +64,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed +take opping the wrong clients due to desync (+take now sets +bitch)
 * Fix cmd/dcc prefix leaking to -p users (when chat is off) (fixes #376)
 * Fix checking for flood on hosts which are already ignored. (fixes #343)
+* Added OSVER entry for bots in .whois
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 3 - 1
src/botcmd.c

@@ -398,12 +398,13 @@ static void remote_tell_who(int idx, char *nick, int chan)
 
 static void bot_shellinfo(int idx, char *par)
 {
-  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL;
+  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL, *version = NULL;
   
   username = newsplit(&par);
   sysname = newsplit(&par);
   nodename = newsplit(&par);
   arch = newsplit(&par);
+  version = newsplit(&par);
 
   set_user(&USERENTRY_USERNAME, dcc[idx].user, username);
   set_user(&USERENTRY_OS, dcc[idx].user, sysname);
@@ -411,6 +412,7 @@ static void bot_shellinfo(int idx, char *par)
   strcpy(dcc[idx].u.bot->sysname, sysname); 
   set_user(&USERENTRY_NODENAME, dcc[idx].user, nodename);
   set_user(&USERENTRY_ARCH, dcc[idx].user, arch);
+  set_user(&USERENTRY_OSVER, dcc[idx].user, version);
 }
 
 /* who <from@bot> <tobot> <chan#>

+ 1 - 0
src/chanprog.c

@@ -613,6 +613,7 @@ void chanprog()
   set_user(&USERENTRY_USERNAME, conf.bot->u, conf.username);
   set_user(&USERENTRY_NODENAME, conf.bot->u, un.nodename);
   set_user(&USERENTRY_ARCH, conf.bot->u, un.machine);
+  set_user(&USERENTRY_OSVER, conf.bot->u, un.release);
 
   var_parse_my_botset();
 

+ 10 - 6
src/dcc.c

@@ -119,7 +119,7 @@ strip_telnet(int sock, char *buf, int *len)
 void
 send_sysinfo()
 {
-  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL;
+  char *username = NULL, *sysname = NULL, *nodename = NULL, *arch = NULL, *osver = NULL;
   struct utsname un;
   bool gotun = 0;
 
@@ -132,31 +132,35 @@ send_sysinfo()
   sysname = (char *) get_user(&USERENTRY_OS, conf.bot->u);
   nodename = (char *) get_user(&USERENTRY_NODENAME, conf.bot->u);
   arch = (char *) get_user(&USERENTRY_ARCH, conf.bot->u);
+  osver = (char *) get_user(&USERENTRY_OSVER, conf.bot->u);
 
-  const char *usysname = NULL, *uusername = NULL, *unodename = NULL, *uarch = NULL;
+  const char *usysname = NULL, *uusername = NULL, *unodename = NULL, *uarch = NULL, *uosver = NULL;
 
   usysname = gotun ? un.sysname : "*";
   uusername = conf.username ? conf.username : "*";
   unodename = gotun ? un.nodename : "*";
   uarch = gotun ? un.machine : "*";
+  uosver = gotun ? un.release : "*";
 
   if (((sysname && egg_strcasecmp(sysname, usysname)) ||
        (username && egg_strcasecmp(username, uusername)) ||
        (nodename && egg_strcasecmp(nodename, unodename)) ||
-       (arch && egg_strcasecmp(arch, uarch))
+       (arch && egg_strcasecmp(arch, uarch)) ||
+       (osver && egg_strcasecmp(osver, uosver))
       ) ||
       ((!sysname && usysname) || 
        (!username && uusername) || 
        (!nodename && unodename) || 
-       (!arch && uarch)
+       (!arch && uarch) ||
+       (!osver && uosver)
       )
       ) {
       char buf[201] = "";
       size_t len = 0;
 
-      len = simple_snprintf(buf, sizeof(buf), "si %s %s %s %s\n", 
+      len = simple_snprintf(buf, sizeof(buf), "si %s %s %s %s %s\n",
             conf.username ? conf.username : "*", gotun ? un.sysname : "*", gotun ? un.nodename : "*",
-            gotun ? un.machine : "*");
+            gotun ? un.machine : "*", gotun ? un.release : "*");
 
       send_uplink(buf, len);
   }

+ 13 - 0
src/userent.c

@@ -30,6 +30,7 @@ void init_userent()
   add_entry_type(&USERENTRY_NODENAME);
   add_entry_type(&USERENTRY_USERNAME);
   add_entry_type(&USERENTRY_ARCH);
+  add_entry_type(&USERENTRY_OSVER);
   add_entry_type(&USERENTRY_PASS);
   add_entry_type(&USERENTRY_TMPPASS);
   add_entry_type(&USERENTRY_SECPASS);
@@ -428,6 +429,18 @@ struct user_entry_type USERENTRY_OS = {
  "OS"
 };
 
+struct user_entry_type USERENTRY_OSVER = {
+ 0,
+ def_gotshare,
+ def_unpack,
+ write_userfile_protected,
+ def_kill,
+ def_get,
+ set_protected,
+ botmisc_display,
+ "OSVER"
+};
+
 struct user_entry_type USERENTRY_ARCH = {
  0,
  def_gotshare,

+ 1 - 1
src/users.h

@@ -47,7 +47,7 @@ extern struct user_entry_type USERENTRY_COMMENT, USERENTRY_LASTON,
  USERENTRY_INFO, USERENTRY_BOTADDR, USERENTRY_HOSTS,
  USERENTRY_PASS, USERENTRY_STATS, USERENTRY_ADDED, USERENTRY_MODIFIED,
  USERENTRY_SET, USERENTRY_SECPASS, USERENTRY_USERNAME, USERENTRY_NODENAME, USERENTRY_OS,
- USERENTRY_TMPPASS, USERENTRY_ARCH;
+ USERENTRY_TMPPASS, USERENTRY_ARCH, USERENTRY_OSVER;
 
 struct laston_info {
   time_t laston;