summaryrefslogtreecommitdiff
path: root/protocols/Steam
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-01-17 23:11:36 +0300
committeraunsane <aunsane@gmail.com>2018-01-17 23:11:36 +0300
commitfc14cd04c3894702603bb4db7e56258608c5c8d7 (patch)
tree43b5315d3f20090cf4ebb4e5828a573bb6ec6ff7 /protocols/Steam
parentbf928bd6cfa3df39b4cfda0ff5a5825105cf4a56 (diff)
Steam: fixed #1106
Diffstat (limited to 'protocols/Steam')
-rw-r--r--protocols/Steam/src/steam_contacts.cpp6
-rw-r--r--protocols/Steam/src/steam_events.cpp30
-rw-r--r--protocols/Steam/src/steam_history.cpp22
-rw-r--r--protocols/Steam/src/steam_options.cpp20
4 files changed, 34 insertions, 44 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 894853f46b..2d11ef2d37 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -369,11 +369,11 @@ void CSteamProto::UpdateContactRelationship(MCONTACT hContact, const JSONNode &d
return;
json_string relationship = node.as_string();
- if (!mir_strcmp(relationship.c_str(), "friend"))
+ if (relationship == "friend")
ContactIsFriend(hContact);
- else if (!mir_strcmp(relationship.c_str(), "ignoredfriend"))
+ else if (relationship == "ignoredfriend")
ContactIsBlocked(hContact);
- else if (!mir_strcmp(relationship.c_str(), "requestrecipient"))
+ else if (relationship == "requestrecipient")
ContactIsAskingAuth(hContact);
}
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp
index 0a5f7d4fde..9c37a9d74e 100644
--- a/protocols/Steam/src/steam_events.cpp
+++ b/protocols/Steam/src/steam_events.cpp
@@ -22,35 +22,15 @@ INT_PTR CSteamProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
return (INT_PTR)(CSteamOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
}
-int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInstance;
- odp.szTitle.w = m_tszUserName;
- odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
- odp.szGroup.w = LPGENW("Network");
-
- odp.szTab.w = LPGENW("Account");
- odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this);
- Options_AddPage(wParam, &odp);
-
- odp.szTab.w = LPGENW("Blocked contacts");
- odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this);
- Options_AddPage(wParam, &odp);
- return 0;
-}
-
int CSteamProto::OnIdleChanged(WPARAM, LPARAM lParam)
{
bool idle = (lParam & IDF_ISIDLE) != 0;
bool privacy = (lParam & IDF_PRIVACY) != 0;
// Respect user choice about (not) notifying idle to protocols
- if (privacy)
- {
+ if (privacy) {
// Reset it to 0 if there is some time already
- if (m_idleTS)
- {
+ if (m_idleTS) {
m_idleTS = 0;
delSetting("IdleTS");
}
@@ -62,8 +42,7 @@ int CSteamProto::OnIdleChanged(WPARAM, LPARAM lParam)
if (idle && m_idleTS > 0)
return 0;
- if (idle)
- {
+ if (idle) {
// User started being idle
MIRANDA_IDLE_INFO mii;
Idle_GetInfo(mii);
@@ -72,8 +51,7 @@ int CSteamProto::OnIdleChanged(WPARAM, LPARAM lParam)
m_idleTS = now() - mii.idleTime * 60;
setDword("IdleTS", m_idleTS);
}
- else
- {
+ else {
// User stopped being idle
m_idleTS = 0;
delSetting("IdleTS");
diff --git a/protocols/Steam/src/steam_history.cpp b/protocols/Steam/src/steam_history.cpp
index a7f0d22e61..d78da4b4bd 100644
--- a/protocols/Steam/src/steam_history.cpp
+++ b/protocols/Steam/src/steam_history.cpp
@@ -44,13 +44,16 @@ void CSteamProto::OnGotHistoryMessages(const JSONNode &root, void *arg)
{
ptrA cSteamId((char*)arg);
+ MCONTACT hContact = GetContact(cSteamId);
+ if (!hContact)
+ return;
+
if (root.isnull())
return;
JSONNode response = root["response"];
JSONNode messages = response["messages"].as_array();
- for (size_t i = messages.size(); i > 0; i--)
- {
+ for (size_t i = messages.size(); i > 0; i--) {
JSONNode message = messages[i - 1];
long long accountId = _wtoi64(message["accountid"].as_mstring());
@@ -68,20 +71,9 @@ void CSteamProto::OnGotHistoryMessages(const JSONNode &root, void *arg)
recv.timestamp = timestamp;
recv.szMessage = (char*)text.c_str();
- MCONTACT hContact = GetContact(cSteamId);
- if (!hContact)
- return;
-
if (IsMe(steamId))
- {
- // Received message
- ProtoChainRecvMsg(hContact, &recv);
- }
- else
- {
- // Sent message
recv.flags = PREF_SENT;
- Proto_RecvMessage(hContact, &recv);
- }
+
+ Proto_RecvMessage(hContact, &recv);
}
}
diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp
index c5898bea86..e87775e68d 100644
--- a/protocols/Steam/src/steam_options.cpp
+++ b/protocols/Steam/src/steam_options.cpp
@@ -69,4 +69,24 @@ void CSteamOptionsBlockList::OnInitDialog()
void CSteamOptionsBlockList::OnBlock(CCtrlButton*)
{
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.hInstance = g_hInstance;
+ odp.szTitle.w = m_tszUserName;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ odp.szGroup.w = LPGENW("Network");
+
+ odp.szTab.w = LPGENW("Account");
+ odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this);
+ Options_AddPage(wParam, &odp);
+
+ odp.szTab.w = LPGENW("Blocked contacts");
+ odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this);
+ Options_AddPage(wParam, &odp);
+ return 0;
} \ No newline at end of file