Author: Diane Bruce <db@tfm.com> (by way of Kev <klmitch@mit.edu>)
authorKevin L. Mitchell <klmitch@mit.edu>
Fri, 15 Dec 2000 01:14:59 +0000 (01:14 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Fri, 15 Dec 2000 01:14:59 +0000 (01:14 +0000)
Log message:

- rfc1489 is ambigous about how to handle ISON. The example shows
  no ':' used in the command, which means each nick would appear in
  parv[1] to parv[n].  After discussion with hop on efnet/undernet
  it became apparent there is a problem. ircnet gets it right, but they
  loop over all parv as well as strtoken'ing on ' '
  My suggested fix is to loop over each parv[1] to parc, and scanning
  each one for ' '. I prefer to use parc rather than relying on a parv[]
  being NULL, but you could do a slightly more efficient version that way.

- Trailing spaces are removed, apparently that breaks some ircII clients.
  epic according to hoppie, is ok, but still...

(This patch was applied by hand because of the number of changes involved;
hope I got the trailing space behavior correct--I removed all trailing
spaces. -Kev)

Testing:

I tested it; it doesn't crash the server.  If ISON gets more than the
maximum number of arguments before hitting a colon, the server tries to
look up :<nick>, but this isn't much of a suprise.  Looks nice :)

 -Kev

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@338 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_ison.c

index 1577891e002c57032c62c40eb12b3bbae8a55eb7..377d3f308d4e86dc7203cc2e9b96a99058b19d20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-12-14  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/m_ison.c (m_ison): Apply Diane Bruce's patch to make ISON
+       parse all arguments
+
        * ircd/s_debug.c (count_memory): modify to report for clients and
        connections, not local clients and remote clients
 
index bf9779f890ed54e49b0073516298b49553c24b05..e26b0d255f299bf32164688d7be75726894d8879 100644 (file)
@@ -120,21 +120,28 @@ int m_ison(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   char*          name;
   char*          p = 0;
   struct MsgBuf* mb;
+  int found1 = 0;
+  int i;
 
   if (parc < 2)
     return need_more_params(sptr, "ISON");
 
   mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me), cli_name(sptr));
 
-  for (name = ircd_strtok(&p, parv[1], " "); name;
-       name = ircd_strtok(&p, 0, " ")) {
-    if ((acptr = FindUser(name))) {
-      if (msgq_bufleft(mb) < strlen(cli_name(acptr)) + 1) {
-       send_buffer(sptr, mb, 0); /* send partial response */
-       msgq_clean(mb); /* then do another round */
-       mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me), cli_name(sptr));
+  for (i = 1; i < parc; i++) {
+    for (name = ircd_strtok(&p, parv[i], " "); name;
+        name = ircd_strtok(&p, 0, " ")) {
+      if ((acptr = FindUser(name))) {
+       if (msgq_bufleft(mb) < strlen(cli_name(acptr)) + 1) {
+         send_buffer(sptr, mb, 0); /* send partial response */
+         msgq_clean(mb); /* then do another round */
+         mb = msgq_make(sptr, rpl_str(RPL_ISON), cli_name(&me),
+                        cli_name(sptr));
+         found1 = 0;
+       }
+       msgq_append(0, mb, "%s%s", found1 ? " " : "", cli_name(acptr));
+       found1++;
       }
-      msgq_append(0, mb, "%s ", cli_name(acptr)); /* append nickname */
     }
   }