summaryrefslogtreecommitdiff
path: root/protocols/Steam/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-29 17:27:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-29 17:27:08 +0300
commitf16cf071e51f4768f20692c99414cb39521fa413 (patch)
tree7dd3cc512fe65fdd546f7753937261c518e5008c /protocols/Steam/src
parent939048b7ebce6a70c8e243fec36983de7d931e8b (diff)
PROTO_INTERFACE::setAllContactStatuses - common code moved to the core
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp6
-rw-r--r--protocols/Steam/src/steam_polling.cpp44
-rw-r--r--protocols/Steam/src/steam_proto.cpp4
-rw-r--r--protocols/Steam/src/steam_proto.h1
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);