summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2010-03-03 23:38:18 +0100
committerBertram <bertram@cegetel.net>2010-03-03 23:38:18 +0100
commit1e52781e7d425cffcc6a5319b4cb5bf5eebe2ea9 (patch)
tree596305e9bfd4ad8448efd477a43f86490b1974c5 /src/net
parent8cc31b582f372238ce6bd2c86888d312cf1fe5b2 (diff)
parentf5f7a7d5990d1133f714b6cd431aecf6a332fbd5 (diff)
downloadmana-1e52781e7d425cffcc6a5319b4cb5bf5eebe2ea9.tar.gz
mana-1e52781e7d425cffcc6a5319b4cb5bf5eebe2ea9.tar.bz2
mana-1e52781e7d425cffcc6a5319b4cb5bf5eebe2ea9.tar.xz
mana-1e52781e7d425cffcc6a5319b4cb5bf5eebe2ea9.zip
Merge branch 'master' of gitorious.org:mana/mana
Diffstat (limited to 'src/net')
-rw-r--r--src/net/download.cpp11
-rw-r--r--src/net/ea/generalhandler.cpp3
-rw-r--r--src/net/ea/generalhandler.h1
-rw-r--r--src/net/ea/messageout.cpp2
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/network.h2
-rw-r--r--src/net/ea/npchandler.cpp2
-rw-r--r--src/net/guildhandler.h6
-rw-r--r--src/net/manaserv/guildhandler.h2
-rw-r--r--src/net/manaserv/messageout.cpp2
-rw-r--r--src/net/serverinfo.h13
11 files changed, 33 insertions, 13 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index ba5b6b35..2b96a6b9 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -20,9 +20,12 @@
#include "net/download.h"
+#include "configuration.h"
#include "log.h"
#include "main.h"
+#include "utils/stringutils.h"
+
#include <curl/curl.h>
#include <SDL.h>
@@ -217,11 +220,9 @@ int Download::downloadThread(void *ptr)
curl_easy_setopt(d->mCurl, CURLOPT_WRITEDATA, file);
}
-#ifdef PACKAGE_VERSION
- curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana/" PACKAGE_VERSION);
-#else
- curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana");
-#endif
+ curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT,
+ strprintf(PACKAGE_EXTENDED_VERSION, branding
+ .getValue("appShort", "mana").c_str()).c_str());
curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError);
curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str());
curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0);
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp
index 6ca853fb..021ae08d 100644
--- a/src/net/ea/generalhandler.cpp
+++ b/src/net/ea/generalhandler.cpp
@@ -38,6 +38,7 @@
#include "net/ea/chathandler.h"
#include "net/ea/charserverhandler.h"
#include "net/ea/gamehandler.h"
+#include "net/ea/guildhandler.h"
#include "net/ea/inventoryhandler.h"
#include "net/ea/itemhandler.h"
#include "net/ea/loginhandler.h"
@@ -79,6 +80,7 @@ GeneralHandler::GeneralHandler():
mCharHandler(new CharServerHandler),
mChatHandler(new ChatHandler),
mGameHandler(new GameHandler),
+ mGuildHandler(new GuildHandler),
mInventoryHandler(new InventoryHandler),
mItemHandler(new ItemHandler),
mLoginHandler(new LoginHandler),
@@ -162,6 +164,7 @@ void GeneralHandler::load()
mNetwork->registerHandler(mChatHandler.get());
mNetwork->registerHandler(mCharHandler.get());
mNetwork->registerHandler(mGameHandler.get());
+ mNetwork->registerHandler(mGuildHandler.get());
mNetwork->registerHandler(mInventoryHandler.get());
mNetwork->registerHandler(mItemHandler.get());
mNetwork->registerHandler(mLoginHandler.get());
diff --git a/src/net/ea/generalhandler.h b/src/net/ea/generalhandler.h
index 579b27b5..464f8bc8 100644
--- a/src/net/ea/generalhandler.h
+++ b/src/net/ea/generalhandler.h
@@ -60,6 +60,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler
MessageHandlerPtr mCharHandler;
MessageHandlerPtr mChatHandler;
MessageHandlerPtr mGameHandler;
+ MessageHandlerPtr mGuildHandler;
MessageHandlerPtr mInventoryHandler;
MessageHandlerPtr mItemHandler;
MessageHandlerPtr mLoginHandler;
diff --git a/src/net/ea/messageout.cpp b/src/net/ea/messageout.cpp
index 9e7f2b15..844580a9 100644
--- a/src/net/ea/messageout.cpp
+++ b/src/net/ea/messageout.cpp
@@ -125,4 +125,4 @@ void MessageOut::writeCoordinates(unsigned short x, unsigned short y,
data[2] |= direction;
}
-}
+} // namespace EAthena
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 3b8ad509..0467241f 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -475,4 +475,4 @@ Uint16 Network::readWord(int pos)
#endif
}
-}
+} // namespace EAthena
diff --git a/src/net/ea/network.h b/src/net/ea/network.h
index baaefb4a..0b391bf0 100644
--- a/src/net/ea/network.h
+++ b/src/net/ea/network.h
@@ -125,6 +125,6 @@ class Network
static Network *mInstance;
};
-}
+} // namespace EAthena
#endif // NET_EA_NETWORK_H
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index 06a39045..dfd56cf1 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -72,10 +72,12 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
if (msg.getId() == SMSG_NPC_CLOSE)
{
closeDialog(npcId);
+ return;
}
else if (msg.getId() == SMSG_NPC_NEXT)
{
nextDialog(npcId);
+ return;
}
else
{
diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h
index 75683944..1696b2d5 100644
--- a/src/net/guildhandler.h
+++ b/src/net/guildhandler.h
@@ -32,6 +32,10 @@ namespace Net {
class GuildHandler
{
public:
+ virtual ~GuildHandler() {}
+
+ virtual bool isSupported() { return false; }
+
virtual void create(const std::string &name) = 0;
virtual void invite(int guildId, const std::string &name) = 0;
@@ -56,8 +60,6 @@ class GuildHandler
bool response) = 0;
virtual void endAlliance(int guildId, int otherGuildId) = 0;
-
- virtual ~GuildHandler() {}
};
}
diff --git a/src/net/manaserv/guildhandler.h b/src/net/manaserv/guildhandler.h
index 1b6d51b5..9929d135 100644
--- a/src/net/manaserv/guildhandler.h
+++ b/src/net/manaserv/guildhandler.h
@@ -33,6 +33,8 @@ class GuildHandler : public Net::GuildHandler, public MessageHandler
public:
GuildHandler();
+ bool isSupported() { return true; }
+
void handleMessage(Net::MessageIn &msg);
void create(const std::string &name);
diff --git a/src/net/manaserv/messageout.cpp b/src/net/manaserv/messageout.cpp
index 887d91d6..8779c5f6 100644
--- a/src/net/manaserv/messageout.cpp
+++ b/src/net/manaserv/messageout.cpp
@@ -61,4 +61,4 @@ void MessageOut::writeInt32(Sint32 value)
mPos += 4;
}
-}
+} // namespace ManaServ
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index ae06984b..63d50ce4 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -41,10 +41,13 @@ public:
std::string hostname;
unsigned short port;
+ bool save;
+
ServerInfo()
{
type = UNKNOWN;
port = 0;
+ save = false;
}
ServerInfo(const ServerInfo &info)
@@ -53,6 +56,12 @@ public:
name = info.name;
hostname = info.hostname;
port = info.port;
+ save = info.save;
+ }
+
+ bool isValid() const
+ {
+ return !(hostname.empty() || port == 0 || type == UNKNOWN);
}
void clear()
@@ -63,13 +72,13 @@ public:
port = 0;
}
- bool operator==(const ServerInfo &other)
+ bool operator==(const ServerInfo &other) const
{
return (type == other.type && hostname == other.hostname &&
port == other.port);
}
- bool operator!=(const ServerInfo &other)
+ bool operator!=(const ServerInfo &other) const
{
return (type != other.type || hostname != other.hostname ||
port != other.port);