X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/c7340cbda3026cff96c6250c7d35e51a194658f5..91c0b563c77c5e5b271a7e7bcdd7fab60742798e:/gameserv/tcpclient.cpp diff --git a/gameserv/tcpclient.cpp b/gameserv/tcpclient.cpp index db18a67..059907a 100644 --- a/gameserv/tcpclient.cpp +++ b/gameserv/tcpclient.cpp @@ -25,6 +25,9 @@ #include #include +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; }