diff options
author | George Hazan <ghazan@miranda.im> | 2019-06-27 14:48:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-06-27 14:48:44 +0300 |
commit | 0af77111dfb30477ef9e722f1c77091a49a8be8f (patch) | |
tree | de68af5ec346f4f12246bbeb264624b4623be692 /protocols | |
parent | 0f4542cbcbb9dfb24f97fbe16bb29d7c00ccb787 (diff) |
Skype: minor code cleaning
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/SkypeWeb.vcxproj | 5 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_search.cpp | 7 |
6 files changed, 17 insertions, 20 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj index a9be1cb561..2cae8ae42e 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj @@ -44,6 +44,11 @@ <ClInclude Include="src\requests\oauth.h" />
<ClInclude Include="src\requests\asm\files.h" />
</ItemGroup>
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <ExceptionHandling>Sync</ExceptionHandling>
+ </ClCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\..\libs\freeimage\freeimage.vcxproj">
<Project>{5D14CFF3-0D17-4528-99EA-DE9DCA47CC2E}</Project>
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index f5459015fc..d253b9219a 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -62,12 +62,10 @@ void CSkypeProto::EditEvent(MCONTACT hContact, MEVENT hEvent, const char *szCont if (jMsg) { JSONNode &jEdits = jMsg["edits"]; if (jEdits) { - for (auto it = jEdits.begin(); it != jEdits.end(); ++it) { - const JSONNode &jEdit = *it; - - if (jEdit["time"].as_int() == edit_time) + for (auto &it : jEdits) + if (it["time"].as_int() == edit_time) return; - } + JSONNode jEdit; jEdit << JSONNode("time", (long)edit_time) diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 60e51ce522..a9547b872e 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -32,14 +32,12 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) JSONNode &jOriginalMsg = jMsg["original_message"];
szText.AppendFormat(bUseBB ? Translate("[b]Original message:[/b]\n%s\n") : Translate("Original message:\n%s\n"), mir_utf8decodeA(jOriginalMsg["text"].as_string().c_str()));
JSONNode &jEdits = jMsg["edits"];
- for (auto it = jEdits.begin(); it != jEdits.end(); ++it) {
- const JSONNode &jEdit = *it;
-
- time_t time = jEdit["time"].as_int();
+ for (auto &it : jEdits) {
+ time_t time = it["time"].as_int();
char szTime[MAX_PATH];
strftime(szTime, sizeof(szTime), "%X %x", localtime(&time));
- szText.AppendFormat(bUseBB ? Translate("[b]Edited at %s:[/b]\n%s\n") : Translate("Edited at %s:\n%s\n"), szTime, mir_utf8decodeA(jEdit["text"].as_string().c_str()));
+ szText.AppendFormat(bUseBB ? Translate("[b]Edited at %s:[/b]\n%s\n") : Translate("Edited at %s:\n%s\n"), szTime, mir_utf8decodeA(it["text"].as_string().c_str()));
}
}
}
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 750bca2a17..cb3ea22bce 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -79,8 +79,7 @@ void CSkypeProto::ParsePollData(const char *szData) const JSONNode &node = data["eventMessages"];
if (!node) return;
- for (auto it = node.begin(); it != node.end(); ++it) {
- const JSONNode &message = *it;
+ for (auto &message : node) {
const JSONNode &resType = message["resourceType"];
const JSONNode &resource = message["resource"];
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 70779bdc57..6c40be3f62 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -99,10 +99,8 @@ private: ~contacts_list()
{
- for (auto it = m_cache.begin(); it != m_cache.end(); ++it)
- {
- mir_free(it->second);
- }
+ for (auto &it : m_cache)
+ mir_free(it.second);
}
const char* operator[](MCONTACT hContact)
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 28a3a32344..d71d825034 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -26,9 +26,8 @@ HANDLE CSkypeProto::SearchBasic(const wchar_t* id) void CSkypeProto::SearchBasicThread(void* id)
{
debugLogA("CSkypeProto::OnSearchBasicThread");
- if (IsOnline()) {
+ if (IsOnline())
SendRequest(new GetSearchRequest(mir_urlEncode(T2Utf((wchar_t*)id)), li), &CSkypeProto::OnSearch);
- }
}
void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response)
@@ -52,8 +51,8 @@ void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) }
const JSONNode &items = root["results"].as_array();
- for (auto it = items.begin(); it != items.end(); ++it) {
- const JSONNode &item = (*it)["nodeProfileData"];
+ for (auto &it : items) {
+ const JSONNode &item = it["nodeProfileData"];
std::string skypeId = item["skypeId"].as_string();
std::string name = item["name"].as_string();
|