diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/MSN/src/msn_skypeab.cpp | 25 | ||||
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 52 | ||||
-rw-r--r-- | protocols/Steam/src/steam_login.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_pooling.cpp | 8 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.h | 8 |
6 files changed, 47 insertions, 50 deletions
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 5c7c40ab6a..22821e0de8 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -41,13 +41,10 @@ bool CMsnProto::APISkypeComRequest(NETLIBHTTPREQUEST *nlhr, NETLIBHTTPHEADER *he return true;
}
-static TCHAR *get_json_str(JSONNODE *item, const char *pszValue)
+static TCHAR* get_json_str(JSONNode *item, const char *pszValue)
{
- JSONNODE *node;
- TCHAR *ret;
-
- if (node=json_get(item, pszValue)) {
- ret = json_as_string(node);
+ if (JSONNode *node = json_get(item, pszValue)) {
+ TCHAR *ret = json_as_string(node);
if (!mir_tstrcmp(ret, _T("null"))) {
mir_free(ret);
return NULL;
@@ -79,7 +76,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) JSONROOT root(nlhrReply->pData);
if (root == NULL) return false;
- JSONNODE *items = json_as_array(root), *item;
+ JSONNode *items = json_as_array(root), *item;
for (size_t i = 0; i < json_size(items); i++)
{
int lstId = LIST_FL;
@@ -134,7 +131,7 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) JSONROOT root(nlhrReply->pData);
if (root == NULL) return false;
- JSONNODE *items = json_as_array(root), *item, *node;
+ JSONNode *items = json_as_array(root), *item, *node;
for (size_t i = 0; i < json_size(items); i++)
{
item = json_at(items, i);
@@ -186,7 +183,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) hHttpsConnection = nlhrReply->nlc;
if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
JSONROOT item(nlhrReply->pData);
- JSONNODE *node;
+ JSONNode *node;
if (item == NULL) return false;
ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "username")))));
@@ -215,7 +212,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) if (value=get_json_str(item, "about")) setTString(hContact, "About", value);
if ((node = json_get(item, "emails")) && !json_empty(node))
{
- JSONNODE *items = json_as_array(node), *item;
+ JSONNode *items = json_as_array(node), *item;
char szName[16];
for (size_t i = 0; i < min(json_size(items), 3); i++)
{
@@ -382,12 +379,12 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) return false;
}
- JSONNODE *items = json_as_array(root);
+ JSONNode *items = json_as_array(root);
for (size_t i = 0; i < json_size(items); i++)
{
- JSONNODE *item = json_at(items, i);
- JSONNODE *ContactCards = json_get(item, "ContactCards");
- JSONNODE *Skype = json_get(ContactCards, "Skype");
+ JSONNode *item = json_at(items, i);
+ JSONNode *ContactCards = json_get(item, "ContactCards");
+ JSONNode *Skype = json_get(ContactCards, "Skype");
TCHAR *sDisplayName = json_as_string(json_get(Skype, "DisplayName"));
TCHAR *sSkypeName = json_as_string(json_get(Skype, "SkypeName"));
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index fa6f2c0965..72a5422e5a 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -94,9 +94,9 @@ MCONTACT CSteamProto::FindContact(const char *steamId) return hContact; } -void CSteamProto::UpdateContact(MCONTACT hContact, JSONNODE *data) +void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) { - JSONNODE *node = NULL; + JSONNode *node = NULL; // set common data node = json_get(data, "personaname"); @@ -322,15 +322,15 @@ MCONTACT CSteamProto::AddContact(const char *steamId, bool isTemporary) return hContact; } -void CSteamProto::ProcessContact(std::map<std::string, JSONNODE*>::iterator *it, MCONTACT hContact) +void CSteamProto::ProcessContact(std::map<std::string, JSONNode*>::iterator *it, MCONTACT hContact) { std::string steamId = (*it)->first; - JSONNODE *child = (*it)->second; + JSONNode *child = (*it)->second; if (!hContact) hContact = AddContact(steamId.c_str()); - JSONNODE *node = json_get(child, "friend_since"); + JSONNode *node = json_get(child, "friend_since"); if (node) db_set_dw(hContact, "UserInfo", "ContactAddTime", json_as_int(node)); @@ -365,16 +365,16 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response) std::string steamIds = ptrA(getStringA("SteamID")); - std::map<std::string, JSONNODE*> friends; + std::map<std::string, JSONNode*> friends; // Remember contacts on server - JSONNODE *node = json_get(root, "friends"); - JSONNODE *nroot = json_as_array(node); + JSONNode *node = json_get(root, "friends"); + JSONNode *nroot = json_as_array(node); if (nroot != NULL) { for (size_t i = 0; i < json_size(nroot); i++) { - JSONNODE *child = json_at(nroot, i); + JSONNode *child = json_at(nroot, i); if (child == NULL) break; @@ -397,7 +397,7 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response) if (id == NULL) continue; - std::map<std::string, JSONNODE*>::iterator it = friends.find(std::string(id)); + std::map<std::string, JSONNode*>::iterator it = friends.find(std::string(id)); if (it != friends.end()) { @@ -415,7 +415,7 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response) } // Check remaining contacts in map and add them to contact list - for (std::map<std::string, JSONNODE*>::iterator it = friends.begin(); it != friends.end();) + for (std::map<std::string, JSONNode*>::iterator it = friends.begin(); it != friends.end();) { // Contact is on server-list, but not in database, add (but not notify) it ProcessContact(&it, NULL); @@ -425,7 +425,7 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response) } friends.clear(); - // We need to delete nroot here at the end, because we had references to JSONNODE objects stored in friends map + // We need to delete nroot here at the end, because we had references to JSONNode objects stored in friends map json_delete(nroot); if (!steamIds.empty()) @@ -450,13 +450,13 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response) //std::string steamIds; - JSONNODE *node = json_get(root, "friends"); - JSONNODE *nroot = json_as_array(node); + JSONNode *node = json_get(root, "friends"); + JSONNode *nroot = json_as_array(node); if (nroot != NULL) { for (size_t i = 0; i < json_size(nroot); i++) { - JSONNODE *child = json_at(nroot, i); + JSONNode *child = json_at(nroot, i); if (child == NULL) break; @@ -492,13 +492,13 @@ void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response) if (root == NULL) return; - JSONNODE *node = json_get(root, "players"); - JSONNODE *nroot = json_as_array(node); + JSONNode *node = json_get(root, "players"); + JSONNode *nroot = json_as_array(node); if (nroot != NULL) { for (size_t i = 0; i < json_size(nroot); i++) { - JSONNODE *item = json_at(nroot, i); + JSONNode *item = json_at(nroot, i); if (item == NULL) break; @@ -601,9 +601,9 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg) if (root == NULL) return; - JSONNODE *node = json_get(root, "players"); - JSONNODE *nodes = json_as_array(node); - JSONNODE *nroot = json_at(nodes, 0); + JSONNode *node = json_get(root, "players"); + JSONNode *nodes = json_as_array(node); + JSONNode *nroot = json_at(nodes, 0); if (nroot != NULL) { @@ -665,7 +665,7 @@ void CSteamProto::OnPendingApproved(const NETLIBHTTPREQUEST *response, void *arg if (root == NULL) return; - JSONNODE *node = json_get(root, "success"); + JSONNode *node = json_get(root, "success"); if (json_as_int(node) == 0) { node = json_get(root, "error_text"); @@ -685,7 +685,7 @@ void CSteamProto::OnPendingIgnoreded(const NETLIBHTTPREQUEST *response, void *ar if (root == NULL) return; - JSONNODE *node = json_get(root, "success"); + JSONNode *node = json_get(root, "success"); if (json_as_int(node) == 0) { node = json_get(root, "error_text"); @@ -706,9 +706,9 @@ void CSteamProto::OnSearchByIdEnded(const NETLIBHTTPREQUEST *response, void *arg if (root == NULL) return; - JSONNODE *node = json_get(root, "players"); - JSONNODE *nodes = json_as_array(node); - JSONNODE *nroot = json_at(nodes, 0); + JSONNode *node = json_get(root, "players"); + JSONNode *nodes = json_as_array(node); + JSONNode *nroot = json_at(nodes, 0); if (nroot != NULL) { diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 2002586053..6128428dbe 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -269,7 +269,7 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response) JSONROOT root(response->pData);
- JSONNODE *node = json_get(root, "error");
+ JSONNode *node = json_get(root, "error");
ptrT error(json_as_string(node));
if (mir_tstrcmpi(error, _T("OK")) || response->resultCode == HTTP_STATUS_UNAUTHORIZED)
{
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index 5a55919a07..563923c919 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -23,7 +23,7 @@ void CSteamProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) if (response != NULL && response->resultCode == HTTP_STATUS_OK)
{
JSONROOT root(response->pData);
- JSONNODE *node = json_get(root, "error");
+ JSONNode *node = json_get(root, "error");
if (node)
error = json_as_string(node);
}
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp index b6cb91f56e..71d1b20f0e 100644 --- a/protocols/Steam/src/steam_pooling.cpp +++ b/protocols/Steam/src/steam_pooling.cpp @@ -2,9 +2,9 @@ #define POLLING_ERRORS_LIMIT 3 -void CSteamProto::ParsePollData(JSONNODE *data) +void CSteamProto::ParsePollData(JSONNode *data) { - JSONNODE *node, *item = NULL; + JSONNode *node, *item = NULL; std::string steamIds; for (size_t i = 0; i < json_size(data); i++) @@ -192,7 +192,7 @@ void CSteamProto::PollingThread(void*) errors = 0; JSONROOT root(response->pData); - JSONNODE *node = json_get(root, "error"); + JSONNode *node = json_get(root, "error"); ptrT error(json_as_string(node)); if (!lstrcmpi(error, _T("OK"))) @@ -201,7 +201,7 @@ void CSteamProto::PollingThread(void*) messageId = json_as_int(node); node = json_get(root, "messages"); - JSONNODE *nroot = json_as_array(node); + JSONNode *nroot = json_as_array(node); if (nroot != NULL) { diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index fc82986b67..4b4dcaa40a 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -27,7 +27,7 @@ struct SendMessageParam struct STEAM_SEARCH_RESULT
{
PROTOSEARCHRESULT hdr;
- JSONNODE *data;
+ JSONNode *data;
};
enum
@@ -129,7 +129,7 @@ protected: static void MirFreeArg(void *arg) { mir_free(arg); }
// pooling thread
- void ParsePollData(JSONNODE *data);
+ void ParsePollData(JSONNode *data);
void __cdecl PollingThread(void*);
// account
@@ -153,8 +153,8 @@ protected: MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
- void UpdateContact(MCONTACT hContact, JSONNODE *data);
- void ProcessContact(std::map<std::string, JSONNODE*>::iterator *it, MCONTACT hContact);
+ void UpdateContact(MCONTACT hContact, JSONNode *data);
+ void ProcessContact(std::map<std::string, JSONNode*>::iterator *it, MCONTACT hContact);
void ContactIsRemoved(MCONTACT hContact);
void ContactIsFriend(MCONTACT hContact);
|