Author: Isomer <isomer@coders.net>
authorPerry Lorier <isomer@undernet.org>
Sat, 1 Apr 2000 23:51:18 +0000 (23:51 +0000)
committerPerry Lorier <isomer@undernet.org>
Sat, 1 Apr 2000 23:51:18 +0000 (23:51 +0000)
Log message:

 * another attempt at fixing ping (sigh...)
 * added all the flags to extended who, so you can figure out if someone is
op'd /and/ voice'd on a channel.
 * added %l specifier to list peoples idle time, as requested by iamabot.

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

ChangeLog
doc/readme.who
include/whocmds.h
ircd/ircd.c
ircd/m_who.c
ircd/whocmds.c

index 24d02fdf6693e328e8a52f2e53a16cf6eea59136..a7b77278b76bb48216699a200f45d8f986b52cea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-03-30  Perry Lorier <isomer@coders.net>
+       * ircd/ircd.c: Lets see if this helps the ping problem at all.
+       * ircd/whocmds.c, /doc/readme.who: Added %l specifier to get idle
+       time for local clients. (as requested), extended who now returns all
+       the flags (@+!) so you can tell the complete state of a client.
+
 2000-03-30  Thomas Helvey <tomh@inxpress.net>
        * m_rping.c m_rpong.c: add Gte's rping/rpong fixes
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.58 2000-04-01 22:53:49 bleep Exp $
+# $Id: ChangeLog,v 1.59 2000-04-01 23:51:18 isomer Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index d0acefa5f2a2eab486b601bfa43119f6c39bf13f..49d6d00a5446551cf5889b3b7862ba62f074b70b 100644 (file)
@@ -91,6 +91,7 @@ in which:
    f : Include flags (all of them)
    h : Include hostname
    i : Include IP
+   l : Include idle time (0 for remote users) [2.10.11+]
    n : Include nick
    r : Include real name
    s : Include server name
@@ -110,7 +111,7 @@ out-of-standard 352 crashes EPIC and confuses several other clients. I used
 
 :"source" 354 "target" ["querytype"] ["channel"] ["user"] 
                        ["IP"] ["host"] ["server"] ["nick"] 
-                       ["flags"] ["hops"] [:"realname"]
+                       ["flags"] ["hops"] ["idle"] [:"realname"]
 
 Where only the fields specified in the %fields options are present.
 
@@ -153,7 +154,7 @@ Note that:
          Oslo-R.NO.EU.Undernet.org Niels
   
   So that he can have in example a script that does 
-  "on 354 * 166" display "There is an oper ..."
+  on ^354 "% 166" display "There is an oper ..."
 
 - The client will have to sort/format the fields by itself,
   the _order_ in which flags are passed is not significant, the fields in the
@@ -273,5 +274,10 @@ Miscellaneous bug fixes / "undocumented feature" changes:
   recomended way for GUI based clients to get a channel's userlist and all
   the infos they want about users on the channel.
 
+- If you use the new numeric, flags will contain all the information about
+  a user on a channel.  @ for op'd, + for voiced, and ! for zombie. eg:
+  Isomer #coder-com H@+, where the old behavor of just displaying one of
+  them has been preserved for the old numeric.  [2.10.11+]
+
 Regards, Andrea aka Nemesi
 
index 0e4190d73e826ddf3dd9dc07685198adf592dbf6..e02358a9a408293b886c3b8d862c7424abda6162 100644 (file)
@@ -38,6 +38,7 @@ struct Channel;
 #define WHO_FIELD_FLA 128
 #define WHO_FIELD_DIS 256
 #define WHO_FIELD_REN 512
+#define WHO_FIELD_IDL 1024
 
 #define WHO_FIELD_DEF ( WHO_FIELD_NIC | WHO_FIELD_UID | WHO_FIELD_HOS | WHO_FIELD_SER )
 
index 94f49fa8234b556dd35159abe5565549b7d23c3b..64395ccb371d63c3c9d71cc136822a1a490cfd99 100644 (file)
@@ -301,12 +301,16 @@ static time_t check_pings(void)
     */
    max_ping = IsRegistered(cptr) ? get_client_ping(cptr) : CONNECTTIMEOUT;
    
