Refactor Wall_ServerNotice() into more generic Log_ServerNotice()
Log_ServerNotice() sends a messages to all users having a given user mode set.
This commit is contained in:
parent
60eac5e952
commit
51ed742054
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -50,8 +50,6 @@ static char Error_File[FNAME_LEN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void Wall_ServerNotice PARAMS(( char *Msg ));
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Log_Message(int Level, const char *msg)
|
Log_Message(int Level, const char *msg)
|
||||||
{
|
{
|
||||||
|
@ -260,7 +258,7 @@ va_dcl
|
||||||
if (snotice) {
|
if (snotice) {
|
||||||
/* Send NOTICE to all local users with mode +s and to the
|
/* Send NOTICE to all local users with mode +s and to the
|
||||||
* local &SERVER channel */
|
* local &SERVER channel */
|
||||||
Wall_ServerNotice(msg);
|
Log_ServerNotice('s', "%s", msg);
|
||||||
Channel_LogServer(msg);
|
Channel_LogServer(msg);
|
||||||
}
|
}
|
||||||
} /* Log */
|
} /* Log */
|
||||||
|
@ -328,25 +326,41 @@ va_dcl
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send log messages to users flagged with the "s" mode.
|
* Send a log message to all local users flagged with the given user mode.
|
||||||
* @param Msg The message to send.
|
* @param UserMode User mode which the target user must have set,
|
||||||
|
* @param Format The format string.
|
||||||
*/
|
*/
|
||||||
static void
|
#ifdef PROTOTYPES
|
||||||
Wall_ServerNotice( char *Msg )
|
GLOBAL void
|
||||||
|
Log_ServerNotice(const char UserMode, const char *Format, ... )
|
||||||
|
#else
|
||||||
|
GLOBAL void
|
||||||
|
Log_ServerNotice(UserMode, Format, va_alist)
|
||||||
|
const char UserMode;
|
||||||
|
const char *Format;
|
||||||
|
va_dcl
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
CLIENT *c;
|
CLIENT *c;
|
||||||
|
char msg[MAX_LOG_MSG_LEN];
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
assert( Msg != NULL );
|
assert(Format != NULL);
|
||||||
|
|
||||||
c = Client_First( );
|
#ifdef PROTOTYPES
|
||||||
while(c) {
|
va_start(ap, Format);
|
||||||
if (Client_Conn(c) > NONE && Client_HasMode(c, 's'))
|
#else
|
||||||
|
va_start(ap);
|
||||||
|
#endif
|
||||||
|
vsnprintf(msg, MAX_LOG_MSG_LEN, Format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
for(c=Client_First(); c != NULL; c=Client_Next(c)) {
|
||||||
|
if (Client_Conn(c) > NONE && Client_HasMode(c, UserMode))
|
||||||
IRC_WriteStrClient(c, "NOTICE %s :%s%s", Client_ID(c),
|
IRC_WriteStrClient(c, "NOTICE %s :%s%s", Client_ID(c),
|
||||||
NOTICE_TXTPREFIX, Msg);
|
NOTICE_TXTPREFIX, msg);
|
||||||
|
|
||||||
c = Client_Next( c );
|
|
||||||
}
|
}
|
||||||
} /* Wall_ServerNotice */
|
} /* Log_ServerNotice */
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -8,8 +8,6 @@
|
||||||
* (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: log.h,v 1.20 2006/08/05 09:16:21 fw Exp $
|
|
||||||
*
|
|
||||||
* Logging functions (header)
|
* Logging functions (header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,13 +38,14 @@ GLOBAL void Log_Exit PARAMS(( void ));
|
||||||
|
|
||||||
GLOBAL void Log PARAMS(( int Level, const char *Format, ... ));
|
GLOBAL void Log PARAMS(( int Level, const char *Format, ... ));
|
||||||
|
|
||||||
|
GLOBAL void Log_ServerNotice PARAMS((char UserMode, const char *Format, ...));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
|
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
|
||||||
#else
|
#else
|
||||||
static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
|
static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GLOBAL void Log_Init_Resolver PARAMS(( void ));
|
GLOBAL void Log_Init_Resolver PARAMS(( void ));
|
||||||
GLOBAL void Log_Exit_Resolver PARAMS(( void ));
|
GLOBAL void Log_Exit_Resolver PARAMS(( void ));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue