diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-22 22:51:13 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-22 22:51:13 +0300 |
commit | e0ed434b759f834663074962899ff72a890b62d5 (patch) | |
tree | ec00cea38006e51e9e4bbfc1d98567913dd84b7a /protocols/SkypeWeb | |
parent | f16237c82e336d857d73609015157732c97a2529 (diff) |
SkypeWeb:
- fixes #1849 (SkypeWeb duplicates some outgoing messages in history);
- fixes speading Skype contacts to a group on the first run;
- unused data removed;
- version bump
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/SkypeWeb.vcxproj | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 50 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/version.h | 2 |
6 files changed, 17 insertions, 51 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj index 2c38d7a301..a9be1cb561 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj @@ -26,7 +26,6 @@ <Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
<ItemGroup>
- <ClInclude Include="res\Icons\*" />
<ClInclude Include="src\requests\avatars.h" />
<ClInclude Include="src\requests\capabilities.h" />
<ClInclude Include="src\requests\chatrooms.h" />
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 1236756b3e..a95cf6a191 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -333,7 +333,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) }
}
-void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszMessage)
+void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t *tszMessage)
{
if (!IsOnline())
return;
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 863d09171d..7ed1b5991d 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -76,10 +76,9 @@ MCONTACT CSkypeProto::AddContact(const char *skypename, bool isTemporary) setString(hContact, SKYPE_SETTINGS_ID, skypename);
- DBVARIANT dbv;
- if (!getWString(SKYPE_SETTINGS_GROUP, &dbv)) {
- db_set_ws(hContact, "CList", "Group", dbv.pwszVal);
- db_free(&dbv);
+ if (m_opts.wstrCListGroup) {
+ Clist_GroupCreate(0, m_opts.wstrCListGroup);
+ db_set_ws(hContact, "CList", "Group", m_opts.wstrCListGroup);
}
setByte(hContact, "Auth", 1);
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 67c289321e..15ab266d30 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -38,7 +38,7 @@ int CSkypeProto::OnReceiveMessage(MCONTACT hContact, const char *szContent, cons struct SendMessageParam
{
MCONTACT hContact;
- LONGLONG hMessage;
+ DWORD hMessage;
};
// outcoming message flow
@@ -51,7 +51,8 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
- param->hMessage = time(0);
+ Utils_GetRandom(¶m->hMessage, sizeof(param->hMessage));
+ param->hMessage &= ~0x80000000;
ptrA username(getStringA(hContact, "Skypename"));
@@ -75,31 +76,14 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) delete param;
if (response != nullptr) {
- if (response->resultCode == 201) {
- if (m_OutMessages.getIndex(hMessage) != -1) {
- if (response->pData != nullptr) {
- JSONNode jRoot = JSONNode::parse(response->pData);
- if (m_mpOutMessages.find(hMessage) == m_mpOutMessages.end()) {
- m_mpOutMessages[hMessage] = std::stoull(jRoot["OriginalArrivalTime"].as_string()) / 1000;
- }
- }
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0);
- {
- mir_cslock lck(m_lckOutMessagesList);
- m_OutMessages.remove(hMessage);
- }
- }
- }
- else {
+ if (response->resultCode != 201) {
std::string strError = Translate("Unknown error!");
if (response->pData != nullptr) {
JSONNode jRoot = JSONNode::parse(response->pData);
const JSONNode &jErr = jRoot["errorCode"];
-
- if (jErr) {
+ if (jErr)
strError = jErr.as_string();
- }
}
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, _A2T(strError.c_str()));
@@ -108,7 +92,7 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) else ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)TranslateT("Network error!"));
}
-// preparing message/action to writing into db
+// preparing message/action to be written into db
int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
{
MessageWindowEvent *evt = (MessageWindowEvent*)lParam;
@@ -121,18 +105,6 @@ int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam) memmove(evt->dbei->pBlob, &evt->dbei->pBlob[4], evt->dbei->cbBlob);
evt->dbei->eventType = SKYPE_DB_EVENT_TYPE_ACTION;
}
-
- CMStringA messageId(FORMAT, "%d", evt->seq);
- evt->dbei->pBlob = (PBYTE)mir_realloc(evt->dbei->pBlob, evt->dbei->cbBlob + messageId.GetLength());
- memcpy(&evt->dbei->pBlob[evt->dbei->cbBlob], messageId, messageId.GetLength());
- evt->dbei->cbBlob += messageId.GetLength();
-
- auto it = m_mpOutMessages.find((HANDLE)evt->seq);
- if (it != m_mpOutMessages.end()) {
- evt->dbei->timestamp = it->second;
- m_mpOutMessages.erase(it);
- }
-
return 0;
}
@@ -166,12 +138,8 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) }
else if (strMessageType == "Text" || strMessageType == "RichText") {
if (IsMe(szFromSkypename)) {
- HANDLE hMessage = (HANDLE)(std::stoull(szMessageId.GetString()));
+ HANDLE hMessage = (HANDLE)atoi(szMessageId);
if (m_OutMessages.getIndex(hMessage) != -1) {
- auto it = m_mpOutMessages.find(hMessage);
- if (it == m_mpOutMessages.end()) {
- m_mpOutMessages[hMessage] = timestamp;
- }
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, (LPARAM)szMessageId.c_str());
{
mir_cslock lck(m_lckOutMessagesList);
@@ -248,8 +216,10 @@ void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const return;
int nCount = 0;
- for (auto *it : TiXmlEnum(xmlNode))
+ for (auto *it : TiXmlEnum(xmlNode)) {
+ UNREFERENCED_PARAMETER(it);
nCount++;
+ }
PROTOSEARCHRESULT **psr = (PROTOSEARCHRESULT**)mir_calloc(sizeof(PROTOSEARCHRESULT*) * nCount);
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 6137f1c399..043cd49db2 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -127,8 +127,6 @@ private: bool m_bHistorySynced;
- std::map<HANDLE, time_t> m_mpOutMessages;
-
std::map<std::string, std::string> cookies;
static std::map<std::wstring, std::wstring> languages;
@@ -139,11 +137,11 @@ private: LIST<void> m_PopupClasses;
LIST<void> m_OutMessages;
- //dialogs
+ // dialogs
LIST<CSkypeInviteDlg> m_InviteDialogs;
LIST<CSkypeGCCreateDlg> m_GCCreateDialogs;
- //locks
+ // locks
mir_cs m_lckOutMessagesList;
mir_cs m_InviteDialogsLock;
mir_cs m_GCCreateDialogsLock;
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h index 81bd4d2567..4f751ca9a7 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 3
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|