]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/news.cpp
updated the Change log w/ new additions
[irc/gameservirc.git] / gameserv / news.cpp
index 14933a40225d6e1337595bbd339102e829e16838..9b7c988501872cd899a331ca3bf8928123f8ea9f 100644 (file)
@@ -19,49 +19,49 @@ void loadNews(char *filename, list<string> &news);
 
 void addNews(list<string> &news, const char *fmt, ...)
 {
-    if (fmt[0] == '\0')
-        return;
-
-    va_list args;
-    char *input;
-    input = new char[1024];
-    memset(input, 0, 1024);
-    const char *t = fmt;
-
-    va_start(args, fmt);
-
-    for (; *t; t++)
+  if (fmt[0] == '\0')
+       return;
+  
+  va_list args;
+  char *input;
+  input = new char[1024];
+  memset(input, 0, 1024);
+  const char *t = fmt;
+  
+  va_start(args, fmt);
+  
+  for (; *t; t++)
     {
-        if (*t == '%')
+         if (*t == '%')
         {
-            switch(*++t) {
-                case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break;
-                case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break;
-                case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
-                case 'l':
-                   if (*++t == 'd')
-                          sprintf(input, "%s%ld", input, va_arg(args, long int)); break;
-            }
+                 switch(*++t) {
+                 case 'd': sprintf(input, "%s%d", input, va_arg(args, int)); break;
+                 case 's': sprintf(input, "%s%s", input, va_arg(args, char *)); break;
+                 case 'S': sprintf(input, "%s%s", input, s_GameServ); break;
+                 case 'l':
+                       if (*++t == 'd')
+                         sprintf(input, "%s%ld", input, va_arg(args, long int)); break;
+                 }
         }
-        else
+         else
         {
-            sprintf(input, "%s%c", input, *t);
+                 sprintf(input, "%s%c", input, *t);
         }
-
+         
     }
-    #ifdef DEBUGMODE
-        log("New News Item: %s", input);
-    #endif
-
-    notice(s_GameServ, c_Forest, "News Flash: %s", input);
-    string *nstring;
-    nstring = new string(input);
-    news.push_back(*nstring);
-
-    delete [] input;
-    delete nstring;
-
-va_end(args);
+#ifdef DEBUGMODE
+  log("New News Item: %s", input);
+#endif
+  
+  notice(s_GameServ, c_Forest, "News Flash: %s", input);
+  string *nstring;
+  nstring = new string(input);
+  news.push_back(*nstring);
+  
+  delete [] input;
+  delete nstring;
+  
+  va_end(args);
 }
 
 void showNews(char *nick, list<string> &news)
@@ -100,38 +100,38 @@ void saveNews(char *filename, list<string> &news)
 
 void loadNews(char *filename, list<string> &news)
 {
-    // First clear the old news out
-       news.clear();
-
-    // Now load from the file
-    ifstream infile;
-    infile.open(filename);
-    if (infile.fail())
-         {
-               log("Error opening %s", filename);
-               return;
-         }
-
-    char *buf;
-    string *str;
-    buf = new char [1024];
-       
-    while (infile.getline(buf, 1024, '\n'))
-         {
-               if (buf[0] == '\0' || buf[0] == '\n')
-                 {
-                       delete [] buf;
-                       return;
-                 }
-               str = new string(buf);
-               news.push_back(*str);
-               delete str;
-         }
-       
-    delete [] buf;
+  // First clear the old news out
+  news.clear();
+  
+  // Now load from the file
+  ifstream infile;
+  infile.open(filename);
+  if (infile.fail())
+       {
+         log("Error opening %s", filename);
+         return;
+       }
+  
+  char *buf;
+  string *str;
+  buf = new char [1024];
+  
+  while (infile.getline(buf, 1024, '\n'))
+       {
+         if (buf[0] == '\0' || buf[0] == '\n')
+               {
+                 delete [] buf;
+                 return;
+               }
+         str = new string(buf);
+         news.push_back(*str);
+         delete str;
+       }
+  
+  delete [] buf;
 }
 
 void do_news(char *u)
 {
-    showNews(u, todaysnews);
+  showNews(u, todaysnews);
 }