+   Debug((DEBUG_DEBUG, "check_pings(%s)=status:%s limit: %d current: %d",
+          cptr->name, (cptr->flags & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]", 
+          max_ping, (int)(CurrentTime - cptr->lasttime)));
+          
    /* Ok, the thing that will happen most frequently, is that someone will
     * have sent something recently.  Cover this first for speed.
     */
    if (CurrentTime-cptr->lasttime < max_ping) {
        expire=cptr->lasttime + max_ping;
-       if (next_check<expire
+       if (expire<next_check
          next_check=expire;
        continue;
    }
@@ -323,7 +327,9 @@ static time_t check_pings(void)
     } /* of testing to see if ping has been sent */
     
     /* Unregistered clients pingout after max_ping seconds, they don't
-     * get given a second chance. 
+     * get given a second chance - if they were then people could not quite
+     * finish registration and hold resources without being subject to k/g
+     * lines
      */
     if (!IsRegistered(cptr)) {
       /* Display message if they have sent a NICK and a USER but no
@@ -369,6 +375,8 @@ static time_t check_pings(void)
   
   assert(next_check>=CurrentTime);
   
+  Debug((DEBUG_DEBUG, "[%i] check_pings() again in %is",CurrentTime,next_check-CurrentTime));
+  
   return next_check;
 }
 
@@ -485,6 +493,7 @@ ping_timeout:
 static void print_usage(void)
 {
   printf("Usage: ircd [-f config] [-h servername] [-x loglevel] [-ntv]\n");
+  printf("\n -n -t\t Don't detach\n -v\t display version\n\n");
   printf("Server not started\n");
 }
 
index e93320ff83eef8d1586cccbccca577419c08c2b3..a658fbd1c758e98d8645b890219f0ede7e983a8e 100644 (file)
@@ -246,6 +246,9 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
           case 'I':
             fields |= WHO_FIELD_NIP;
             break;
+          case 'l':
+          case 'L':
+            fields |= WHO_FIELD_IDL;
           case 'n':
           case 'N':
             fields |= WHO_FIELD_NIC;
index 0c2b5b4a525144b4c01080ddebdf459917c00cd3..a34f429a7d92c2d1f66dec5af0f9883896dcdc76 100644 (file)
@@ -156,12 +156,26 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
       *(p1++) = 'H';
     if (IsAnOper(acptr))
       *(p1++) = '*';
-    if (chptr && is_chan_op(acptr, chptr))
-      *(p1++) = '@';
-    else if (chptr && has_voice(acptr, chptr))
-      *(p1++) = '+';
-    else if (chptr && is_zombie(acptr, chptr))
-      *(p1++) = '!';
+    if (fields) {
+      /* If you specified flags then we assume you know how to parse
+       * multiple channel status flags, as this is currently the only
+       * way to know if someone has @'s *and* is +'d.
+       */
+      if (chptr && is_chan_op(acptr, chptr))
+        *(p1++) = '@';
+      if (chptr && has_voice(acptr, chptr))
+        *(p1++) = '+';
+      if (chptr && is_zombie(acptr, chptr))
+        *(p1++) = '!';
+    }
+    else {
+      if (chptr && is_chan_op(acptr, chptr))
+        *(p1++) = '@';
+      else if (chptr && has_voice(acptr, chptr))
+        *(p1++) = '+';
+      else if (chptr && is_zombie(acptr, chptr))
+        *(p1++) = '!';
+    }
     if (IsDeaf(acptr))
       *(p1++) = 'd';
     if (IsAnOper(sptr))
@@ -183,6 +197,19 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
     p1 = sprintf_irc(p1, "%d", acptr->hopcount);
   }
 
+  if (!fields || (fields & WHO_FIELD_IDL))
+  {
+    *p1++ = ' ';
+    if (!fields)
+      *p1++ = ':';              /* Place colon here for default reply */
+    if (MyUser(acptr)) {
+           p1 = sprintf_irc(p1, "%d", CurrentTime-acptr->lasttime);
+    }    
+    else {
+           *p1++ = '0';
+    }
+  }
+
   if (!fields || (fields & WHO_FIELD_REN))
   {
     char *p2 = acptr->info;