Numeric 317: implemented "signon time" (displayed in WHOIS result).

This commit is contained in:
Alexander Barton 2007-10-04 15:03:55 +00:00
parent 9021ea2070
commit d4ed056147
7 changed files with 35 additions and 16 deletions

View File

@ -12,6 +12,7 @@
ngIRCd HEAD ngIRCd HEAD
- Numeric 317: implemented "signon time" (displayed in WHOIS result).
- Fixed code that prevented GCC 2.95 to compile ngIRCd. - Fixed code that prevented GCC 2.95 to compile ngIRCd.
- Adjust path names in manual pages according to "./configure" settings. - Adjust path names in manual pages according to "./configure" settings.
- Added new server configuration option "Passive" for "Server" blocks to - 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 $

View File

@ -16,7 +16,7 @@
#include "portab.h" #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 "imp.h"
#include <assert.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 GLOBAL time_t
Conn_GetIdle( CONN_ID Idx ) Conn_GetIdle( CONN_ID Idx )
{ {

View File

@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * 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) * Connection management: Global functions (header)
*/ */
@ -27,6 +27,7 @@
GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx )); 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_GetIdle PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));

View File

@ -17,7 +17,7 @@
#include "portab.h" #include "portab.h"
#include "io.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 "imp.h"
#include <assert.h> #include <assert.h>
@ -1449,14 +1449,17 @@ New_Server( int Server )
} /* New_Server */ } /* New_Server */
/**
* Initialize connection structure.
*/
static void static void
Init_Conn_Struct( CONN_ID Idx ) Init_Conn_Struct(CONN_ID Idx)
{ {
time_t now = time( NULL ); time_t now = time(NULL);
/* Connection-Struktur initialisieren */
memset( &My_Connections[Idx], 0, sizeof ( CONNECTION )); memset(&My_Connections[Idx], 0, sizeof(CONNECTION));
My_Connections[Idx].sock = -1; My_Connections[Idx].sock = -1;
My_Connections[Idx].signon = now;
My_Connections[Idx].lastdata = now; My_Connections[Idx].lastdata = now;
My_Connections[Idx].lastprivmsg = now; My_Connections[Idx].lastprivmsg = now;
Resolve_Init(&My_Connections[Idx].res_stat); Resolve_Init(&My_Connections[Idx].res_stat);

View File

@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * 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) * Connection management (header)
*/ */
@ -59,6 +59,7 @@ typedef struct _Connection
char host[HOST_LEN]; /* Hostname */ char host[HOST_LEN]; /* Hostname */
array rbuf; /* Read buffer */ array rbuf; /* Read buffer */
array wbuf; /* Write buffer */ array wbuf; /* Write buffer */
time_t signon; /* Signon ("connect") time */
time_t lastdata; /* Last activity */ time_t lastdata; /* Last activity */
time_t lastping; /* Last PING */ time_t lastping; /* Last PING */
time_t lastprivmsg; /* Last PRIVMSG */ time_t lastprivmsg; /* Last PRIVMSG */

View File

@ -14,7 +14,7 @@
#include "portab.h" #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 "imp.h"
#include <assert.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; if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
} }
/* Idle (only local clients) */ /* Idle and signon time (local clients only!) */
if( Client_Conn( c ) > NONE ) if (Client_Conn(c) > NONE ) {
{ if (! IRC_WriteStrClient(from, RPL_WHOISIDLE_MSG,
if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED; Client_ID(from), Client_ID(c),
(unsigned long)Conn_GetIdle(Client_Conn(c)),
(unsigned long)Conn_GetSignon(Client_Conn(c))))
return DISCONNECTED;
} }
/* Away? */ /* Away? */

View File

@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * 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) * IRC numerics (Header)
*/ */
@ -55,7 +55,7 @@
#define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator" #define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator"
#define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s" #define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s"
#define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list" #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_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
#define RPL_WHOISCHANNELS_MSG "319 %s %s :" #define RPL_WHOISCHANNELS_MSG "319 %s %s :"
#define RPL_LIST_MSG "322 %s %s %ld :%s" #define RPL_LIST_MSG "322 %s %s %ld :%s"