From 7a2293c2b3369309db885085863a50ec2b0d186a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 9 Dec 2014 18:04:53 +0000 Subject: Steam: "Looking for trade/play" statuses write into StatusMsg git-svn-id: http://svn.miranda-ng.org/main/trunk@11306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_contacts.cpp | 46 +++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 9 deletions(-) (limited to 'protocols/Steam/src') diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index a950b8b436..96c92c285c 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -6,15 +6,44 @@ void CSteamProto::SetContactStatus(MCONTACT hContact, WORD status) if (oldStatus != status) { setWord(hContact, "Status", status); - - // If contact is offline, clear also xstatus - if (status == ID_STATUS_OFFLINE) + + // Special handling of some statuses + switch (status) { - delSetting(hContact, "XStatusId"); - delSetting(hContact, "XStatusName"); - delSetting(hContact, "XStatusMsg"); + case ID_STATUS_FREECHAT: + { + // Contact is looking to play, save it to as status message + if (hContact) + db_set_ts(hContact, "CList", "StatusMsg", TranslateT("Looking to play")); + } + break; + + case ID_STATUS_OUTTOLUNCH: + { + // Contact is looking to trade, save it to as status message + if (hContact) + db_set_ts(hContact, "CList", "StatusMsg", TranslateT("Looking to trade")); + } + break; - SetContactExtraIcon(hContact, NULL); + case ID_STATUS_OFFLINE: + { + // If contact is offline, clear also xstatus + delSetting(hContact, "XStatusId"); + delSetting(hContact, "XStatusName"); + delSetting(hContact, "XStatusMsg"); + + if (hContact) + SetContactExtraIcon(hContact, NULL); + } + // no break intentionally + + default: + { + if (hContact) + db_unset(hContact, "CList", "StatusMsg"); + } + break; } } } @@ -150,8 +179,7 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNODE *data) node = json_get(data, "personastate"); WORD steamStatus = json_as_int(node); WORD status = SteamToMirandaStatus(steamStatus); - if (hContact != NULL) - SetContactStatus(hContact, status); + SetContactStatus(hContact, status); // client node = json_get(data, "personastateflags"); -- cgit v1.2.3