diff options
author | George Hazan <ghazan@miranda.im> | 2017-12-29 17:27:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-29 17:27:08 +0300 |
commit | f16cf071e51f4768f20692c99414cb39521fa413 (patch) | |
tree | 7dd3cc512fe65fdd546f7753937261c518e5008c /protocols/Steam/src | |
parent | 939048b7ebce6a70c8e243fec36983de7d931e8b (diff) |
PROTO_INTERFACE::setAllContactStatuses - common code moved to the core
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 6 | ||||
-rw-r--r-- | protocols/Steam/src/steam_polling.cpp | 44 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.h | 1 |
4 files changed, 21 insertions, 34 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index fddad8a4a5..98f06662de 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -48,12 +48,6 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status) } } -void CSteamProto::SetAllContactsStatus(WORD status) -{ - for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) - SetContactStatus(hContact, status); -} - MCONTACT CSteamProto::GetContactFromAuthEvent(MEVENT hEvent) { DWORD body[3]; diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index 78ffd06c8b..2397b7531c 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -11,8 +11,7 @@ void CSteamProto::ParsePollData(const JSONNode &data) time_t timestamp = _wtol(item["utc_timestamp"].as_mstring()); MCONTACT hContact = NULL; - if (!IsMe(steamId.c_str()) && - !(hContact = FindContact(steamId.c_str()))) + if (!IsMe(steamId.c_str()) && !(hContact = FindContact(steamId.c_str()))) // probably this is info about random player playing on same server, so we ignore it continue; @@ -79,35 +78,30 @@ void CSteamProto::ParsePollData(const JSONNode &data) switch (state) { case 0: - {// removed - MCONTACT hContact = FindContact(steamId.c_str()); - if (hContact) - ContactIsRemoved(hContact); - } + hContact = FindContact(steamId.c_str()); + if (hContact) + ContactIsRemoved(hContact); break; case 1: - {// ignored - MCONTACT hContact = FindContact(steamId.c_str()); - if (hContact) - ContactIsIgnored(hContact); - } + hContact = FindContact(steamId.c_str()); + if (hContact) + ContactIsIgnored(hContact); break; case 2: - {// auth request - MCONTACT hContact = FindContact(steamId.c_str()); - if (hContact) - ContactIsAskingAuth(hContact); - else - { - // load info about this user from server - ptrA token(getStringA("TokenSecret")); - - PushRequest( - new GetUserSummariesRequest(token, steamId.c_str()), - &CSteamProto::OnAuthRequested); - } + // auth request + hContact = FindContact(steamId.c_str()); + if (hContact) + ContactIsAskingAuth(hContact); + else + { + // load info about this user from server + ptrA token(getStringA("TokenSecret")); + + PushRequest( + new GetUserSummariesRequest(token, steamId.c_str()), + &CSteamProto::OnAuthRequested); } break; diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index fd7d5cf9d8..52022b10d5 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -46,7 +46,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) db_set_resident(m_szModuleName, "ServerIP"); db_set_resident(m_szModuleName, "ServerID"); - SetAllContactsStatus(ID_STATUS_OFFLINE); + setAllContactStatuses(ID_STATUS_OFFLINE); // services CreateServiceFunction(MODULE"/MenuChoose", CSteamProto::MenuChooseService); @@ -318,7 +318,7 @@ int CSteamProto::SetStatus(int new_status) m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; if (!Miranda_IsTerminated()) - SetAllContactsStatus(ID_STATUS_OFFLINE); + setAllContactStatuses(ID_STATUS_OFFLINE); LogOut(); } diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index fee78f4b02..d53e21b009 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -147,7 +147,6 @@ protected: // contacts
void SetContactStatus(MCONTACT hContact, WORD status);
- void SetAllContactsStatus(WORD status);
MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
|