summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-07-31 10:42:27 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-07-31 10:42:27 +0000
commitcd45782fb74301b3806afa796bb6a6ac104817dd (patch)
tree76dd6c3ffbd64431223812003312981266f09f5c /protocols/SkypeWeb
parent9265ee8085d9733199d0d2407ecd9b4666372b55 (diff)
SkypeWeb: small fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@14764 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp51
-rw-r--r--protocols/SkypeWeb/src/skype_db.h21
-rw-r--r--protocols/SkypeWeb/src/skype_network.cpp17
-rw-r--r--protocols/SkypeWeb/src/skype_timers.cpp17
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.h17
-rw-r--r--protocols/SkypeWeb/src/version.h2
6 files changed, 97 insertions, 28 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 7317a38cac..522e844232 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -272,35 +272,32 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM)
void CSkypeProto::OnChatEvent(const JSONNode &node)
{
- //std::string clientMsgId = node["clientmessageid"].as_string();
- //std::string skypeEditedId = node["skypeeditedid"].as_string();
+ //CMStringA szMessageId = node["clientmessageid"] ? node["clientmessageid"].as_string().c_str() : node["skypeeditedid"].as_string().c_str();
+ CMStringA szConversationName(UrlToSkypename(node["conversationLink"].as_string().c_str()));
+ CMStringA szFromSkypename(UrlToSkypename(node["from"].as_string().c_str()));
- std::string fromLink = node["from"].as_string();
- CMStringA from(UrlToSkypename(fromLink.c_str()));
+ CMString szTopic(node["threadtopic"].as_mstring());
time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str());
- std::string content = node["content"].as_string();
- int emoteOffset = node["skypeemoteoffset"].as_int();
+ std::string strContent = node["content"].as_string();
+ int nEmoteOffset = node["skypeemoteoffset"].as_int();
- std::string conversationLink = node["conversationLink"].as_string();
- CMStringA chatname(UrlToSkypename(conversationLink.c_str()));
-
- CMString topic(node["threadtopic"].as_mstring());
- if (FindChatRoom(chatname) == NULL)
- SendRequest(new GetChatInfoRequest(m_szRegToken, chatname, m_szServer), &CSkypeProto::OnGetChatInfo, topic.Detach());
+
+ if (FindChatRoom(szConversationName) == NULL)
+ SendRequest(new GetChatInfoRequest(m_szRegToken, szConversationName, m_szServer), &CSkypeProto::OnGetChatInfo, szTopic.Detach());
std::string messageType = node["messagetype"].as_string();
- if (!mir_strcmpi(messageType.c_str(), "Text") || !mir_strcmpi(messageType.c_str(), "RichText"))
+ if (messageType == "Text" || messageType == "RichText")
{
- AddMessageToChat(_A2T(chatname), _A2T(from), content.c_str(), emoteOffset != NULL, emoteOffset, timestamp);
+ AddMessageToChat(_A2T(szConversationName), _A2T(szFromSkypename), strContent.c_str(), nEmoteOffset != NULL, nEmoteOffset, timestamp);
}
- else if (!mir_strcmpi(messageType.c_str(), "ThreadActivity/AddMember"))
+ else if (messageType == "ThreadActivity/AddMember")
{
ptrA xinitiator, xtarget, initiator;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("addmember"));
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, _T("addmember"));
if (xml == NULL)
return;
@@ -313,16 +310,16 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
xtarget = mir_t2a(xmlGetText(xmlNode));
CMStringA target = ParseUrl(xtarget, "8:");
- AddChatContact(_A2T(chatname), target, target, L"User");
+ AddChatContact(_A2T(szConversationName), target, target, L"User");
}
xmlDestroyNode(xml);
}
- else if (!mir_strcmpi(messageType.c_str(), "ThreadActivity/DeleteMember"))
+ else if (messageType == "ThreadActivity/DeleteMember")
{
ptrA xinitiator, xtarget;
//content = <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("deletemember"));
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, _T("deletemember"));
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0);
xinitiator = node != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
@@ -337,14 +334,14 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
CMStringA target = ParseUrl(xtarget, "8:");
CMStringA initiator = ParseUrl(xinitiator, "8:");
- RemoveChatContact(_A2T(chatname), target, target, true, initiator);
+ RemoveChatContact(_A2T(szConversationName), target, target, true, initiator);
}
- else if (!mir_strcmpi(messageType.c_str(), "ThreadActivity/TopicUpdate"))
+ else if (messageType.c_str() == "ThreadActivity/TopicUpdate")
{
//content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
ptrA xinitiator, value;
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("topicupdate"));
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, _T("topicupdate"));
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0);
xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
@@ -356,14 +353,14 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
}
CMStringA initiator = ParseUrl(xinitiator, "8:");
- RenameChat(chatname, value);
- ChangeChatTopic(chatname, value, initiator);
+ RenameChat(szConversationName, value);
+ ChangeChatTopic(szConversationName, value, initiator);
}
- else if (!mir_strcmpi(messageType.c_str(), "ThreadActivity/RoleUpdate"))
+ else if (messageType == "ThreadActivity/RoleUpdate")
{
//content=<roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate>
ptrA xinitiator, xId, xRole;
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("roleupdate"));
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT(strContent.c_str())), 0, _T("roleupdate"));
if (xml != NULL) {
HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0);
xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL;
@@ -381,7 +378,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
CMStringA initiator = ParseUrl(xinitiator, "8:");
CMStringA id = ParseUrl(xId, "8:");
- GCDEST gcd = { m_szModuleName, _A2T(chatname), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
+ GCDEST gcd = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
GCEVENT gce = { sizeof(gce), &gcd };
ptrT tszId(mir_a2t(id));
ptrT tszRole(mir_a2t(xRole));
diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h
index 089dde16b9..48a8a86185 100644
--- a/protocols/SkypeWeb/src/skype_db.h
+++ b/protocols/SkypeWeb/src/skype_db.h
@@ -1,3 +1,22 @@
+/*
+Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SKYPE_DB_H_
+#define _SKYPE_DB_H_
enum SKYPE_DB_EVENT_TYPE
{
@@ -13,3 +32,5 @@ enum SKYPE_DB_EVENT_TYPE
#define SKYPE_SETTINGS_ID "Skypename"
#define SKYPE_SETTINGS_PASSWORD "Password"
#define SKYPE_SETTINGS_GROUP "DefaultGroup"
+
+#endif //_SKYPE_DB_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp
index f6f94b91e1..75fa95adfe 100644
--- a/protocols/SkypeWeb/src/skype_network.cpp
+++ b/protocols/SkypeWeb/src/skype_network.cpp
@@ -1,3 +1,20 @@
+/*
+Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#include "stdafx.h"
void CSkypeProto::InitNetwork()
diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp
index ddc72aaa1b..cd25a8165e 100644
--- a/protocols/SkypeWeb/src/skype_timers.cpp
+++ b/protocols/SkypeWeb/src/skype_timers.cpp
@@ -1,3 +1,20 @@
+/*
+Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#include "stdafx.h"
mir_cs CSkypeProto::timerLock;
diff --git a/protocols/SkypeWeb/src/skype_trouter.h b/protocols/SkypeWeb/src/skype_trouter.h
index fc1becacd5..8be933e445 100644
--- a/protocols/SkypeWeb/src/skype_trouter.h
+++ b/protocols/SkypeWeb/src/skype_trouter.h
@@ -1,3 +1,20 @@
+/*
+Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation version 2
+of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
#ifndef _SKYPE_TROUTER_H_
#define _SKYPE_TROUTER_H_
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
index 97ac5d4775..b79da3e3b2 100644
--- a/protocols/SkypeWeb/src/version.h
+++ b/protocols/SkypeWeb/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 12
#define __RELEASE_NUM 2
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>