aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-04-22 14:10:39 +0200
committerest31 <MTest31@outlook.com>2015-04-22 14:10:39 +0200
commitccc09abc2d4a712c17de833d52cb5aa91b7bf980 (patch)
tree08b2d18ed3428707ee18f6ac30d8ca788569b9d9 /src
parenteec01bc2fabbefbe0d0c008011592d49f8bbd18e (diff)
downloadminetest-ccc09abc2d4a712c17de833d52cb5aa91b7bf980.tar.gz
minetest-ccc09abc2d4a712c17de833d52cb5aa91b7bf980.tar.bz2
minetest-ccc09abc2d4a712c17de833d52cb5aa91b7bf980.zip
Protocol 25: wstring -> string for custom access denial reasons
Also fix std::logic_error when server::DenyAccess() is used with only two arguments.
Diffstat (limited to 'src')
-rw-r--r--src/network/clientpackethandler.cpp4
-rw-r--r--src/network/serverpackethandler.cpp2
-rw-r--r--src/server.cpp4
-rw-r--r--src/server.h4
4 files changed, 6 insertions, 8 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 68d4245f8..bddf8f6fd 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -149,9 +149,7 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt)
u8 denyCode = SERVER_ACCESSDENIED_UNEXPECTED_DATA;
*pkt >> denyCode;
if (denyCode == SERVER_ACCESSDENIED_CUSTOM_STRING) {
- std::wstring wide_reason;
- *pkt >> wide_reason;
- m_access_denied_reason = wide_to_narrow(wide_reason);
+ *pkt >> m_access_denied_reason;
}
else if (denyCode < SERVER_ACCESSDENIED_MAX) {
m_access_denied_reason = accessDeniedStrings[denyCode];
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 955b1a7dc..6b1d5bc02 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -217,7 +217,7 @@ void Server::handleCommand_Auth(NetworkPacket* pkt)
<< "but it was disallowed for the following reason: "
<< reason << std::endl;
DenyAccess(pkt->getPeerId(), SERVER_ACCESSDENIED_CUSTOM_STRING,
- narrow_to_wide(reason.c_str()));
+ reason.c_str());
return;
}
}
diff --git a/src/server.cpp b/src/server.cpp
index e8fdea7d1..921dd14de 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1490,7 +1490,7 @@ void Server::SendBreath(u16 peer_id, u16 breath)
Send(&pkt);
}
-void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason)
+void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
{
DSTACK(__FUNCTION_NAME);
@@ -2535,7 +2535,7 @@ void Server::RespawnPlayer(u16 peer_id)
}
}
-void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason)
+void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
{
DSTACK(__FUNCTION_NAME);
diff --git a/src/server.h b/src/server.h
index ba993523b..25ffb7fc6 100644
--- a/src/server.h
+++ b/src/server.h
@@ -360,7 +360,7 @@ public:
void peerAdded(con::Peer *peer);
void deletingPeer(con::Peer *peer, bool timeout);
- void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason=NULL);
+ void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type,float* retval);
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
@@ -383,7 +383,7 @@ private:
void SendMovement(u16 peer_id);
void SendHP(u16 peer_id, u8 hp);
void SendBreath(u16 peer_id, u16 breath);
- void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::wstring &custom_reason);
+ void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason);
void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason);
void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target);
void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version);