diff options
-rw-r--r-- | protocols/SkypeWeb/src/requests/capabilities.h | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 11 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 38 |
4 files changed, 57 insertions, 9 deletions
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index 91c0aada93..35d241adc0 100644 --- a/protocols/SkypeWeb/src/requests/capabilities.h +++ b/protocols/SkypeWeb/src/requests/capabilities.h @@ -29,7 +29,8 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- int bitness = 32;
+ short bitness = 32;
+
char compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = SIZEOF(compName);
GetComputerNameA(compName, &size);
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 98b10b9a38..80155e1c88 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -197,6 +197,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (response == NULL)
return;
JSONROOT root(response->pData);
+
if (root == NULL)
return;
@@ -209,6 +210,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || json_size(conversations) >= 99)
PushRequest(new SyncHistoryFirstRequest(syncState, RegToken), &CSkypeProto::OnSyncHistory);
+ bool autoSyncEnabled = getByte("AutoSync", 1);
for (size_t i = 0; i < json_size(conversations); i++)
{
@@ -228,12 +230,14 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (conversationLink != NULL && strstr(conversationLink, "/8:"))
{
- if (!getByte("AutoSync", 1)) continue;
- skypename = ContactUrlToName(conversationLink);
- MCONTACT hContact = AddContact(skypename, true);
+ if (autoSyncEnabled)
+ {
+ skypename = ContactUrlToName(conversationLink);
+ MCONTACT hContact = AddContact(skypename, true);
- if (GetMessageFromDb(hContact, clientMsgId, composeTime) == NULL)
- PushRequest(new GetHistoryRequest(RegToken, skypename, 100, false, 0, Server), &CSkypeProto::OnGetServerHistory);
+ if (GetMessageFromDb(hContact, clientMsgId, composeTime) == NULL)
+ PushRequest(new GetHistoryRequest(RegToken, skypename, 100, false, 0, Server), &CSkypeProto::OnGetServerHistory);
+ }
}
else if (conversationLink != NULL && strstr(conversationLink, "/19:"))
{
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 5333774260..df6a7daf09 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -51,6 +51,15 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
db_set_resident(m_szModuleName, "Status");
+ db_set_resident(m_szModuleName, "Trouter_ccid");
+ db_set_resident(m_szModuleName, "Trouter_connId");
+ db_set_resident(m_szModuleName, "Trouter_instance");
+ db_set_resident(m_szModuleName, "Trouter_socketio");
+ db_set_resident(m_szModuleName, "Trouter_url");
+ db_set_resident(m_szModuleName, "Trouter_st");
+ db_set_resident(m_szModuleName, "Trouter_se");
+ db_set_resident(m_szModuleName, "Trouter_sig");
+ db_set_resident(m_szModuleName, "Trouter_SessId");
// custom event
DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
@@ -79,6 +88,8 @@ CSkypeProto::~CSkypeProto() Netlib_CloseHandle(m_hNetlibUser);
m_hNetlibUser = NULL;
+ if (m_hCallHook)
+ DestroyHookableEvent(m_hCallHook);
if (m_hPopupClassCall)
Popup_UnregisterClass(m_hPopupClassCall);
if (m_hPopupClassNotify)
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index cbf2526e22..a93188e2b3 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -19,15 +19,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
-
+ }
JSONROOT root(response->pData);
+ if (root == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
ptrA ccid(mir_t2a(ptrT(json_as_string(json_get(root, "ccid")))));
ptrA connId(mir_t2a(ptrT(json_as_string(json_get(root, "connId")))));
ptrA instance(mir_t2a(ptrT(json_as_string(json_get(root, "instance")))));
ptrA socketio(mir_t2a(ptrT(json_as_string(json_get(root, "socketio")))));
ptrA url(mir_t2a(ptrT(json_as_string(json_get(root, "url")))));
+
+ if (ccid == NULL || connId == NULL || instance == NULL || socketio == NULL || url == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
setString("Trouter_ccid", ccid);
setString("Trouter_connId", connId);
setString("Trouter_instance", instance);
@@ -40,13 +55,29 @@ void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
+ }
JSONROOT root(response->pData);
+ if (root == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
ptrA st(mir_t2a(ptrT(json_as_string(json_get(root, "st")))));
ptrA se(mir_t2a(ptrT(json_as_string(json_get(root, "se")))));
ptrA sig(mir_t2a(ptrT(json_as_string(json_get(root, "sig")))));
+
+ if (st == NULL || se == NULL || sig == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
setString("Trouter_st", st);
setString("Trouter_se", se);
setString("Trouter_sig", sig);
@@ -66,8 +97,10 @@ void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
-
+ }
bool isHealth = (bool)p;
CMStringA data(response->pData);
@@ -145,7 +178,6 @@ void CSkypeProto::TRouterThread(void*) debugLogA(__FUNCTION__": entering");
int errors = 0;
- isTerminated = false;
ptrA socketIo(getStringA("Trouter_socketio"));
ptrA connId(getStringA("Trouter_connId"));
|