]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/log.c
new Function: LogDebug()
[ngircd.git] / src / ngircd / log.c
index e00c7ce7eff94c4aa6ad6b039728de869e87beda..396555ee73555e84fb58e4d85b7a779b450ca3b9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
  *
  * 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
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: log.c,v 1.58 2005/07/31 20:13:08 alex Exp $";
+static char UNUSED id[] = "$Id: log.c,v 1.60 2006/02/08 17:33:28 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -162,6 +162,35 @@ Log_Exit( void )
 } /* Log_Exit */
 
 
+# ifdef PROTOTYPES
+GLOBAL void
+LogDebug( const char *Format, ... )
+# else
+GLOBAL void
+LogDebug( Format, va_alist )
+const char *Format;
+va_dcl
+# endif
+#ifdef DEBUG
+{
+       char msg[MAX_LOG_MSG_LEN];
+       va_list ap;
+
+       if (!NGIRCd_Debug) return;
+#ifdef PROTOTYPES
+       va_start( ap, Format );
+#else
+       va_start( ap );
+#endif
+       vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
+       va_end( ap );
+       Log(LOG_DEBUG, "%s", msg);
+}
+#else
+{ /* do nothing */ }
+#endif /* DEBUG */
+
+       
 #ifdef PROTOTYPES
 GLOBAL void
 Log( int Level, const char *Format, ... )
@@ -174,7 +203,6 @@ va_dcl
 #endif
 {
        /* Eintrag in Logfile(s) schreiben */
-
        char msg[MAX_LOG_MSG_LEN];
        bool snotice;
        va_list ap;
@@ -302,19 +330,23 @@ va_dcl
 } /* Log_Resolver */
 
 
+/**
+ * Send log messages to users flagged with the "s" mode.
+ * @param Msg The message to send.
+ */
 static void
 Wall_ServerNotice( char *Msg )
 {
-       /* Server-Notice an entsprechende User verschicken */
-
        CLIENT *c;
 
        assert( Msg != NULL );
 
        c = Client_First( );
-       while( c )
-       {
-               if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s%s", Client_ThisServer( ), NOTICE_TXTPREFIX, Msg );
+       while(c) {
+               if (Client_Conn(c) > NONE && Client_HasMode(c, 's'))
+                       IRC_WriteStrClient(c, "NOTICE %s :%s%s", Client_ID(c),
+                                                       NOTICE_TXTPREFIX, Msg);
+
                c = Client_Next( c );
        }
 } /* Wall_ServerNotice */