]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Numeric 317: implemented "signon time" (displayed in WHOIS result).
authorAlexander Barton <alex@barton.de>
Thu, 4 Oct 2007 15:03:55 +0000 (15:03 +0000)
committerAlexander Barton <alex@barton.de>
Thu, 4 Oct 2007 15:03:55 +0000 (15:03 +0000)
ChangeLog
src/ngircd/conn-func.c
src/ngircd/conn-func.h
src/ngircd/conn.c
src/ngircd/conn.h
src/ngircd/irc-info.c
src/ngircd/messages.h

index 478f331fe991143d0cb139d36db3561698620902..383ac755a59a853b963ee8cd5195b01c41e9402e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
 
 ngIRCd HEAD
 
+  - Numeric 317: implemented "signon time" (displayed in WHOIS result).
   - Fixed code that prevented GCC 2.95 to compile ngIRCd.
   - Adjust path names in manual pages according to "./configure" settings.
   - Added new server configuration option "Passive" for "Server" blocks to
@@ -706,4 +707,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.322 2007/10/04 10:14:52 alex Exp $
+$Id: ChangeLog,v 1.323 2007/10/04 15:03:55 alex Exp $
index 6170a8cd58ae1d4c44d5aaad877dabdaf41e9708..92da1428c0a32ebe05353269bd0d7621758359f0 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn-func.c,v 1.10 2006/05/10 21:24:01 alex Exp $";
+static char UNUSED id[] = "$Id: conn-func.c,v 1.11 2007/10/04 15:03:56 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -39,6 +39,16 @@ Conn_UpdateIdle( CONN_ID Idx )
 }
 
 
+/*
+ * Get signon time of a connection.
+ */
+GLOBAL time_t
+Conn_GetSignon(CONN_ID Idx)
+{
+       assert(Idx > NONE);
+       return My_Connections[Idx].signon;
+}
+
 GLOBAL time_t
 Conn_GetIdle( CONN_ID Idx )
 {
index c7ab6794718249f1244d7035edfa8cc3dbee724c..e762e5c3c9561552cc42737d7d8e600fc5b05d59 100644 (file)
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn-func.h,v 1.6 2007/04/03 22:08:10 fw Exp $
+ * $Id: conn-func.h,v 1.7 2007/10/04 15:03:56 alex Exp $
  *
  * Connection management: Global functions (header)
  */
@@ -27,6 +27,7 @@
 
 
 GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
+GLOBAL time_t Conn_GetSignon PARAMS((CONN_ID Idx));
 GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
index 38af44abfd900529187306f4d829ceeec5d26603..f992bc25817df47070169b7608bda8f3b9f19710 100644 (file)
@@ -17,7 +17,7 @@
 #include "portab.h"
 #include "io.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.211 2007/07/21 18:46:28 fw Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.212 2007/10/04 15:03:56 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -1449,14 +1449,17 @@ New_Server( int Server )
 } /* New_Server */
 
 
+/**
+ * Initialize connection structure.
+ */
 static void
-Init_Conn_Struct( CONN_ID Idx )
+Init_Conn_Struct(CONN_ID Idx)
 {
-       time_t now = time( NULL );
-       /* Connection-Struktur initialisieren */
+       time_t now = time(NULL);
 
-       memset( &My_Connections[Idx], 0, sizeof ( CONNECTION ));
+       memset(&My_Connections[Idx], 0, sizeof(CONNECTION));
        My_Connections[Idx].sock = -1;
+       My_Connections[Idx].signon = now;
        My_Connections[Idx].lastdata = now;
        My_Connections[Idx].lastprivmsg = now;
        Resolve_Init(&My_Connections[Idx].res_stat);
index 03dcbfd1b75e8dae52acd10d79cc289ef618b435..626a6e9b02a023b433d1def077968704f79920bf 100644 (file)
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn.h,v 1.44 2007/05/09 13:21:11 fw Exp $
+ * $Id: conn.h,v 1.45 2007/10/04 15:03:56 alex Exp $
  *
  * Connection management (header)
  */
@@ -59,6 +59,7 @@ typedef struct _Connection
        char host[HOST_LEN];            /* Hostname */
        array rbuf;                     /* Read buffer */
        array wbuf;                     /* Write buffer */
+       time_t signon;                  /* Signon ("connect") time */
        time_t lastdata;                /* Last activity */
        time_t lastping;                /* Last PING */
        time_t lastprivmsg;             /* Last PRIVMSG */
index f24065a7c1a51acc266af3975fcc01704a976e22..a63e3aa7ad45971b3ff86f9f0c09945e3efe5230 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-info.c,v 1.37 2006/10/07 10:40:52 fw Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.38 2007/10/04 15:03:56 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -707,10 +707,13 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
                if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
        }
 
-       /* Idle (only local clients) */
-       if( Client_Conn( c ) > NONE )
-       {
-               if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
+       /* Idle and signon time (local clients only!) */
+       if (Client_Conn(c) > NONE ) {
+               if (! IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG,
+                       Client_ID(from), Client_ID(c),
+                       (unsigned long)Conn_GetIdle(Client_Conn(c)),
+                       (unsigned long)Conn_GetSignon(Client_Conn(c))))
+                               return DISCONNECTED;
        }
 
        /* Away? */
index f9953201d59d9cd179530593a1dd1fd24c79e768..872a251b221e4e1fdc6cc231aa1ae89a92d2460b 100644 (file)
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: messages.h,v 1.72 2006/12/02 14:24:36 fw Exp $
+ * $Id: messages.h,v 1.73 2007/10/04 15:03:56 alex Exp $
  *
  * IRC numerics (Header)
  */
@@ -55,7 +55,7 @@
 #define RPL_WHOISOPERATOR_MSG          "313 %s %s :is an IRC operator"
 #define RPL_WHOWASUSER_MSG             "314 %s %s %s %s * :%s"
 #define RPL_ENDOFWHO_MSG               "315 %s %s :End of WHO list"
-#define RPL_WHOISIDLE_MSG              "317 %s %s %ld :seconds idle"
+#define RPL_WHOISIDLE_MSG              "317 %s %s %lu %lu :seconds idle, signon time"
 #define RPL_ENDOFWHOIS_MSG             "318 %s %s :End of WHOIS list"
 #define RPL_WHOISCHANNELS_MSG          "319 %s %s :"
 #define RPL_LIST_MSG                   "322 %s %s %ld :%s"