Explorar el Código

* New cmd: addline

svn: 859
Bryan Drewery hace 22 años
padre
commit
6effcc0120
Se han modificado 3 ficheros con 59 adiciones y 17 borrados
  1. 1 0
      doc/UPDATES
  2. 22 17
      misc/help.txt
  3. 36 0
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -17,6 +17,7 @@ This is a summary of ChangeLog basically.
 14.Bots were not recognizing keys set in .chanset.
 15.cmd_pls_host now accepts multiple hosts.
 16.Fixed bots not joining right away when a +chan was made.
+17.New cmd: addline, see .help addline for more info.
 
 1.1.3
 1.Fixed a very fatal bug with channel ctcps.

+ 22 - 17
misc/help.txt

@@ -1,4 +1,3 @@
-
 ::+ban
 ###  %b+ban%b <hostmask> [channel] [%%<XdXhXm>] [comment]
    Adds a ban to the list of bans stored on the bot, with optional comment and
@@ -132,6 +131,12 @@ See also: +user%{+ai}, -bot%{-}%{+nai}, newleaf%{-}
    command in IRC.
  
 See also: console
+::addline
+###  %baddline%b <username>
+   Shows you a simple line for adding a user to another botnet with the
+   same hostmasks.
+ 
+See also: whois
 ::addlog
 ###  %baddlog%b <text>
    Adds your comment to the bot's logfile. Bot masters can go back later and
@@ -791,6 +796,11 @@ See also: down
    Display a dump of memory allocation information, assuming the bot was
    compiled with memory debugging. It's useless to anyone but developers
    trying to find memory leaks.
+::decrypt
+###  %decrypt%b <key> <string>
+   Decrypts the string using the specified key.
+ 
+See also: encrypt, randstring, md5, sha1
 :leaf:deluser
 ###  %bdeluser%b <nickname>
    deletes a user record for a user on the channel, using their
@@ -842,6 +852,11 @@ See also: bots
    just like everyone else will see it. If it's off, then it won't happen.
  
 See also: color, page, strip
+::encrypt
+###  %bencrypt%b <key> <string>
+   Encrypts the string using the specified key.
+ 
+See also: decrypt, randstring, md5, sha1
 ::exec:
 ###  %bexec%b <params>
    The bot will execute the specified program with each param specified,
@@ -1114,21 +1129,6 @@ See also: unlink, newleaf%{+a}, -bot%{-}
      .match *.edu 16 25
    This would show results 16 through 25 matching any users with a hostmask
    that ends with ".edu".
-::encrypt
-###  %bencrypt%b <key> <string>
-   Encrypts the string using the specified key.
-
-See also: decrypt, randstring, md5, sha1
-::decrypt
-###  %decrypt%b <key> <string>
-   Decrypts the string using the specified key.
-
-See also: encrypt, randstring, md5, sha1
-::sha1
-###  %bsha1%b <string>
-   Returns the SHA1 hash of the specified string.
-
-See also: randstring, md5, encrypt, decrypt
 ::md5
 ###  %bmd5%b <string>
    Returns the MD5 hash of the specified string.
@@ -1305,7 +1305,7 @@ See also: echo, color
 ::randstring
 ###  %brandstring%b <len>
    Displays a random string of length 'len' up to 300 chars.
-
+ 
 See also: md5, sha1, encrypt, decrypt
 ::relay
 ###  %brelay%b <bot>
@@ -1383,6 +1383,11 @@ See also: reload, backup
    bot is booted up.  after that, you can add servers with the
    %b'%djump'%b command.  the server list will indicate which server the
    bot is currently on.
+::sha1
+###  %bsha1%b <string>
+   Returns the SHA1 hash of the specified string.
+ 
+See also: randstring, md5, encrypt, decrypt
 ::simul
 ###  %bsimul%b <handle> <text>
    This allows you to simulate the specified handle typing the given text.

+ 36 - 0
src/cmds.c

@@ -589,6 +589,41 @@ static void cmd_about(struct userrec *u, int idx, char *par)
   dprintf(idx, STR(" * $utfbot$u by $bwarknite$b and $bloslinux$b\n"));
 }
 
+static void cmd_addline(struct userrec *user, int idx, char *par)
+{
+  struct userrec *u = NULL;
+  struct list_type *q = NULL;
+  char *hostbuf = NULL, *outbuf = NULL;
+
+  if (!par[0]) {
+    dprintf(idx, "Usage: addline <user>\n");
+    return;
+  }
+
+  putlog(LOG_CMDS, "*", "#%s# addline %s", dcc[idx].nick, par);
+
+  u = get_user_by_handle(userlist, par);
+
+  if (!u || (u && !whois_access(user, u))) {
+    dprintf(idx, "No such user.\n");
+    return;
+  }
+
+  q = get_user(&USERENTRY_HOSTS, u);
+  
+  hostbuf = calloc(1, 1);
+  for (; q; q = q->next) {
+    hostbuf = realloc(hostbuf, strlen(hostbuf) + strlen(q->extra) + 2);
+    strcat(hostbuf, q->extra);
+    strcat(hostbuf, " ");
+  }
+  outbuf = calloc(1, strlen(hostbuf) + strlen(u->handle) + 20);
+  sprintf(outbuf, "Addline: +user %s %s", u->handle, hostbuf);
+  dumplots(idx, "", outbuf);
+  free(hostbuf);
+  free(outbuf);
+}
+
 static void cmd_away(struct userrec *u, int idx, char *par)
 {
   if (strlen(par) > 60)
@@ -4066,6 +4101,7 @@ cmd_t C_dcc[] =
   {"addlog",		"mo|o",	(Function) cmd_addlog,		NULL},
 /*  {"putlog",		"mo|o",	(Function) cmd_addlog,		NULL}, */
   {"about",		"",	(Function) cmd_about,		NULL},
+  {"addline",		"",	(Function) cmd_addline,		NULL},
   {"away",		"",	(Function) cmd_away,		NULL},
   {"back",		"",	(Function) cmd_back,		NULL},
 #ifdef HUB