diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-09 19:32:39 +0300 |
commit | df6b0c988eb26339d4c7e4a1d0fe3b9717703c28 (patch) | |
tree | 5b4960edd6c9186e1fbc14f83f7f08a6a842f0a7 /protocols/MSN/src | |
parent | 303dd9297732fc943ed3e20ab37587f0c009dfe5 (diff) |
more loop-related code cleaning
Diffstat (limited to 'protocols/MSN/src')
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 6 | ||||
-rw-r--r-- | protocols/MSN/src/msn_lists.cpp | 16 | ||||
-rw-r--r-- | protocols/MSN/src/msn_skypeab.cpp | 30 | ||||
-rw-r--r-- | protocols/MSN/src/msn_srv.cpp | 13 |
4 files changed, 13 insertions, 52 deletions
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 2ed9979947..fe9b611941 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -152,9 +152,9 @@ void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole) const wchar_t *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID)
{
if (thread)
- for (int j = 0; j < thread->mJoinedContacts.getCount(); j++)
- if (!mir_strcmp(thread->mJoinedContacts[j]->WLID, pszWLID))
- return thread->mJoinedContacts[j]->role;
+ for (auto &it : thread->mJoinedContacts)
+ if (!mir_strcmp(it->WLID, pszWLID))
+ return it->role;
return nullptr;
}
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 0953685dde..c103be86f3 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -297,21 +297,9 @@ void CMsnProto::MSN_CreateContList(void) cxml.AppendFormat("<c n=\"%s\" t=\"%d\"><s l=\"%d\" n=\"PE\"/><s l=\"%d\" n=\"IM\"/><s l=\"%d\" n=\"SKP\"/><s l=\"%d\" n=\"PUB\"/></c>", C.email, C.netId, list, list, list, list);
used[j] = true;
}
- /* Seems to be unused in Skype and causing errors
- else if (dom != NULL && lastds != NULL && _stricmp(lastds, dom) == 0) {
- if (newdom) {
- cxml.AppendFormat("<d n=\"%s\">", lastds + 1);
- newdom = false;
- }
-
- *(char*)dom = 0;
- cxml.AppendFormat("<c n=\"%s\" t=\"%d\"><s n=\"IM\" l=\"%d\"/></c>", C.email, C.netId, C.list & ~(LIST_RL | LIST_LL));
- *(char*)dom = '@';
- used[j] = true;
- }
- */
}
- if (!newdom) cxml.Append(lastds ? "</d>" : "</skp>");
+ if (!newdom)
+ cxml.Append(lastds ? "</d>" : "</skp>");
}
}
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index c551866a78..571dcf63b3 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -405,33 +405,3 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) else hHttpsConnection = nullptr;
return bRet;
}
-
-/*
-class GetContactsInfoRequest : public HttpRequest
-{
-public:
- GetContactsInfoRequest(const char *token, const LIST<char> &skypenames, const char *skypename = "self") :
- HttpRequest(REQUEST_POST, FORMAT, "api.skype.com/users/%s/contacts/profiles", skypename)
- {
- Headers
- << CHAR_VALUE("X-Skypetoken", token)
- << CHAR_VALUE("Accept", "application/json");
-
- for (int i = 0; i < skypenames.getCount(); i++)
- Body << CHAR_VALUE("contacts[]", skypenames[i]);
- }
-};
-
-class GetContactStatusRequest : public HttpRequest
-{
-public:
- GetContactStatusRequest(const char *regToken, const char *skypename, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/contacts/8:%s/presenceDocs/messagingService", server, skypename)
- {
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- }
-};
-
-*/
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index a3e5181f73..cc9ff30f2b 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -177,19 +177,22 @@ void CMsnProto::MSN_RemoveEmptyGroups(void) int count = -1;
for (;;) {
MsnContact *msc = Lists_GetNext(count);
- if (msc == nullptr) break;
+ if (msc == nullptr)
+ break;
char szGroupID[100];
if (!db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID))) {
const char *pId = szGroupID;
int i = m_arGroups.getIndex((ServerGroupItem*)&pId);
- if (i > -1) ++cCount[i];
+ if (i > -1)
+ ++cCount[i];
}
}
- for (int i = m_arGroups.getCount(); i--;) {
- if (cCount[i] == 0) MSN_DeleteServerGroup(m_arGroups[i]->id);
- }
+ for (int i = m_arGroups.getCount(); i--;)
+ if (cCount[i] == 0)
+ MSN_DeleteServerGroup(m_arGroups[i]->id);
+
mir_free(cCount);
}
|