summaryrefslogtreecommitdiff
path: root/src/accounthandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2006-01-05 22:31:06 +0000
committerYohann Ferreira <bertram@cegetel.net>2006-01-05 22:31:06 +0000
commitac150f3543caf86fd071c73f53373b4ea243fa24 (patch)
treefe9153f45c42d07e32fe20b5dfcb8a0baf448273 /src/accounthandler.cpp
parent48375c7ea578313a0b578078eadada2e3744b363 (diff)
downloadmanaserv-ac150f3543caf86fd071c73f53373b4ea243fa24.tar.gz
manaserv-ac150f3543caf86fd071c73f53373b4ea243fa24.tar.bz2
manaserv-ac150f3543caf86fd071c73f53373b4ea243fa24.tar.xz
manaserv-ac150f3543caf86fd071c73f53373b4ea243fa24.zip
Added a standard version check.
Diffstat (limited to 'src/accounthandler.cpp')
-rw-r--r--src/accounthandler.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/accounthandler.cpp b/src/accounthandler.cpp
index 7632fdcc..a8b02a92 100644
--- a/src/accounthandler.cpp
+++ b/src/accounthandler.cpp
@@ -60,12 +60,24 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message)
{
case CMSG_LOGIN:
{
+ std::string clientVersion = message.readString();
std::string username = message.readString();
std::string password = message.readString();
LOG_INFO(username << " is trying to login.", 1)
result.writeShort(SMSG_LOGIN_RESPONSE);
+#ifdef PACKAGE_VERSION
+ if (clientVersion <= PACKAGE_VERSION)
+#else
+ if (clientVersion <= DEFAULT_PACKAGE_VERSION)
+#endif
+ {
+ LOG_INFO("Client has an unsufficient version number to login.", 1)
+ result.writeByte(LOGIN_INVALID_VERSION);
+ break;
+ }
+
if (computer.getAccount().get() != NULL) {
LOG_INFO("Already logged in as " << computer.getAccount()->getName()
<< ".", 1)
@@ -153,11 +165,23 @@ void AccountHandler::receiveMessage(NetComputer &computer, MessageIn &message)
case CMSG_REGISTER:
{
+ std::string clientVersion = message.readString();
std::string username = message.readString();
std::string password = message.readString();
std::string email = message.readString();
result.writeShort(SMSG_REGISTER_RESPONSE);
+#ifdef PACKAGE_VERSION
+ if (clientVersion <= PACKAGE_VERSION)
+#else
+ if (clientVersion <= DEFAULT_PACKAGE_VERSION)
+#endif
+ {
+ LOG_INFO("Client has an unsufficient version number to login.", 1)
+ result.writeByte(REGISTER_INVALID_VERSION);
+ break;
+ }
+
// Checking if the Name is slang's free.
if (!slangsFilter->filterContent(username))
{