1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/*
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 "common.h"
void CSkypeProto::ProcessEndpointPresenceRes(JSONNODE *node)
{
debugLogA("CSkypeProto::ProcessEndpointPresenceRes");
ptrA selfLink(mir_t2a(ptrT(json_as_string(json_get(node, "selfLink")))));
ptrA skypename(ContactUrlToName(selfLink));
if (skypename == NULL)
return;
MCONTACT hContact = FindContact(skypename);
//"publicInfo":{"capabilities":"","typ":"11","skypeNameVersion":"0/7.1.0.105//","nodeInfo":"","version":"24"}
JSONNODE *publicInfo = json_get(node, "publicInfo");
if (publicInfo != NULL)
{
ptrA skypeNameVersion(mir_t2a(ptrT(json_as_string(json_get(publicInfo, "skypeNameVersion")))));
ptrA version(mir_t2a(ptrT(json_as_string(json_get(publicInfo, "version")))));
ptrA typ(mir_t2a(ptrT(json_as_string(json_get(publicInfo, "typ")))));
if (typ != NULL)
{
int iTyp = atoi(typ);
CMStringA MirVer = "";
switch (iTyp)
{
case 17:
MirVer.Append("Skype (Android)");
break;
case 16:
MirVer.Append("Skype (iOS)");
break;
case 12:
MirVer.Append("Skype (WinRT)");
break;
case 15:
MirVer.Append("Skype (WP)");
break;
case 13:
MirVer.Append("Skype (OSX)");
break;
case 11:
MirVer.Append("Skype (Windows)");
break;
case 14:
MirVer.Append("Skype (Linux)");
break;
case 10:
MirVer.Append("Skype (XBOX)");
break;
case 1:
MirVer.Append("Skype (Web)");
break;
case 125:
MirVer.AppendFormat("%s %s", skypeNameVersion, version);
break;
}
db_set_s(hContact, m_szModuleName, "MirVer", MirVer);
}
}
}
void CSkypeProto::ProcessUserPresenceRes(JSONNODE *node)
{
debugLogA("CSkypeProto::ProcessUserPresenceRes");
ptrA selfLink(mir_t2a(ptrT(json_as_string(json_get(node, "selfLink")))));
ptrA status(mir_t2a(ptrT(json_as_string(json_get(node, "status")))));
ptrA skypename(ContactUrlToName(selfLink));
if (skypename == NULL)
{
if (IsMe(ptrA(SelfUrlToName(selfLink))))
{
int iNewStatus = SkypeToMirandaStatus(status);
int old_status = m_iStatus;
m_iDesiredStatus = iNewStatus;
m_iStatus = iNewStatus;
if (old_status != iNewStatus)
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, iNewStatus);
return;
}
return;
}
MCONTACT hContact = FindContact(skypename);
SetContactStatus(hContact, SkypeToMirandaStatus(status));
}
void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
{
debugLogA("CSkypeProto::ProcessNewMessageRes");
ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(node, "conversationLink")))));
if (strstr(conversationLink, "/8:"))
OnPrivateMessageEvent(node);
else if (strstr(conversationLink, "/19:"))
OnChatEvent(node);
}
void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
{
return; //it should be rewritten
}
void CSkypeProto::ProcessThreadUpdateRes(JSONNODE *node)
{
return;
}
|