summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_poll_processing.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-10 16:12:45 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-10 16:12:45 +0000
commitd14143e11ee7c1b504b0210fd054a1e507976574 (patch)
tree316d19b2411e8f07af37aa12e81fac8d0538d3b6 /protocols/SkypeWeb/src/skype_poll_processing.cpp
parenta30fb2e6d49c74ae2cdcf471e4f9abed267186c3 (diff)
Skype: messagging refactoring
git-svn-id: http://svn.miranda-ng.org/main/trunk@12746 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_poll_processing.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_poll_processing.cpp55
1 files changed, 28 insertions, 27 deletions
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp
index 1e8c5d115f..7d59ab5a0e 100644
--- a/protocols/SkypeWeb/src/skype_poll_processing.cpp
+++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp
@@ -24,7 +24,7 @@ void CSkypeProto::ProcessEndpointPresenceRes(JSONNODE *node)
ptrA skypename(ContactUrlToName(selfLink));
if (skypename == NULL)
return;
- MCONTACT hContact = GetContact(skypename);
+ MCONTACT hContact = FindContact(skypename);
//"publicInfo":{"capabilities":"","typ":"11","skypeNameVersion":"0/7.1.0.105//","nodeInfo":"","version":"24"}
JSONNODE *publicInfo = json_get(node, "publicInfo");
@@ -84,7 +84,7 @@ void CSkypeProto::ProcessUserPresenceRes(JSONNODE *node)
}
return;
}
- MCONTACT hContact = GetContact(skypename);
+ MCONTACT hContact = FindContact(skypename);
SetContactStatus(hContact, SkypeToMirandaStatus(status));
}
@@ -99,6 +99,7 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
ptrT composeTime(json_as_string(json_get(node, "composetime")));
ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(node, "conversationLink")))));
time_t timestamp = IsoToUnixTime(composeTime);
+ int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
if (strstr(conversationLink, "/19:"))
{
ptrA chatname(ChatUrlToName(conversationLink));
@@ -129,39 +130,39 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
}
else if (strstr(conversationLink, "/8:"))
{
+ OnPrivateMessageEvent(node);
ptrA skypename(ContactUrlToName(from));
- MCONTACT hContact = GetContact(skypename);
-
- if (hContact == NULL && !IsMe(skypename))
- hContact = AddContact(skypename, true);
-
- if (!mir_strcmpi(messageType, "Control/Typing"))
+
+ if (IsMe(skypename))
{
- CallService(MS_PROTO_CONTACTISTYPING, hContact, 5);
- }
- else if (!mir_strcmpi(messageType, "Control/ClearTyping"))
- {
- CallService(MS_PROTO_CONTACTISTYPING, hContact, 0);
+ MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink)));
+ int hMessage = atoi(clientMsgId);
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)hMessage, 0);
+ debugLogA(__FUNCTION__" timestamp = %d clientmsgid = %s", timestamp, clientMsgId);
+ AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, &content[emoteOffset], emoteOffset);
}
- else if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText"))
+ else
{
- int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
- if (IsMe(skypename))
+ MCONTACT hContact = AddContact(skypename, true);
+ if (!mir_strcmpi(messageType, "Control/Typing"))
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, 5);
+ else if (!mir_strcmpi(messageType, "Control/ClearTyping"))
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, 0);
+ else if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText"))
{
- hContact = GetContact(ptrA(ContactUrlToName(conversationLink)));
- int hMessage = atoi(clientMsgId);
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)hMessage, 0);
+
+ if (IsMe(skypename))
+ {
+
+ }
debugLogA(__FUNCTION__" timestamp = %d clientmsgid = %s", timestamp, clientMsgId);
- AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, &content[emoteOffset], emoteOffset);
- return;
+ OnReceiveMessage(clientMsgId, from, timestamp, content, emoteOffset);
}
- debugLogA(__FUNCTION__" timestamp = %d clientmsgid = %s", timestamp, clientMsgId);
- OnReceiveMessage(clientMsgId, from, timestamp, content, emoteOffset);
}
- else if (!mir_strcmpi(messageType, "Event/SkypeVideoMessage"))
+ /*else if (!mir_strcmpi(messageType, "Event/SkypeVideoMessage"))
{
return; //not supported
- }
+ }*/
}
}
@@ -185,7 +186,7 @@ void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
if (!mir_strcmpi(type, "Message"))
{
ptrA skypename(ContactUrlToName(from));
- MCONTACT hContact = GetContact(skypename);
+ MCONTACT hContact = FindContact(skypename);
if (hContact == NULL && !IsMe(skypename))
hContact = AddContact(skypename, true);
@@ -203,7 +204,7 @@ void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
if (IsMe(skypename))
{
- hContact = GetContact(ptrA(ContactUrlToName(conversationLink)));
+ hContact = FindContact(ptrA(ContactUrlToName(conversationLink)));
int hMessage = atoi(clientMsgId);
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)hMessage, 0);
AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, &content[emoteOffset], emoteOffset);