]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/tcpclient.cpp
Fixed a declaration error for VERSION/PACKAGE.
[irc/gameservirc.git] / gameserv / tcpclient.cpp
index db18a67586a6860b40a72d84cda7ad3053784094..059907adef6d412975d62d5501892b1b0053dafc 100644 (file)
@@ -25,6 +25,9 @@
 #include <iomanip.h>
 #include <stdlib.h>
 
+char *PACKAGE = "GameServ";
+char *VERSION = "1.1.2";
+
 int sock;
 long timestamp;
 
@@ -66,8 +69,8 @@ int main(int argc, char *argv[])
        raw("PROTOCTL NICKv2 VHP");
        raw("PASS :%s", remotepass);
        raw("SERVER %s 1 :%s", servername, servername);
-       raw("NICK %S 1 %d %S %s %s %d +owghraAxNt %s :GameServ", time(NULL), gshost, 
-               servername, time(NULL), gshost);
+       raw("NICK %S 1 %d %S %s %s %d +owghraAxNt %s :%s v%s", time(NULL), gshost, 
+               servername, time(NULL), gshost, PACKAGE, VERSION);
        raw(":%S JOIN %s", c_Forest);
        raw(":%S MODE %s +mtn", c_Forest);
 #elif defined(BAHAMUT)
@@ -90,6 +93,8 @@ int main(int argc, char *argv[])
   init_masters();
   load_gs_dbase();
   load_timestamp();
+  int loadtime = time(NULL);
+  bool loaded = false;
 
   while (connected) {
       if (sock_gets(sock,buffer,sizeof(buffer)) == -1) {
@@ -106,6 +111,14 @@ int main(int argc, char *argv[])
            cmd = strtok(buf, " ");
 
        cout << "Server: " << buffer << endl << flush;
+
+       // Wait five seconds then we're loaded.
+        if (!loaded)
+       {
+           if (time(NULL) >= 5 + loadtime)
+               loaded = true;
+       }
+
        if (stricmp(cmd, "PING") == 0) {
            char *timestamp;
            timestamp = strtok(NULL, "");
@@ -127,6 +140,9 @@ int main(int argc, char *argv[])
                aClient *newuser;
                nick = strtok(NULL, " ");
                newuser = new aClient(nick);
+               if (loaded)
+                   notice(s_GameServ, nick, "Hello, %s! This network utilizes a services package called GameServ. For info on how to play the game, type /msg %S help.");
+
                clients.insertAtBack(newuser);
                delete newuser;
            }
@@ -250,8 +266,8 @@ void load_timestamp()
 
     if (infile.fail())
     {
-       cerr << "Error opening .gstimestamp" << endl;
-       cerr << "Generating new timestamp" << endl;
+       cout << "Error opening .gstimestamp" << endl;
+       cout << "Generating new timestamp" << endl;
        generate:
        timestamp = midnight();
         save_timestamp();
@@ -272,7 +288,7 @@ void save_timestamp()
 
     if (outfile.fail())
     {
-       cerr << "Error creating new file." << endl;
+       cout << "Error creating new file." << endl;
        return;
     }