From 75beae890b1f18d5753748f4935731ed93579ef8 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 10 May 2015 13:21:25 +0000 Subject: flags fix cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@13506 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/http_request.h | 2 +- protocols/SkypeWeb/src/main.cpp | 8 +- protocols/SkypeWeb/src/request_queue.cpp | 4 +- protocols/SkypeWeb/src/request_queue.h | 2 +- protocols/SkypeWeb/src/requests/capabilities.h | 28 ++-- protocols/SkypeWeb/src/requests/chatrooms.h | 4 +- protocols/SkypeWeb/src/requests/endpoint.h | 2 +- protocols/SkypeWeb/src/requests/history.h | 4 +- protocols/SkypeWeb/src/requests/messages.h | 4 +- protocols/SkypeWeb/src/requests/poll.h | 2 +- protocols/SkypeWeb/src/requests/search.h | 6 +- protocols/SkypeWeb/src/requests/subscriptions.h | 6 +- protocols/SkypeWeb/src/requests/trouter.h | 34 ++--- protocols/SkypeWeb/src/skype_avatars.cpp | 2 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 156 ++++++++++----------- protocols/SkypeWeb/src/skype_contacts.cpp | 10 +- protocols/SkypeWeb/src/skype_db.cpp | 6 +- protocols/SkypeWeb/src/skype_dialogs.h | 6 +- protocols/SkypeWeb/src/skype_events.cpp | 42 +++--- protocols/SkypeWeb/src/skype_history_sync.cpp | 24 ++-- protocols/SkypeWeb/src/skype_icons.cpp | 18 +-- protocols/SkypeWeb/src/skype_login.cpp | 4 +- protocols/SkypeWeb/src/skype_menus.cpp | 6 +- protocols/SkypeWeb/src/skype_menus.h | 2 +- protocols/SkypeWeb/src/skype_messages.cpp | 22 +-- protocols/SkypeWeb/src/skype_options.cpp | 4 +- protocols/SkypeWeb/src/skype_poll_processing.cpp | 76 +++++----- protocols/SkypeWeb/src/skype_polling.cpp | 9 +- protocols/SkypeWeb/src/skype_profile.cpp | 4 +- protocols/SkypeWeb/src/skype_proto.cpp | 32 ++--- protocols/SkypeWeb/src/skype_proto.h | 168 +++++++++++------------ protocols/SkypeWeb/src/skype_search.cpp | 92 ++++++------- protocols/SkypeWeb/src/skype_trouter.cpp | 107 ++++++++------- protocols/SkypeWeb/src/skype_utils.cpp | 42 +++--- 34 files changed, 470 insertions(+), 468 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h index e5456f87d2..ac556c285c 100644 --- a/protocols/SkypeWeb/src/http_request.h +++ b/protocols/SkypeWeb/src/http_request.h @@ -110,7 +110,7 @@ protected: class HttpRequestHeaders { HttpRequestHeaders& operator=(const HttpRequestHeaders&); // to prevent copying; - + HttpRequest &request; void Add(LPCSTR szName) diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index af56804714..73613c972d 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -36,7 +36,7 @@ PLUGININFOEX pluginInfo = __AUTHORWEB, UNICODE_AWARE, // {57E90AC6-1067-423B-8CA3-70A39D200D4F} - { 0x57e90ac6, 0x1067, 0x423b, {0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f}} + { 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f } } }; DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) @@ -88,12 +88,12 @@ extern "C" int __declspec(dllexport) Unload(void) } -int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) -{ +int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) +{ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService); AssocMgr_AddNewUrlTypeT("skype:", TranslateT("Skype Link Protocol"), g_hInstance, IDI_SKYPE, MODULE "/ParseUri", 0); } - return 0; + return 0; } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 8dd5a2f820..1e8113cfdb 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -17,8 +17,8 @@ along with this program. If not, see . #include "stdafx.h" -RequestQueue::RequestQueue(HANDLE hConnection) : - hConnection(hConnection), requests(1) +RequestQueue::RequestQueue(HANDLE hConnection) : +hConnection(hConnection), requests(1) { isTerminated = true; hRequestQueueThread = NULL; diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h index 23696f2481..d4ceb1f0ae 100644 --- a/protocols/SkypeWeb/src/request_queue.h +++ b/protocols/SkypeWeb/src/request_queue.h @@ -18,7 +18,7 @@ along with this program. If not, see . #ifndef _SKYPE_REQUEST_QUEUE_H_ #define _SKYPE_REQUEST_QUEUE_H_ -typedef void (*HttpResponseCallback)(const NETLIBHTTPREQUEST *response, void *arg); +typedef void(*HttpResponseCallback)(const NETLIBHTTPREQUEST *response, void *arg); struct RequestQueueItem { diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index f01036a5c3..eb972cafa5 100644 --- a/protocols/SkypeWeb/src/requests/capabilities.h +++ b/protocols/SkypeWeb/src/requests/capabilities.h @@ -41,30 +41,30 @@ public: CMStringA verString(::FORMAT, "%s x%d", g_szMirVer, bitness); - JSONNODE *node = json_new(5); + JSONNODE *node = json_new(5); JSONNODE *privateInfo = json_new(5); - JSONNODE *publicInfo = json_new(5); + JSONNODE *publicInfo = json_new(5); json_set_name(privateInfo, "privateInfo"); - json_set_name(publicInfo, "publicInfo"); + json_set_name(publicInfo, "publicInfo"); - json_push_back(node, json_new_a ("id", "messagingService" )); - json_push_back(node, json_new_a ("type", "EndpointPresenceDoc" )); - json_push_back(node, json_new_a ("selfLink", "uri" )); + json_push_back(node, json_new_a("id", "messagingService")); + json_push_back(node, json_new_a("type", "EndpointPresenceDoc")); + json_push_back(node, json_new_a("selfLink", "uri")); - json_push_back(privateInfo, json_new_a ("epname", compName )); + json_push_back(privateInfo, json_new_a("epname", compName)); - json_push_back(publicInfo, json_new_a ("capabilities", "Audio|Video" )); - json_push_back(publicInfo, json_new_i ("typ", 125 )); - json_push_back(publicInfo, json_new_a ("skypeNameVersion","Miranda NG Skype" )); - json_push_back(publicInfo, json_new_a ("nodeInfo", "xx" )); - json_push_back(publicInfo, json_new_a ("version", verString.GetBuffer() )); + json_push_back(publicInfo, json_new_a("capabilities", "Audio|Video")); + json_push_back(publicInfo, json_new_i("typ", 125)); + json_push_back(publicInfo, json_new_a("skypeNameVersion", "Miranda NG Skype")); + json_push_back(publicInfo, json_new_a("nodeInfo", "xx")); + json_push_back(publicInfo, json_new_a("version", verString.GetBuffer())); json_push_back(node, privateInfo); json_push_back(node, publicInfo); - + ptrA data(mir_utf8encodeT(ptrT(json_write(node)))); - + Body << VALUE(data); diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 39f2f5eddb..f5a1dfd6db 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -24,7 +24,7 @@ public: LoadChatsRequest(const char *regToken, const char *server = SKYPE_ENDPOINTS_HOST) : HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", server) { - Url + Url << INT_VALUE("startTime", 0) << INT_VALUE("pageSize", 100) << CHAR_VALUE("view", "msnp24Equivalent") @@ -89,7 +89,7 @@ public: class CreateChatroomRequest : public HttpRequest { public: - CreateChatroomRequest(const char *regToken, const LIST &skypenames,const char *selfname, const char *server = SKYPE_ENDPOINTS_HOST) : + CreateChatroomRequest(const char *regToken, const LIST &skypenames, const char *selfname, const char *server = SKYPE_ENDPOINTS_HOST) : HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", server) { //{"members":[{"id":"8:user3","role":"User"},{"id":"8:user2","role":"User"},{"id":"8:user1","role":"Admin"}]} diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h index 0f83d2b769..bec924d03a 100644 --- a/protocols/SkypeWeb/src/requests/endpoint.h +++ b/protocols/SkypeWeb/src/requests/endpoint.h @@ -28,7 +28,7 @@ public: << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") << FORMAT_VALUE("Authentication", "skypetoken=%s", token); - + Body << VALUE("{}"); } }; diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h index 812df6e927..2fb05c824c 100644 --- a/protocols/SkypeWeb/src/requests/history.h +++ b/protocols/SkypeWeb/src/requests/history.h @@ -23,7 +23,7 @@ public: SyncHistoryFirstRequest(const char *regToken, int pageSize = 100, const char *server = SKYPE_ENDPOINTS_HOST) : HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", server) { - Url + Url << INT_VALUE("startTime", 0) << INT_VALUE("pageSize", pageSize) << CHAR_VALUE("view", "msnp24Equivalent") @@ -52,7 +52,7 @@ public: GetHistoryRequest(const char *regToken, const char *username, int pageSize = 100, bool isChat = false, LONGLONG timestamp = 0, const char *server = SKYPE_ENDPOINTS_HOST) : HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%s:%s/messages", server, isChat ? "19" : "8", ptrA(mir_urlEncode(username))) { - Url + Url << INT_VALUE("startTime", timestamp) << INT_VALUE("pageSize", pageSize) << CHAR_VALUE("view", "msnp24Equivalent") diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 054d682619..ed5b6ccc27 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -78,7 +78,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken) - << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); + << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping"; @@ -99,7 +99,7 @@ class MarkMessageReadRequest : public HttpRequest { public: MarkMessageReadRequest(const char *username, const char *regToken, LONGLONG msgId = 0, LONGLONG msgTimestamp = 0, bool isChat = false, const char *server = SKYPE_ENDPOINTS_HOST) : - HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%s:%s/properties?name=consumptionhorizon", server, !isChat?"8":"19", username) + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%s:%s/properties?name=consumptionhorizon", server, !isChat ? "8" : "19", username) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h index 20a06fd673..9bbf936ace 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -26,7 +26,7 @@ public: { timeout = INFINITE; flags |= NLHRF_PERSISTENT; - Headers + Headers << CHAR_VALUE("Connection", "keep-alive") << CHAR_VALUE("Accept", "application/json, text/javascript") << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken); diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h index 64283c1964..2b78cdac35 100644 --- a/protocols/SkypeWeb/src/requests/search.h +++ b/protocols/SkypeWeb/src/requests/search.h @@ -21,10 +21,10 @@ along with this program. If not, see . class GetSearchRequest : public HttpRequest { public: - GetSearchRequest(const char *token, const char *string) : - HttpRequest(REQUEST_GET, "api.skype.com/search/users/any") + GetSearchRequest(const char *token, const char *string) : + HttpRequest(REQUEST_GET, "api.skype.com/search/users/any") { - Url + Url << CHAR_VALUE("keyWord", string) << CHAR_VALUE("contactTypes[]", "skype"); Headers diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index d0f8c60460..718d342d72 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -28,13 +28,13 @@ public: << CHAR_VALUE("Accept", "application/json, text/javascript") << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); - + JSONNODE *node = json_new(5); JSONNODE *interestedResources = json_new(4); json_set_name(interestedResources, "interestedResources"); json_push_back(node, json_new_a("channelType", "httpLongPoll")); - json_push_back(node, json_new_a("template", "raw" )); + json_push_back(node, json_new_a("template", "raw")); json_push_back(interestedResources, json_new_a(NULL, "/v1/users/ME/conversations/ALL/properties")); json_push_back(interestedResources, json_new_a(NULL, "/v1/users/ME/conversations/ALL/messages")); @@ -43,7 +43,7 @@ public: json_push_back(node, interestedResources); ptrA data(mir_utf8encodeT(ptrT(json_write(node)))); - + Body << VALUE(data); json_delete(node); diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h index 0401d0f13a..89bad5a14b 100644 --- a/protocols/SkypeWeb/src/requests/trouter.h +++ b/protocols/SkypeWeb/src/requests/trouter.h @@ -19,11 +19,11 @@ class CreateTrouterRequest : public HttpRequest { public: CreateTrouterRequest() : - HttpRequest(REQUEST_POST,"go.trouter.io/v2/a") + HttpRequest(REQUEST_POST, "go.trouter.io/v2/a") { Headers << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml"); - //{"secure":true,"ccid":"huzHTfsZt3wZ","connId":"AUKRNgA8_eKV0Ibsx037Gbd8GVrsDg8zLQRt1pH8sCyIAile3gtoWmlq2x1yZ_VNZ3tf","healthUrl":"https://go.trouter.io:443/v2/h","id":"QpE2ADz94pXQhuzHTfsZt3wZ","instance":"193.149.88.131","instancePort":443,"socketio":"https://193-149-88-131.drip.trouter.io:443/","surl":"https://193-149-88-131.drip.trouter.io:8443/v2/f/QpE2ADz94pXQhuzHTfsZt3wZ/","url":"https://193-149-88-131.drip.trouter.io:443/v2/f/QpE2ADz94pXQhuzHTfsZt3wZ/"} + //{"secure":true,"ccid":"huzHTfsZt3wZ","connId":"AUKRNgA8_eKV0Ibsx037Gbd8GVrsDg8zLQRt1pH8sCyIAile3gtoWmlq2x1yZ_VNZ3tf","healthUrl":"https://go.trouter.io:443/v2/h","id":"QpE2ADz94pXQhuzHTfsZt3wZ","instance":"193.149.88.131","instancePort":443,"socketio":"https://193-149-88-131.drip.trouter.io:443/","surl":"https://193-149-88-131.drip.trouter.io:8443/v2/f/QpE2ADz94pXQhuzHTfsZt3wZ/","url":"https://193-149-88-131.drip.trouter.io:443/v2/f/QpE2ADz94pXQhuzHTfsZt3wZ/"} } }; @@ -37,7 +37,7 @@ public: << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") << CHAR_VALUE("X-Skypetoken", token); - + JSONNODE *node = json_new(5); json_push_back(node, json_new_a("sr", sr)); ptrA data(mir_utf8encodeT(ptrT(json_write(node)))); @@ -69,18 +69,18 @@ public: json_set_name(transports, "transports"); json_set_name(TROUTER, "TROUTER"); - json_push_back(node, json_new_a("registrationId", id )); - json_push_back(node, json_new_a("nodeId", "" )); + json_push_back(node, json_new_a("registrationId", id)); + json_push_back(node, json_new_a("nodeId", "")); - json_push_back(clientDescription, json_new_a("aesKey", "" )); - json_push_back(clientDescription, json_new_a("languageId", "en-US" )); - json_push_back(clientDescription, json_new_a("platform", "SWX" )); - json_push_back(clientDescription, json_new_a("templateKey", "SkypeWeb_1.0")); + json_push_back(clientDescription, json_new_a("aesKey", "")); + json_push_back(clientDescription, json_new_a("languageId", "en-US")); + json_push_back(clientDescription, json_new_a("platform", "SWX")); + json_push_back(clientDescription, json_new_a("templateKey", "SkypeWeb_1.0")); json_push_back(node, clientDescription); - - json_push_back(TRouter, json_new_a("context", "")); - json_push_back(TRouter, json_new_a("path", trouterUrl)); - json_push_back(TRouter, json_new_i("ttl", 3600)); + + json_push_back(TRouter, json_new_a("context", "")); + json_push_back(TRouter, json_new_a("path", trouterUrl)); + json_push_back(TRouter, json_new_i("ttl", 3600)); json_push_back(TROUTER, TRouter); json_push_back(transports, TROUTER); json_push_back(node, transports); @@ -112,7 +112,7 @@ class GetTrouterRequest : public HttpRequest { public: GetTrouterRequest(const char *socketio, const char *sr, const char *st, const char *se, const char *sig, - const char *instance, const char *ccid) : + const char *instance, const char *ccid) : HttpRequest(REQUEST_GET, FORMAT, "%ssocket.io/1/", socketio) { Url @@ -127,7 +127,7 @@ public: << INT_VALUE("p", 443) << CHAR_VALUE("ccid", ccid) << CHAR_VALUE("tc", ptrA(mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))) - << INT_VALUE("t", time(NULL)*1000); + << INT_VALUE("t", time(NULL) * 1000); Headers << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml"); @@ -138,7 +138,7 @@ class TrouterPollRequest : public HttpRequest { public: TrouterPollRequest(const char *socketio, const char *sr, const char *st, const char *se, const char *sig, - const char *instance, const char *ccid, const char *sessId) : + const char *instance, const char *ccid, const char *sessId) : HttpRequest(REQUEST_GET, FORMAT, "%ssocket.io/1/xhr-polling/%s", socketio, sessId) { timeout = INFINITE; @@ -155,7 +155,7 @@ public: << INT_VALUE("p", 443) << CHAR_VALUE("ccid", ccid) << CHAR_VALUE("tc", ptrA(mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))) - << INT_VALUE("t", time(NULL)*1000); + << INT_VALUE("t", time(NULL) * 1000); Headers << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml"); diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 6a0fc56ba3..c8d2fc7c86 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -150,7 +150,7 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) } else { setTString(hContact, "AvatarUrl", tszUrl.GetBuffer()); - setByte(hContact,"NeedNewAvatar", 1); + setByte(hContact, "NeedNewAvatar", 1); PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; AI.hContact = hContact; GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename)); diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 1c832afc5c..4dc1047e83 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -116,7 +116,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new SyncHistoryFirstRequest(syncState, RegToken), &CSkypeProto::OnSyncHistory); - + for (size_t i = 0; i < json_size(conversations); i++) { JSONNODE *conversation = json_at(conversations, i); @@ -133,7 +133,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) if (conversationLink != NULL && strstr(conversationLink, "/19:")) { skypename = ChatUrlToName(conversationLink); - topic = json_as_string(json_get(threadProperties, "topic")); + topic = json_as_string(json_get(threadProperties, "topic")); SendRequest(new GetChatInfoRequest(RegToken, skypename, Server), &CSkypeProto::OnGetChatInfo, topic); } } @@ -157,73 +157,73 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) switch (gch->pDest->iType) { - case GC_USER_MESSAGE: + case GC_USER_MESSAGE: + { + OnSendChatMessage(gch->pDest->ptszID, gch->ptszText); + break; + } + + case GC_USER_PRIVMESS: + { + MCONTACT hContact = FindContact(_T2A(gch->ptszUID)); + if (hContact == NULL) { - OnSendChatMessage(gch->pDest->ptszID, gch->ptszText); - break; + hContact = AddContact(_T2A(gch->ptszUID), true); + setWord(hContact, "Status", ID_STATUS_ONLINE); + db_set_b(hContact, "CList", "Hidden", 1); + setTString(hContact, "Nick", gch->ptszUID); + db_set_dw(hContact, "Ignore", "Mask1", 0); } + CallService(MS_MSG_SENDMESSAGET, hContact, 0); + break; + } - case GC_USER_PRIVMESS: + case GC_USER_LOGMENU: + { + switch (gch->dwData) { - MCONTACT hContact = FindContact(_T2A(gch->ptszUID)); - if (hContact == NULL) + case 10: { + MCONTACT hContact = (MCONTACT)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_GC_INVITE), NULL, InviteDlgProc, (LPARAM)this); + if (hContact != NULL) { - hContact = AddContact(_T2A(gch->ptszUID), true); - setWord(hContact, "Status", ID_STATUS_ONLINE); - db_set_b(hContact, "CList", "Hidden", 1); - setTString(hContact, "Nick", gch->ptszUID); - db_set_dw(hContact, "Ignore", "Mask1", 0); + ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)); + SendRequest(new InviteUserToChatRequest(RegToken, chat_id, username, "User", Server)); } - CallService(MS_MSG_SENDMESSAGET, hContact, 0); break; } - - case GC_USER_LOGMENU: - { - switch(gch->dwData) - { - case 10: { - MCONTACT hContact = (MCONTACT)DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_GC_INVITE), NULL, InviteDlgProc, (LPARAM)this); - if (hContact != NULL) - { - ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)); - SendRequest(new InviteUserToChatRequest(RegToken, chat_id, username, "User", Server)); - } - break; - } - case 20: - OnLeaveChatRoom(FindChatRoom(chat_id), NULL); - break; - case 30: - break; - } + case 20: + OnLeaveChatRoom(FindChatRoom(chat_id), NULL); + break; + case 30: break; } + break; + } - case GC_USER_NICKLISTMENU: + case GC_USER_NICKLISTMENU: + { + ptrA user_id; + if (gch->dwData == 10 || gch->dwData == 30 || gch->dwData == 40) { - ptrA user_id; - if (gch->dwData == 10 || gch->dwData == 30 || gch->dwData == 40) - { - user_id = mir_t2a_cp(gch->ptszUID, CP_UTF8); - } - - switch (gch->dwData) - { - case 10: - SendRequest(new KickUserRequest(RegToken, chat_id, user_id, Server)); - break; - case 30: - SendRequest(new InviteUserToChatRequest(RegToken, chat_id, user_id, "Admin", Server)); - break; - case 40: - SendRequest(new InviteUserToChatRequest(RegToken, chat_id, user_id, "User", Server)); - break; - } + user_id = mir_t2a_cp(gch->ptszUID, CP_UTF8); + } + switch (gch->dwData) + { + case 10: + SendRequest(new KickUserRequest(RegToken, chat_id, user_id, Server)); + break; + case 30: + SendRequest(new InviteUserToChatRequest(RegToken, chat_id, user_id, "Admin", Server)); + break; + case 40: + SendRequest(new InviteUserToChatRequest(RegToken, chat_id, user_id, "User", Server)); break; - } + + break; + + } } return 0; } @@ -269,7 +269,7 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) { ptrA clientMsgId(mir_t2a(ptrT(json_as_string(json_get(node, "clientmessageid"))))); ptrA skypeEditedId(mir_t2a(ptrT(json_as_string(json_get(node, "skypeeditedid"))))); - + ptrA fromLink(mir_t2a(ptrT(json_as_string(json_get(node, "from"))))); ptrA from(ContactUrlToName(fromLink)); @@ -282,9 +282,9 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) ptrA chatname(ChatUrlToName(conversationLink)); TCHAR *topic(json_as_string(json_get(node, "threadtopic"))); - + if (FindChatRoom(chatname) == NULL) SendRequest(new GetChatInfoRequest(RegToken, chatname, Server), &CSkypeProto::OnGetChatInfo, topic); - + ptrA messageType(mir_t2a(ptrT(json_as_string(json_get(node, "messagetype"))))); if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")) { @@ -299,7 +299,7 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) if (xml == NULL) return; - for (int i=0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xi.getChildCount(xml); i++) { HXML xmlNode = xi.getNthChild(xml, L"target", i); if (xmlNode == NULL) @@ -328,7 +328,7 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) xi.destroyNode(xml); } - if(xtarget == NULL) + if (xtarget == NULL) return; target = ParseUrl(xtarget, "8:"); @@ -352,7 +352,7 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) xi.destroyNode(xml); } initiator = ParseUrl(xinitiator, "8:"); - + RenameChat(chatname, value); ChangeChatTopic(chatname, value, initiator); } @@ -376,8 +376,8 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) xi.destroyNode(xml); initiator = ParseUrl(xinitiator, "8:"); 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(chatname), !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)); @@ -403,13 +403,13 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa ptrA szMessage(mir_t2a(tszMessage)); if (strncmp(szMessage, "/me ", 4) == 0) SendRequest(new SendChatActionRequest(RegToken, szChatId, time(NULL), szMessage, Server)); - else + else SendRequest(new SendChatMessageRequest(RegToken, szChatId, time(NULL), szMessage, Server)); } void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading) { - GCDEST gcd = { m_szModuleName, chat_id, isAction? GC_EVENT_ACTION : GC_EVENT_MESSAGE }; + GCDEST gcd = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; gce.bIsMe = IsMe(_T2A(from)); @@ -516,7 +516,7 @@ void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const ch gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tnick; gce.ptszUID = tid; - gce.time = !isChange ? time(NULL): NULL; + gce.time = !isChange ? time(NULL) : NULL; gce.bIsMe = IsMe(id); gce.ptszStatus = TranslateTS(role); @@ -525,9 +525,9 @@ void CSkypeProto::AddChatContact(const TCHAR *tchat_id, const char *id, const ch void CSkypeProto::RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick, const char *initiator) { - if(IsMe(id)) + if (IsMe(id)) return; - + ptrT tnick(mir_a2t_cp(name, CP_UTF8)); ptrT tid(mir_a2t(id)); ptrT tinitiator(mir_a2t(initiator)); @@ -572,9 +572,9 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) { static const struct gc_item Items[] = { - { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, - { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }, - { LPGENT("&Change topic"), 30, MENU_ITEM, FALSE } + { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, + { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }, + { LPGENT("&Change topic"), 30, MENU_ITEM, FALSE } }; gcmi->nItems = SIZEOF(Items); gcmi->Item = (gc_item*)Items; @@ -590,11 +590,11 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) { static const struct gc_item Items[] = { - { LPGENT("Kick &user"), 10, MENU_ITEM }, - { NULL, 0, MENU_SEPARATOR }, - { LPGENT("Set &role"), 20, MENU_NEWPOPUP }, - { LPGENT("&Admin"), 30, MENU_POPUPITEM }, - { LPGENT("&User"), 40, MENU_POPUPITEM } + { LPGENT("Kick &user"), 10, MENU_ITEM }, + { NULL, 0, MENU_SEPARATOR }, + { LPGENT("Set &role"), 20, MENU_NEWPOPUP }, + { LPGENT("&Admin"), 30, MENU_POPUPITEM }, + { LPGENT("&User"), 40, MENU_POPUPITEM } }; gcmi->nItems = SIZEOF(Items); gcmi->Item = (gc_item*)Items; @@ -612,7 +612,7 @@ INT_PTR CSkypeProto::GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CSkypeProto *ppro = (CSkypeProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); NMCLISTCONTROL* nmc; - switch (msg) + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -678,7 +678,7 @@ INT_PTR CSkypeProto::InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM CSkypeProto *ppro = (CSkypeProto*)lParam; HWND hwndCombo = GetDlgItem(hwndDlg, IDC_CONTACT); for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { - if (ppro->isChatRoom(hContact)) continue; + if (ppro->isChatRoom(hContact)) continue; TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); int idx = SendMessage(hwndCombo, CB_ADDSTRING, 0, LPARAM(ptszNick)); SendMessage(hwndCombo, CB_SETITEMDATA, idx, hContact); @@ -700,7 +700,7 @@ INT_PTR CSkypeProto::InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else EndDialog(hwndDlg, 0); return TRUE; - } + } } return 0; diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index f4f1f87e99..f7c2e9271b 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -115,7 +115,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) if (response == NULL) return; - + JSONROOT root(response->pData); if (root == NULL) return; @@ -147,7 +147,7 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) if (lastEventTime == 0 || lastEventTime < eventTime) { - db_set_dw(hContact, m_szModuleName,"LastAuthRequestTime", eventTime); + db_set_dw(hContact, m_szModuleName, "LastAuthRequestTime", eventTime); delSetting(hContact, "Auth"); PROTORECVEVENT pre = { 0 }; @@ -252,7 +252,7 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) db_set_b(hContact, "CList", "Hidden", 1); setByte(hContact, "IsBlocked", 1); } - else + else { if (db_get_b(hContact, m_szModuleName, "IsBlocked", 0)) { @@ -318,7 +318,7 @@ INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p) { MCONTACT hContact = (MCONTACT)p; - if (response == NULL) + if (response == NULL) return; db_set_dw(hContact, "Ignore", "Mask1", 127); db_set_b(hContact, "CList", "Hidden", 1); @@ -333,7 +333,7 @@ INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM) void CSkypeProto::OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p) { MCONTACT hContact = (MCONTACT)p; - if (response == NULL) + if (response == NULL) return; db_set_dw(hContact, "Ignore", "Mask1", 0); db_set_b(hContact, "CList", "Hidden", 0); diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index c28f6cdc5b..318c4b76ba 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp) { - if(messageId == NULL) + if (messageId == NULL) return NULL; timestamp -= 600; // we check events written 10 minutes ago @@ -42,7 +42,7 @@ MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, L continue; size_t cbLen = strlen((char*)dbei.pBlob); - if (memcmp(&dbei.pBlob[cbLen+1], messageId, messageIdLength) == 0) + if (memcmp(&dbei.pBlob[cbLen + 1], messageId, messageIdLength) == 0) return hDbEvent; if (dbei.timestamp < timestamp) @@ -77,7 +77,7 @@ MEVENT CSkypeProto::AddCallInfoToDb(MCONTACT hContact, DWORD timestamp, DWORD fl memcpy(pBlob, content, messageLength); memcpy(pBlob + messageLength, messageId, messageIdLength); - return AddEventToDb(hContact,SKYPE_DB_EVENT_TYPE_CALL_INFO, timestamp, flags, (DWORD)cbBlob, pBlob); + return AddEventToDb(hContact, SKYPE_DB_EVENT_TYPE_CALL_INFO, timestamp, flags, (DWORD)cbBlob, pBlob); } MEVENT CSkypeProto::AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId, const char *gp) diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h index b573a2d1c3..8144d17d07 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.h +++ b/protocols/SkypeWeb/src/skype_dialogs.h @@ -40,10 +40,10 @@ protected: { /*if (m_savePermanently.Enabled()) m_proto->setString("Password", m_password.GetTextA()); - if (m_proto->password != NULL) + if (m_proto->password != NULL) mir_free(m_proto->password); - m_proto->password = mir_utf8encodeW(m_password.GetText()); - */ + m_proto->password = mir_utf8encodeW(m_password.GetText()); + */ EndDialog(m_hwnd, 1); } diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 2392542bba..e848d2920d 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -24,7 +24,7 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam) INT_PTR nRetVal = 0; char *pszText = Translate("Incoming call"); - if (pEvent->datatype == DBVT_TCHAR) + if (pEvent->datatype == DBVT_TCHAR) { TCHAR *pwszText = _A2T(pszText); nRetVal = (INT_PTR)mir_tstrdup(pwszText); @@ -40,27 +40,27 @@ INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) { DBEVENTINFO* dbei = (DBEVENTINFO*)lParam; HICON icon = NULL; - + switch (dbei->eventType) { case SKYPE_DB_EVENT_TYPE_CALL_INFO: case SKYPE_DB_EVENT_TYPE_INCOMING_CALL: - { - icon = Skin_GetIconByHandle(GetIconHandle("inc_call")); - break; - } + { + icon = Skin_GetIconByHandle(GetIconHandle("inc_call")); + break; + } case SKYPE_DB_EVENT_TYPE_ACTION: - { - icon = Skin_GetIconByHandle(GetIconHandle("me_action")); - break; - } + { + icon = Skin_GetIconByHandle(GetIconHandle("me_action")); + break; + } default: - { - icon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); - break; - } + { + icon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); + break; } - + } + return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon)); } @@ -99,8 +99,8 @@ void CSkypeProto::InitPopups() ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call")); - ppc.colorBack = RGB(255, 255, 255); - ppc.colorText = RGB(0, 0, 0); + ppc.colorBack = RGB(255, 255, 255); + ppc.colorText = RGB(0, 0, 0); ppc.iSeconds = 30; ppc.PluginWindowProc = PopupDlgProcCall; m_hPopupClassCall = Popup_RegisterClass(&ppc); @@ -110,8 +110,8 @@ void CSkypeProto::InitPopups() ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("notify")); - ppc.colorBack = RGB(255, 255, 255); - ppc.colorText = RGB(0, 0, 0); + ppc.colorBack = RGB(255, 255, 255); + ppc.colorText = RGB(0, 0, 0); ppc.iSeconds = 5; m_hPopupClassNotify = Popup_RegisterClass(&ppc); @@ -120,8 +120,8 @@ void CSkypeProto::InitPopups() ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("error")); - ppc.colorBack = RGB(255, 255, 255); - ppc.colorText = RGB(0, 0, 0); + ppc.colorBack = RGB(255, 255, 255); + ppc.colorText = RGB(0, 0, 0); ppc.iSeconds = -1; m_hPopupClassNotify = Popup_RegisterClass(&ppc); } diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 7d0886013c..f6e6e3dd03 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -34,7 +34,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) int totalCount = json_as_int(json_get(metadata, "totalCount")); ptrA syncState(mir_t2a(ptrT(json_as_string(json_get(metadata, "syncState"))))); - bool markAllAsUnread = getBool("MarkMesUnread",false); + bool markAllAsUnread = getBool("MarkMesUnread", false); if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new GetHistoryOnUrlRequest(syncState, RegToken), &CSkypeProto::OnGetServerHistory); @@ -59,7 +59,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink))); - if (timestamp > db_get_dw(hContact,m_szModuleName, "LastMsgTime", 0)) + if (timestamp > db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0)) db_set_dw(hContact, m_szModuleName, "LastMsgTime", (DWORD)timestamp); int flags = DBEF_UTF; @@ -76,7 +76,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { ptrA message(RemoveHtml(content)); - MEVENT dbevent = GetMessageFromDb(hContact, skypeEditedId); + MEVENT dbevent = GetMessageFromDb(hContact, skypeEditedId); if (isEdited && dbevent != NULL) { @@ -114,7 +114,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) int iType = 3, iDuration = 0; ptrA skypename(ContactUrlToName(from)); HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("partlist")); - if (xml != NULL) + if (xml != NULL) { ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); @@ -133,14 +133,14 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) else if (iType == 0) { CMStringA chours = "", cmins = "", csec = ""; - int hours=0, mins=0, sec=0; + int hours = 0, mins = 0, sec = 0; if (iDuration != NULL) { hours = iDuration / 3600; mins = iDuration / 60; sec = iDuration % 60; } - else + else hours = mins = sec = 0; chours.AppendFormat(hours < 10 ? "0%d" : "%d", hours); @@ -154,9 +154,9 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { //content=run.bat HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("files")); - if (xml != NULL) + if (xml != NULL) { - for (int i=0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xi.getChildCount(xml); i++) { int fileSize; CMStringA msg = ""; HXML xmlNode = xi.getNthChild(xml, L"file", i); @@ -168,7 +168,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) continue; msg.Empty(); - msg.AppendFormat("%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize , Translate("bytes")); + msg.AppendFormat("%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes")); AddMessageToDb(hContact, timestamp, flags, clientMsgId, msg.GetBuffer()); } @@ -178,7 +178,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { //content=Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834 HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("URIObject")); - if (xml != NULL) + if (xml != NULL) { ptrA url(mir_t2a(xi.getAttrValue(xml, L"uri"))); ptrA object(ParseUrl(url, "/objects/")); @@ -223,7 +223,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || json_size(conversations) >= 99) PushRequest(new SyncHistoryFirstRequest(syncState, RegToken), &CSkypeProto::OnSyncHistory); - + for (size_t i = 0; i < json_size(conversations); i++) { JSONNODE *conversation = json_at(conversations, i); @@ -242,7 +242,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) skypename = ContactUrlToName(conversationLink); MCONTACT hContact = AddContact(skypename, true); - if (/*GetLastMessageTime(hContact) < composeTime || */db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) < composeTime) + if (/*GetLastMessageTime(hContact) < composeTime || */db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) < composeTime) { PushRequest(new GetHistoryRequest(RegToken, skypename, 100, false, 0, Server), &CSkypeProto::OnGetServerHistory); HistorySynced = true; diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 3da4926862..a846ef0390 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -19,15 +19,15 @@ along with this program. If not, see . IconInfo CSkypeProto::Icons[] = { - { LPGENT("Protocol icon"), "main", IDI_SKYPE }, - { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE }, - { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY }, - { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER }, - { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER }, - { LPGENT("Incoming call icon"), "inc_call", IDI_CALL }, - { LPGENT("Notification icon"), "notify", IDI_NOTIFY }, - { LPGENT("Error icon"), "error", IDI_ERRORICON }, - { LPGENT("Action icon"), "me_action", IDI_ACTION_ME } + { LPGENT("Protocol icon"), "main", IDI_SKYPE }, + { LPGENT("Create new chat icon"), "conference", IDI_CONFERENCE }, + { LPGENT("Sync history icon"), "synchistory", IDI_SYNCHISTORY }, + { LPGENT("Block user icon"), "user_block", IDI_BLOCKUSER }, + { LPGENT("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER }, + { LPGENT("Incoming call icon"), "inc_call", IDI_CALL }, + { LPGENT("Notification icon"), "notify", IDI_NOTIFY }, + { LPGENT("Error icon"), "error", IDI_ERRORICON }, + { LPGENT("Action icon"), "me_action", IDI_ACTION_ME } }; void CSkypeProto::InitIcons() { diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index a2520a1262..f6e91b6591 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -206,7 +206,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) LIST skypenames(1); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { - if(!isChatRoom(hContact)) + if (!isChatRoom(hContact)) skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID)); } SendRequest(new CreateContactsSubscriptionRequest(RegToken, skypenames, Server)); @@ -241,7 +241,7 @@ void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response) SetStatus(ID_STATUS_OFFLINE); return; } - + JSONROOT json(response->pData); if (json == NULL) { diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 9a7d63dd8e..00b2383e77 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -128,9 +128,9 @@ int CSkypeProto::OnInitStatusMenu() /*else { - if (m_hMenuRoot) - CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0); - m_hMenuRoot = NULL; + if (m_hMenuRoot) + CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0); + m_hMenuRoot = NULL; }*/ mi.hParentMenu = hStatusMunuRoot; mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR; diff --git a/protocols/SkypeWeb/src/skype_menus.h b/protocols/SkypeWeb/src/skype_menus.h index a8cc308df5..e754d6d58e 100644 --- a/protocols/SkypeWeb/src/skype_menus.h +++ b/protocols/SkypeWeb/src/skype_menus.h @@ -31,7 +31,7 @@ enum }; enum ProtoMenuIndexes { - SMI_CREATECHAT + SMI_CREATECHAT }; #define SMI_POSITION 200000 diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index e47f8e248a..a1d618e792 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -151,7 +151,7 @@ int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam) void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) { ptrA clientMsgId(mir_t2a(ptrT(json_as_string(json_get(node, "clientmessageid"))))); - ptrA skypeEditedId(mir_t2a(ptrT(json_as_string(json_get(node, "skypeeditedid"))))); + ptrA skypeEditedId(mir_t2a(ptrT(json_as_string(json_get(node, "skypeeditedid"))))); bool isEdited = (json_get(node, "skypeeditedid") != NULL); @@ -169,10 +169,10 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) ptrA message(RemoveHtml(content)); - + ptrA messageType(mir_t2a(ptrT(json_as_string(json_get(node, "messagetype"))))); MCONTACT hContact = AddContact(skypename, true); - + if (HistorySynced) db_set_dw(hContact, m_szModuleName, "LastMsgTime", (DWORD)timestamp); if (!mir_strcmpi(messageType, "Control/Typing")) @@ -192,7 +192,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) return; } debugLogA(__FUNCTION__" timestamp = %d clientmsgid = %s", timestamp, clientMsgId); - MEVENT dbevent = GetMessageFromDb(hContact, skypeEditedId); + MEVENT dbevent = GetMessageFromDb(hContact, skypeEditedId); if (isEdited && dbevent != NULL) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -227,7 +227,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) //content=user name int iType = 3, iDuration = 0; HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("partlist")); - if (xml != NULL) + if (xml != NULL) { ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); @@ -247,14 +247,14 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) else if (iType == 0) { CMStringA chours = "", cmins = "", csec = ""; - int hours=0, mins=0, sec=0; + int hours = 0, mins = 0, sec = 0; if (iDuration != NULL) { hours = iDuration / 3600; mins = iDuration / 60; sec = iDuration % 60; } - else + else hours = mins = sec = 0; chours.AppendFormat(hours < 10 ? "0%d" : "%d", hours); @@ -272,9 +272,9 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) { //content=run.bat HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("files")); - if (xml != NULL) + if (xml != NULL) { - for (int i=0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xi.getChildCount(xml); i++) { int fileSize; HXML xmlNode = xi.getNthChild(xml, L"file", i); @@ -285,7 +285,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) if (fileName == NULL || fileSize == NULL) continue; - CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize , Translate("bytes")); + CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes")); AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_READ, clientMsgId, msg.GetBuffer()); } } @@ -295,7 +295,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) { //content=Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834 HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("URIObject")); - if (xml != NULL) + if (xml != NULL) { ptrA url(mir_t2a(xi.getAttrValue(xml, L"uri"))); ptrA object(ParseUrl(url, "/objects/")); diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index 0322d44d36..7ef8886381 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -47,8 +47,8 @@ void CSkypeOptionsMain::OnInitDialog() void CSkypeOptionsMain::OnApply() { - ptrA tszNewSkypename(m_skypename.GetTextA()),tszNewPassword(m_password.GetTextA()), - tszOldSkypename(m_proto->getStringA(SKYPE_SETTINGS_ID)),tszOldPassword(m_proto->getStringA("Password")); + ptrA tszNewSkypename(m_skypename.GetTextA()), tszNewPassword(m_password.GetTextA()), + tszOldSkypename(m_proto->getStringA(SKYPE_SETTINGS_ID)), tszOldPassword(m_proto->getStringA("Password")); if (mir_strcmpi(tszNewSkypename, tszOldSkypename) || mir_strcmp(tszNewPassword, tszOldPassword)) m_proto->delSetting("TokenExpiresIn"); m_proto->setString(SKYPE_SETTINGS_ID, tszNewSkypename); diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp index 999b803a58..9cdc9d6e42 100644 --- a/protocols/SkypeWeb/src/skype_poll_processing.cpp +++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp @@ -42,43 +42,43 @@ void CSkypeProto::ProcessEndpointPresenceRes(JSONNODE *node) 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.Append("Miranda NG Skype"); - break; - default: - MirVer.Append("Skype (Unknown)"); - break; + 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.Append("Miranda NG Skype"); + break; + default: + MirVer.Append("Skype (Unknown)"); + break; } if (iTyp == 125) MirVer.AppendFormat(" %s", version); - else + else MirVer.AppendFormat(" %s", ParseUrl(skypeNameVersion, "/")); db_set_s(hContact, m_szModuleName, "MirVer", MirVer); @@ -138,16 +138,16 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node) void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node) { JSONNODE *lastMessage = json_get(node, "lastMessage"); - JSONNODE *properties = json_get(node, "properties" ); + JSONNODE *properties = json_get(node, "properties"); ptrA convLink(mir_t2a(json_as_string(json_get(lastMessage, "conversationLink")))); ptrA fromLink(mir_t2a(json_as_string(json_get(lastMessage, "from")))); - if (strstr(convLink, "/8:") && IsMe(ContactUrlToName(fromLink))) + if (strstr(convLink, "/8:") && IsMe(ContactUrlToName(fromLink))) { ptrA skypename(ContactUrlToName(convLink)); MCONTACT hContact = FindContact(skypename); - + if (hContact != NULL) { CMStringA consumptionhorizon(mir_t2a(json_as_string(json_get(properties, "consumptionhorizon")))); @@ -165,7 +165,7 @@ void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node) db_set_dw(hContact, m_szModuleName, "LastMsgReadTime", evttime); SetSrmmReadStatus(hContact); - } + } } } } diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index df80efc787..41ade45ec3 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -14,6 +14,7 @@ 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 . */ + #include "stdafx.h" void CSkypeProto::ParsePollData(JSONNODE *data) @@ -45,7 +46,7 @@ void CSkypeProto::ParsePollData(JSONNODE *data) else if (!mir_strcmpi(resourceType, "ConversationUpdate")) { ProcessConversationUpdateRes(resource); - } + } else if (!mir_strcmpi(resourceType, "ThreadUpdate")) { ProcessThreadUpdateRes(resource); @@ -85,7 +86,7 @@ void CSkypeProto::PollingThread(void*) } } } - else + else { errors++; @@ -104,7 +105,7 @@ void CSkypeProto::PollingThread(void*) delete request; break; } - } + } } } @@ -112,7 +113,7 @@ void CSkypeProto::PollingThread(void*) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); delete request; } - + if (!isTerminated) { debugLogA(__FUNCTION__": unexpected termination; switching protocol to offline"); diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 6bc0f40da6..ea58c3f3f1 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -285,7 +285,7 @@ void CSkypeProto::UpdateProfileDisplayName(JSONNODE *root, MCONTACT hContact) else delSetting(hContact, "Nick"); } - + } void CSkypeProto::UpdateProfileGender(JSONNODE *root, MCONTACT hContact) @@ -440,7 +440,7 @@ void CSkypeProto::UpdateProfilePhoneOffice(JSONNODE *root, MCONTACT hContact) void CSkypeProto::UpdateProfileStatusMessage(JSONNODE *root, MCONTACT hContact) { JSONNODE *node = json_get(root, "mood"); - if(hContact == NULL) + if (hContact == NULL) return; CMString province = mir_t2a(ptrT(json_as_string(node))); if (!province.IsEmpty() && province != "null") diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 50990fb2af..e71dc5ed94 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -34,7 +34,7 @@ PROTO(protoName, userName), password(NULL) requestQueue = new RequestQueue(m_hNetlibUser); CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit); - + CreateProtoService(PS_GETAVATARINFOT, &CSkypeProto::SvcGetAvatarInfo); CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps); CreateProtoService(PS_GETMYAVATART, &CSkypeProto::SvcGetMyAvatar); @@ -56,8 +56,8 @@ PROTO(protoName, userName), password(NULL) m_hCallHook = CreateHookableEvent(MODULE"/IncomingCall"); //sounds - SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound") ); - SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound") ); + SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound")); + SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound")); } CSkypeProto::~CSkypeProto() @@ -79,7 +79,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) switch (type) { case PFLAGNUM_1: - return PF1_IM | PF1_AUTHREQ | PF1_CHAT | PF1_BASICSEARCH; + return PF1_IM | PF1_AUTHREQ | PF1_CHAT | PF1_BASICSEARCH | PF1_MODEMSG; case PFLAGNUM_2: return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_HEAVYDND; case PFLAGNUM_3: @@ -94,8 +94,8 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) return 0; } -MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) -{ +MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) +{ debugLogA("CSkypeProto::AddToList"); @@ -107,12 +107,12 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) return hContact; } -MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) +MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return NULL; - if ((dbei.pBlob=(PBYTE)alloca(dbei.cbBlob)) == NULL) + if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == NULL) return NULL; if (db_event_get(hDbEvent, &dbei)) return NULL; @@ -121,7 +121,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return NULL; - char *nick = (char*)(dbei.pBlob + sizeof(DWORD)*2); + char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2); char *firstName = nick + strlen(nick) + 1; char *lastName = firstName + strlen(firstName) + 1; char *skypename = lastName + strlen(lastName) + 1; @@ -129,7 +129,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) char *newSkypename = (dbei.flags & DBEF_UTF) ? mir_utf8decodeA(skypename) : skypename; MCONTACT hContact = AddContact(newSkypename); mir_free(newSkypename); - return hContact; + return hContact; } int CSkypeProto::Authorize(MEVENT hDbEvent) @@ -137,7 +137,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent) MCONTACT hContact = GetContactFromAuthEvent(hDbEvent); if (hContact == INVALID_CONTACT_ID) return 1; - + ptrA token(getStringA("TokenSecret")); ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID)); PushRequest(new AuthAcceptRequest(token, skypename)); @@ -169,10 +169,10 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const PROTOCHAR *szMessage) ptrA token(getStringA("TokenSecret")); ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID)); PushRequest(new AddContactRequest(token, skypename, ptrA(mir_t2a(szMessage)))); - return 0; + return 0; } -int CSkypeProto::GetInfo(MCONTACT hContact, int) +int CSkypeProto::GetInfo(MCONTACT hContact, int) { PushRequest( new GetProfileRequest(ptrA(getStringA("TokenSecret")), ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), @@ -185,7 +185,7 @@ int CSkypeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) return SaveMessageToDb(hContact, pre); } -int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg) +int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg) { return OnSendMessage(hContact, flags, msg); } @@ -241,7 +241,7 @@ int CSkypeProto::SetStatus(int iNewStatus) HistorySynced = false; if ((tokenExpires - 1800) > time(NULL)) OnLoginSuccess(); - else + else SendRequest(new LoginRequest(), &CSkypeProto::OnLoginFirst); } else @@ -283,7 +283,7 @@ int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) { debugLogA(__FUNCTION__); - + isTerminated = true; if (m_pollingConnection) CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index c50db3aa79..8b96f4ceeb 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -53,7 +53,7 @@ public: virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); + virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); virtual int __cdecl Authorize(MEVENT hDbEvent); virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); @@ -91,9 +91,9 @@ public: static void InitLanguages(); // events - static int OnModulesLoaded (WPARAM, LPARAM); - int __cdecl OnDbEventRead (WPARAM, LPARAM); - int __cdecl OnPreShutdown (WPARAM, LPARAM); + static int OnModulesLoaded(WPARAM, LPARAM); + int __cdecl OnDbEventRead(WPARAM, LPARAM); + int __cdecl OnPreShutdown(WPARAM, LPARAM); //search void __cdecl SearchBasicThread(void* id); @@ -101,7 +101,7 @@ public: UINT_PTR m_timer; static int CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2); void CSkypeProto::ProcessTimer(); - static INT_PTR EventGetIcon (WPARAM wParam, LPARAM lParam); + static INT_PTR EventGetIcon(WPARAM wParam, LPARAM lParam); static INT_PTR GetCallEventText(WPARAM, LPARAM lParam); private: @@ -118,17 +118,17 @@ private: TRInfo TRouter; - HANDLE + HANDLE m_hPopupClassCall, m_hPopupClassNotify; // accounts - char - *Server, - *RegToken, - *TokenSecret, - *EndpointId, + char + *Server, + *RegToken, + *TokenSecret, + *EndpointId, *SelfSkypeName; static CSkypeProto* GetContactAccount(MCONTACT hContact); @@ -136,13 +136,13 @@ private: int __cdecl OnAccountLoaded(WPARAM, LPARAM); INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM); - + std::tstring m_tszAvatarFolder; INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM); INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM); - INT_PTR __cdecl SvcGetMyAvatar (WPARAM, LPARAM); - INT_PTR __cdecl SvcSetMyAvatar (WPARAM, LPARAM); + INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM); + INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM); int InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName); @@ -171,13 +171,13 @@ private: int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam); // login - void OnLoginFirst (const NETLIBHTTPREQUEST *response); - void OnLoginSecond (const NETLIBHTTPREQUEST *response); - void OnLoginSuccess (); - void OnEndpointCreated (const NETLIBHTTPREQUEST *response); - void OnSubscriptionsCreated (const NETLIBHTTPREQUEST *response); - void OnCapabilitiesSended (const NETLIBHTTPREQUEST *response); - void OnStatusChanged (const NETLIBHTTPREQUEST *response); + void OnLoginFirst(const NETLIBHTTPREQUEST *response); + void OnLoginSecond(const NETLIBHTTPREQUEST *response); + void OnLoginSuccess(); + void OnEndpointCreated(const NETLIBHTTPREQUEST *response); + void OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response); + void OnCapabilitiesSended(const NETLIBHTTPREQUEST *response); + void OnStatusChanged(const NETLIBHTTPREQUEST *response); //TRouter @@ -189,53 +189,53 @@ private: void __cdecl CSkypeProto::TRouterThread(void*); // profile - void UpdateProfileFirstName (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileLastName (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileDisplayName (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileGender (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileBirthday (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileCountry (JSONNODE *node, MCONTACT hContact = NULL); - void UpdateProfileState (JSONNODE *node, MCONTACT hContact = NULL); - void UpdateProfileCity (JSONNODE *node, MCONTACT hContact = NULL); - void UpdateProfileLanguage (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileHomepage (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileAbout (JSONNODE *node, MCONTACT hContact = NULL); - void UpdateProfileEmails (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfilePhoneMobile (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfilePhoneHome (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfilePhoneOffice (JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileStatusMessage (JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileFirstName(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileLastName(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileDisplayName(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileGender(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileBirthday(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileCountry(JSONNODE *node, MCONTACT hContact = NULL); + void UpdateProfileState(JSONNODE *node, MCONTACT hContact = NULL); + void UpdateProfileCity(JSONNODE *node, MCONTACT hContact = NULL); + void UpdateProfileLanguage(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileHomepage(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileAbout(JSONNODE *node, MCONTACT hContact = NULL); + void UpdateProfileEmails(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfilePhoneMobile(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfilePhoneHome(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfilePhoneOffice(JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileStatusMessage(JSONNODE *root, MCONTACT hContact = NULL); void UpdateProfileXStatusMessage(JSONNODE *root, MCONTACT hContact = NULL); - void UpdateProfileAvatar (JSONNODE *root, MCONTACT hContact = NULL); + void UpdateProfileAvatar(JSONNODE *root, MCONTACT hContact = NULL); - void LoadProfile (const NETLIBHTTPREQUEST *response); + void LoadProfile(const NETLIBHTTPREQUEST *response); // contacts - WORD GetContactStatus (MCONTACT hContact); - void SetContactStatus (MCONTACT hContact, WORD status); - void SetAllContactsStatus (WORD status); + WORD GetContactStatus(MCONTACT hContact); + void SetContactStatus(MCONTACT hContact, WORD status); + void SetAllContactsStatus(WORD status); - void SetAvatarUrl (MCONTACT hContact, CMString &tszUrl); - void ReloadAvatarInfo (MCONTACT hContact); - void GetAvatarFileName (MCONTACT hContact, TCHAR* pszDest, size_t cbLen); + void SetAvatarUrl(MCONTACT hContact, CMString &tszUrl); + void ReloadAvatarInfo(MCONTACT hContact); + void GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen); - void OnReceiveAvatar (const NETLIBHTTPREQUEST *response, void *arg); - void OnSentAvatar (const NETLIBHTTPREQUEST *response); - void OnSearch (const NETLIBHTTPREQUEST *response); + void OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg); + void OnSentAvatar(const NETLIBHTTPREQUEST *response); + void OnSearch(const NETLIBHTTPREQUEST *response); - MCONTACT FindContact (const char *skypename); - MCONTACT AddContact (const char *skypename, bool isTemporary = false); + MCONTACT FindContact(const char *skypename); + MCONTACT AddContact(const char *skypename, bool isTemporary = false); MCONTACT GetContactFromAuthEvent(MEVENT hEvent); void LoadContactsAuth(const NETLIBHTTPREQUEST *response); void LoadContactsInfo(const NETLIBHTTPREQUEST *response); - void LoadContactList (const NETLIBHTTPREQUEST *response); + void LoadContactList(const NETLIBHTTPREQUEST *response); int __cdecl OnContactDeleted(MCONTACT, LPARAM); - void OnBlockContact (const NETLIBHTTPREQUEST *response, void *p); - void OnUnblockContact (const NETLIBHTTPREQUEST *response, void *p); + void OnBlockContact(const NETLIBHTTPREQUEST *response, void *p); + void OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p); // messages mir_cs messageSyncLock; @@ -256,19 +256,19 @@ private: void OnPrivateMessageEvent(JSONNODE *node); // sync - void OnGetServerHistory (const NETLIBHTTPREQUEST *response); - void OnSyncHistory (const NETLIBHTTPREQUEST *response); + void OnGetServerHistory(const NETLIBHTTPREQUEST *response); + void OnSyncHistory(const NETLIBHTTPREQUEST *response); void SyncHistory(); //chats void InitGroupChatModule(); void CloseAllChatChatSessions(); - MCONTACT FindChatRoom (const char *chatname); - MCONTACT AddChatRoom (const char *chatname); - + MCONTACT FindChatRoom(const char *chatname); + MCONTACT AddChatRoom(const char *chatname); + int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam); - int __cdecl OnGroupChatMenuHook (WPARAM, LPARAM lParam); + int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam); void StartChatRoom(const TCHAR *tid, const TCHAR *tname); @@ -276,8 +276,8 @@ private: void OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p); - INT_PTR __cdecl OnJoinChatRoom (WPARAM hContact, LPARAM); - INT_PTR __cdecl OnLeaveChatRoom (WPARAM hContact, LPARAM); + INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM); + INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM); void OnChatEvent(JSONNODE *node); void OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage); char *GetChatUsers(const TCHAR *chat_id); @@ -289,21 +289,21 @@ private: void RenameChat(const char *chat_id, const char *name); void ChangeChatTopic(const char * chat_id, const char *topic, const char *initiator); - static INT_PTR CALLBACK InviteDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK GcCreateDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static void ResetOptions(HWND hwndDlg); static void FilterContacts(HWND hwndDlg, CSkypeProto *ppro); void SetChatStatus(MCONTACT hContact, int iStatus); //polling - void __cdecl PollingThread (void*); - void ParsePollData (JSONNODE *data); - void ProcessEndpointPresenceRes (JSONNODE *node); - void ProcessUserPresenceRes (JSONNODE *node); - void ProcessNewMessageRes (JSONNODE *node); - void ProcessConversationUpdateRes (JSONNODE *node); - void ProcessThreadUpdateRes (JSONNODE *node); + void __cdecl PollingThread(void*); + void ParsePollData(JSONNODE *data); + void ProcessEndpointPresenceRes(JSONNODE *node); + void ProcessUserPresenceRes(JSONNODE *node); + void ProcessNewMessageRes(JSONNODE *node); + void ProcessConversationUpdateRes(JSONNODE *node); + void ProcessThreadUpdateRes(JSONNODE *node); // utils bool IsOnline(); @@ -327,10 +327,10 @@ private: void SetSrmmReadStatus(MCONTACT hContact); - char *ChatUrlToName (const char *url); - char *ContactUrlToName (const char *url); - char *SelfUrlToName (const char *url); - char *GetServerFromUrl (const char *url); + char *ChatUrlToName(const char *url); + char *ContactUrlToName(const char *url); + char *SelfUrlToName(const char *url); + char *GetServerFromUrl(const char *url); LPCTSTR ClearText(CMString &value, const TCHAR *message); @@ -344,16 +344,16 @@ private: int __cdecl ProcessSrmmEvent(WPARAM, LPARAM); //services - INT_PTR __cdecl OnIncomingCallCLE (WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl OnIncomingCallPP (WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl BlockContact (WPARAM hContact, LPARAM); - INT_PTR __cdecl UnblockContact (WPARAM hContact, LPARAM); - INT_PTR __cdecl OnRequestAuth (WPARAM hContact, LPARAM lParam); - INT_PTR __cdecl OnGrantAuth (WPARAM hContact, LPARAM); - INT_PTR __cdecl GetContactHistory (WPARAM hContact, LPARAM lParam); - INT_PTR __cdecl SvcCreateChat (WPARAM, LPARAM); - INT_PTR __cdecl ParseSkypeUriService (WPARAM, LPARAM lParam); - static INT_PTR __cdecl GlobalParseSkypeUriService (WPARAM, LPARAM lParam); + INT_PTR __cdecl OnIncomingCallCLE(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl OnIncomingCallPP(WPARAM wParam, LPARAM lParam); + INT_PTR __cdecl BlockContact(WPARAM hContact, LPARAM); + INT_PTR __cdecl UnblockContact(WPARAM hContact, LPARAM); + INT_PTR __cdecl OnRequestAuth(WPARAM hContact, LPARAM lParam); + INT_PTR __cdecl OnGrantAuth(WPARAM hContact, LPARAM); + INT_PTR __cdecl GetContactHistory(WPARAM hContact, LPARAM lParam); + INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM); + INT_PTR __cdecl ParseSkypeUriService(WPARAM, LPARAM lParam); + static INT_PTR __cdecl GlobalParseSkypeUriService(WPARAM, LPARAM lParam); template static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam) diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 0d38e61fb1..4f5d48ab95 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -78,63 +78,63 @@ void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) /*JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); if (pResponse == NULL) { - if (pParam) { - mir_free(pParam->pszFirstName); - mir_free(pParam->pszLastName); - mir_free(pParam->pszNick); - delete pParam; - } - ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); - return; + if (pParam) { + mir_free(pParam->pszFirstName); + mir_free(pParam->pszLastName); + mir_free(pParam->pszNick); + delete pParam; + } + ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); + return; } int iCount = json_as_int(json_get(pResponse, "count")); JSONNODE *pItems = json_get(pResponse, "items"); if (!pItems) { - pItems = pResponse; - iCount = 1; - } + pItems = pResponse; + iCount = 1; + } for (int i = 0; ipszFirstName) + filter = tlstrstr(psr.firstName, pParam->pszFirstName) && filter; + if (psr.lastName&&pParam->pszLastName) + filter = tlstrstr(psr.lastName, pParam->pszLastName) && filter; + if (psr.nick&&pParam->pszNick) + filter = tlstrstr(psr.nick, pParam->pszNick) && filter; + } - ptrT pId(json_as_string(json_get(pRecord, "id"))); - ptrT pFirstName(json_as_string(json_get(pRecord, "first_name"))); - ptrT pLastName(json_as_string(json_get(pRecord, "last_name"))); - ptrT pNick(json_as_string(json_get(pRecord, "nickname"))); - ptrT pDomain(json_as_string(json_get(pRecord, "domain"))); - - psr.id = mir_wstrdup(pId); - psr.firstName = mir_wstrdup(pFirstName); - psr.lastName = mir_wstrdup(pLastName); - psr.nick = mir_wstrdup(pNick); - if (!psr.nick || !psr.nick[0]) - psr.nick = mir_wstrdup(pDomain); - - bool filter = true; - if (pParam) { - if (psr.firstName&&pParam->pszFirstName) - filter = tlstrstr(psr.firstName, pParam->pszFirstName) && filter; - if (psr.lastName&&pParam->pszLastName) - filter = tlstrstr(psr.lastName, pParam->pszLastName) && filter; - if (psr.nick&&pParam->pszNick) - filter = tlstrstr(psr.nick, pParam->pszNick) && filter; - } - - if (filter) - ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); + if (filter) + ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); } ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0); if (pParam) { - mir_free(pParam->pszFirstName); - mir_free(pParam->pszLastName); - mir_free(pParam->pszNick); - delete pParam; + mir_free(pParam->pszFirstName); + mir_free(pParam->pszLastName); + mir_free(pParam->pszNick); + delete pParam; }*/ } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index d12e744bcb..1fe3523ce2 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -14,6 +14,7 @@ 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 . */ + #include "stdafx.h" void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) @@ -43,11 +44,11 @@ void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) return; } - TRouter.ccid = mir_strdup(ccid); - TRouter.connId = mir_strdup(connId); - TRouter.instance = mir_strdup(instance); - TRouter.socketIo = mir_strdup(socketio); - TRouter.url = mir_strdup(url); + TRouter.ccid = mir_strdup(ccid); + TRouter.connId = mir_strdup(connId); + TRouter.instance = mir_strdup(instance); + TRouter.socketIo = mir_strdup(socketio); + TRouter.url = mir_strdup(url); SendRequest(new CreateTrouterPoliciesRequest(TokenSecret, TRouter.connId), &CSkypeProto::OnTrouterPoliciesCreated); } @@ -78,20 +79,20 @@ void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) return; } - TRouter.st = mir_strdup(st); - TRouter.se = mir_strdup(se); + TRouter.st = mir_strdup(st); + TRouter.se = mir_strdup(se); TRouter.sig = mir_strdup(sig); SendRequest(new GetTrouterRequest - ( - TRouter.socketIo, - TRouter.connId, - TRouter.st, - TRouter.se, - TRouter.sig, - TRouter.instance, - TRouter.ccid - ), &CSkypeProto::OnGetTrouter, (void *)false); + ( + TRouter.socketIo, + TRouter.connId, + TRouter.st, + TRouter.se, + TRouter.sig, + TRouter.instance, + TRouter.ccid + ), &CSkypeProto::OnGetTrouter, (void *)false); } @@ -118,14 +119,14 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p) void CSkypeProto::OnHealth(const NETLIBHTTPREQUEST*) { - SendRequest(new GetTrouterRequest(TRouter.socketIo, - TRouter.connId, - TRouter.st, - TRouter.se, - TRouter.sig, - TRouter.instance, - TRouter.ccid), - &CSkypeProto::OnGetTrouter, (void *)true); + SendRequest(new GetTrouterRequest(TRouter.socketIo, + TRouter.connId, + TRouter.st, + TRouter.se, + TRouter.sig, + TRouter.instance, + TRouter.ccid), + &CSkypeProto::OnGetTrouter, (void *)true); } void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *) @@ -139,40 +140,40 @@ void CSkypeProto::OnTrouterEvent(JSONNODE *body, JSONNODE *) switch (evt) { case 100: //incoming call - { - ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "convoCallId"))))); - if (uid != NULL) - { - MCONTACT hContact = AddContact(_T2A(uid), true); + { + ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "convoCallId"))))); + if (uid != NULL) + { + MCONTACT hContact = AddContact(_T2A(uid), true); - MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId, _T2A(gp)); - SkinPlaySound("skype_inc_call"); + MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId, _T2A(gp)); + SkinPlaySound("skype_inc_call"); - CLISTEVENT cle = { sizeof(cle) }; - cle.flags |= CLEF_TCHAR; - cle.hContact = hContact; - cle.hDbEvent = hEvent; - cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL; - cle.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call")); + CLISTEVENT cle = { sizeof(cle) }; + cle.flags |= CLEF_TCHAR; + cle.hContact = hContact; + cle.hDbEvent = hEvent; + cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL; + cle.hIcon = Skin_GetIconByHandle(GetIconHandle("inc_call")); - CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact)); - cle.pszService = service.GetBuffer(); + CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact)); + cle.pszService = service.GetBuffer(); - CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); - cle.ptszTooltip = tooltip.GetBuffer(); + CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + cle.ptszTooltip = tooltip.GetBuffer(); - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); - ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), 0, hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL); - } - break; + ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), 0, hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL); } + break; + } case 104: //call canceled: callerId=""; conversationId=NULL; callId=call id - { - ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "callId"))))); - SkinPlaySound("skype_call_canceled"); - break; - } + { + ptrA callId(mir_t2a(ptrT(json_as_string(json_get(body, "callId"))))); + SkinPlaySound("skype_call_canceled"); + break; + } } } @@ -184,7 +185,7 @@ void CSkypeProto::TRouterThread(void*) while (!isTerminated && errors < POLLING_ERRORS_LIMIT) { - TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId) ; + TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId); request->nlc = m_TrouterConnection; NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); @@ -200,7 +201,7 @@ void CSkypeProto::TRouterThread(void*) if (response->pData) { char *json = strstr(response->pData, "{"); - if (json == NULL) + if (json == NULL) { CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); delete request; @@ -213,7 +214,7 @@ void CSkypeProto::TRouterThread(void*) OnTrouterEvent(body, headers); } } - else + else { SendRequest(new HealthTrouterRequest(TRouter.ccid), &CSkypeProto::OnHealth); CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 2d0d9dc3ae..305e94e03e 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -446,7 +446,7 @@ char *CSkypeProto::MirandaToSkypeStatus(int status) int CSkypeProto::SkypeToMirandaStatus(const char *status) { if (!mir_strcmpi(status, "Online")) - return ID_STATUS_ONLINE; + return ID_STATUS_ONLINE; else if (!mir_strcmpi(status, "Hidden")) return ID_STATUS_INVISIBLE; else if (!mir_strcmpi(status, "Away")) @@ -455,7 +455,7 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) return /*ID_STATUS_IDLE*/ID_STATUS_AWAY; else if (!mir_strcmpi(status, "Busy")) return ID_STATUS_DND; - else + else return ID_STATUS_OFFLINE; } @@ -463,27 +463,27 @@ void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, i { if (Miranda_Terminated()) return; - + if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { CMStringA className(FORMAT, "%s_", m_szModuleName); switch (type) { case 1: - { - className.Append("Error"); - break; - } + { + className.Append("Error"); + break; + } case SKYPE_DB_EVENT_TYPE_INCOMING_CALL: - { - className.Append("Call"); - break; - } + { + className.Append("Call"); + break; + } default: - { - className.Append("Notification"); - break; - } + { + className.Append("Notification"); + break; + } } POPUPDATACLASS ppd = { sizeof(ppd) }; @@ -567,7 +567,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) return 1; // skip leading prefix - TCHAR szUri[ 1024 ]; + TCHAR szUri[1024]; _tcsncpy_s(szUri, arg, _TRUNCATE); TCHAR *szJid = _tcschr(szUri, _T(':')); if (szJid == NULL) @@ -592,7 +592,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) *(szSecondParam++) = 0; // no command or message command - if (!szCommand || (szCommand && !_tcsicmp(szCommand, _T("chat")))) + if (!szCommand || (szCommand && !_tcsicmp(szCommand, _T("chat")))) { if (szSecondParam) { @@ -614,9 +614,9 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) NotifyEventHooks(m_hCallHook, (WPARAM)hContact, (LPARAM)0); return 0; } - else if (!_tcsicmp(szCommand, _T("userinfo"))){ return 0;} + else if (!_tcsicmp(szCommand, _T("userinfo"))){ return 0; } else if (!_tcsicmp(szCommand, _T("add"))) - { + { MCONTACT hContact = FindContact(_T2A(szJid)); if (hContact == NULL) { @@ -633,13 +633,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) } return 0; } - if (!_tcsicmp(szCommand, _T("sendfile"))) + if (!_tcsicmp(szCommand, _T("sendfile"))) { //CONTACT hContact = AddContact(_T2A(szJid), true); //CallService(MS_FILE_SENDFILE, hContact, NULL); return 1; } - if (!_tcsicmp(szCommand, _T("voicemail"))) + if (!_tcsicmp(szCommand, _T("voicemail"))) { return 1; } -- cgit v1.2.3