]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/gameserv.cpp
Added a new config file directive USE_PRIVMSG and implemented a flag system for confi...
[irc/gameservirc.git] / gameserv / gameserv.cpp
index 6a68086e09cc4ec23cf2c13ebcdd3ed8b31c6fd3..923cd5a182266ff90ea93af3c119571060f335ae 100644 (file)
@@ -463,6 +463,22 @@ void notice(const char *source, const char *dest, const char *fmt, ...)
     if (fmt[0] == '\0')
        return;
 
+    char *commanduse;
+    commanduse = new char[16];
+
+    #ifdef P10
+       if (isUsePrivmsg(configflags))
+           strncpy(commanduse, "P", 1);
+       else
+           strncpy(commanduse, "N", 1);
+    #else
+
+       if (isUsePrivmsg(configflags))
+           strncpy(commanduse, "PRIVMSG", 7);
+       else
+           strncpy(commanduse, "NOTICE", 6);
+    #endif
+
     va_list args;
     char *input;
     const char *t = fmt;
@@ -473,9 +489,9 @@ void notice(const char *source, const char *dest, const char *fmt, ...)
        dest++;
 
       #if !defined(P10)
-       sprintf(input, ":%s NOTICE %s :", source, dest);
+       sprintf(input, ":%s %s %s :", source, commanduse, dest);
       #else
-       sprintf(input, "%s O %s :", gsnum, dest);
+       sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
       #endif
 
        dest--;
@@ -483,9 +499,9 @@ void notice(const char *source, const char *dest, const char *fmt, ...)
     else
     {
       #if !defined(P10)
-       sprintf(input, ":%s NOTICE %s :", source, dest);
+       sprintf(input, ":%s %s %s :", source, commanduse, dest);
       #else
-       sprintf(input, "%s O %s :", gsnum, dest);
+       sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
       #endif
     }
 
@@ -513,6 +529,7 @@ void notice(const char *source, const char *dest, const char *fmt, ...)
     #endif
     sprintf(input, "%s%s", input, "\r\n");
     sock_puts(sock, input);
+    delete [] commanduse;
     delete [] input;
 va_end(args);
 }