summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/MinecraftDynmap/MinecraftDynmap.vcxproj5
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp19
-rw-r--r--protocols/MinecraftDynmap/src/communication.cpp34
-rw-r--r--protocols/MinecraftDynmap/src/stdafx.h2
-rw-r--r--protocols/MinecraftDynmap/src/version.h4
5 files changed, 20 insertions, 44 deletions
diff --git a/protocols/MinecraftDynmap/MinecraftDynmap.vcxproj b/protocols/MinecraftDynmap/MinecraftDynmap.vcxproj
index 27d40d44b2..0c77982774 100644
--- a/protocols/MinecraftDynmap/MinecraftDynmap.vcxproj
+++ b/protocols/MinecraftDynmap/MinecraftDynmap.vcxproj
@@ -25,9 +25,4 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
- <ItemGroup>
- <ClCompile Include="..\..\utils\std_string_utils.cpp">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
- </ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index be33afe618..570059bd43 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, const time_t timestamp, bool addtolog)
{
// replace % to %% to not interfere with chat color codes
- std::string smessage = message;
- utils::text::replace_all(&smessage, "%", "%%");
+ CMStringA szMessage(message);
+ szMessage.Replace("%", "%%");
GCEVENT gce = { m_szModuleName, szRoomName, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_UTF8;
gce.time = timestamp;
- gce.pszText.a = smessage.c_str();
+ gce.pszText.a = szMessage.c_str();
if (name == NULL) {
gce.iType = GC_EVENT_INFORMATION;
@@ -56,17 +56,14 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam)
switch(hook->iType) {
case GC_USER_MESSAGE:
{
- std::string text = mir_u2a_cp(hook->ptszText, CP_UTF8);
-
- // replace %% back to %, because chat automatically does this to sent messages
- utils::text::replace_all(&text, "%%", "%");
-
- if (text.empty())
+ CMStringA szText(ptrA(mir_utf8encodeW(hook->ptszText)));
+ szText.Replace("%%", "%");
+ if (szText.IsEmpty())
break;
// Outgoing message
- debugLogA("**Chat - Outgoing message: %s", text.c_str());
- ForkThread(&MinecraftDynmapProto::SendMsgWorker, new std::string(text));
+ debugLogA("**Chat - Outgoing message: %s", szText.c_str());
+ ForkThread(&MinecraftDynmapProto::SendMsgWorker, new std::string(szText));
}
break;
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp
index b1a483c905..b8131f51bf 100644
--- a/protocols/MinecraftDynmap/src/communication.cpp
+++ b/protocols/MinecraftDynmap/src/communication.cpp
@@ -126,31 +126,18 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st
std::string MinecraftDynmapProto::chooseAction(int request_type, std::string *get_data)
{
switch (request_type) {
- case MINECRAFTDYNMAP_REQUEST_MESSAGE: {
+ case MINECRAFTDYNMAP_REQUEST_MESSAGE:
return "/up/sendmessage";
- }
- case MINECRAFTDYNMAP_REQUEST_CONFIGURATION: {
+ case MINECRAFTDYNMAP_REQUEST_CONFIGURATION:
return "/up/configuration";
- }
-
- case MINECRAFTDYNMAP_REQUEST_EVENTS: {
- std::string request = "/up/world/%s/%s";
-
- // Set world
- std::string world = "world"; // TODO: configurable world?
- utils::text::replace_first(&request, "%s", world);
- // Set timestamp
- utils::text::replace_first(&request, "%s", !m_timestamp.empty() ? m_timestamp : "0");
-
- return request;
- }
+ case MINECRAFTDYNMAP_REQUEST_EVENTS:
+ return std::string("/up/world/world/") + (!m_timestamp.empty() ? m_timestamp : "0");
//case MINECRAFTDYNMAP_REQUEST_HOME:
- default: {
+ default:
return "/" + *get_data;
- }
}
}
@@ -285,7 +272,7 @@ bool MinecraftDynmapProto::doEvents()
continue;
}
- time_t timestamp = utils::time::from_string(time_.as_string());
+ time_t timestamp = atoi(time_.as_string().c_str());
std::string name = playerName_.as_string();
std::string message = message_.as_string();
@@ -448,12 +435,11 @@ void MinecraftDynmapProto::SendMsgWorker(void *p)
ScopedLock s(send_message_lock_);
- std::string data = *(std::string*)p;
+ CMStringA data = ((std::string*)p)->c_str();
delete (std::string*)p;
- data = utils::text::trim(data);
+ data.TrimRight();
- if (isOnline() && data.length()) {
- doSendMessage(data);
- }
+ if (isOnline() && data.GetLength())
+ doSendMessage(data.c_str());
}
diff --git a/protocols/MinecraftDynmap/src/stdafx.h b/protocols/MinecraftDynmap/src/stdafx.h
index 18db9b6038..c8714c4408 100644
--- a/protocols/MinecraftDynmap/src/stdafx.h
+++ b/protocols/MinecraftDynmap/src/stdafx.h
@@ -62,8 +62,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class MinecraftDynmapProto;
-#include "../../utils/std_string_utils.h"
-
#include "utils.h"
#include "proto.h"
#include "constants.h"
diff --git a/protocols/MinecraftDynmap/src/version.h b/protocols/MinecraftDynmap/src/version.h
index aefa08a11b..b270b99552 100644
--- a/protocols/MinecraftDynmap/src/version.h
+++ b/protocols/MinecraftDynmap/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
+#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>