repo: ngircd action: commit revision: path_from: revision_from: d4ed05614712c88d772c8be0201612a00256665c: path_to: revision_to:
commit d4ed05614712c88d772c8be0201612a00256665c Author: Alexander BartonDate: Thu Oct 4 15:03:55 2007 +0000 Numeric 317: implemented "signon time" (displayed in WHOIS result). diff --git a/ChangeLog b/ChangeLog
--- 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 $ diff --git a/src/ngircd/conn-func.c b/src/ngircd/conn-func.c
--- a/src/ngircd/conn-func.c +++ b/src/ngircd/conn-func.c @@ -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@@ -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 ) { diff --git a/src/ngircd/conn-func.h b/src/ngircd/conn-func.h
--- a/src/ngircd/conn-func.h +++ b/src/ngircd/conn-func.h @@ -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 )); diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
--- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -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@@ -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); diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h
--- a/src/ngircd/conn.h
+++ b/src/ngircd/conn.h
@@ -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 */
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
--- a/src/ngircd/irc-info.c +++ b/src/ngircd/irc-info.c @@ -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@@ -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? */ diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
--- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -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"
-----END OF PAGE-----