diff options
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 111 |
1 files changed, 58 insertions, 53 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index f34886c723..462bd6cb1f 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -98,36 +98,38 @@ void CSteamProto::OnGotFriendInfo(const CMsgClientPersonaState &reply, const CMs } // set name - if (F->player_name) { - CMStringW realName(Utf2T(F->player_name)); - - // set a nickname for group chat user? - if (si) { - CMStringW wszUserId(FORMAT, L"%lld", F->friendid); - GCEVENT gce = { si, GC_EVENT_NICK }; - gce.pszUID.w = wszUserId; - gce.pszText.w = realName; - Chat_Event(&gce); - continue; - } + if (!F->clan_data) { + if (F->player_name) { + CMStringW realName(Utf2T(F->player_name)); + + // set a nickname for group chat user? + if (si) { + CMStringW wszUserId(FORMAT, L"%lld", F->friendid); + GCEVENT gce = { si, GC_EVENT_NICK }; + gce.pszUID.w = wszUserId; + gce.pszText.w = realName; + Chat_Event(&gce); + continue; + } - setWString(hContact, "Nick", realName); + setWString(hContact, "Nick", realName); - int pos = realName.Find(L' ', 1); - if (pos != -1) { - setWString(hContact, "FirstName", realName.Mid(0, pos)); - setWString(hContact, "LastName", realName.Mid(pos + 1)); + int pos = realName.Find(L' ', 1); + if (pos != -1) { + setWString(hContact, "FirstName", realName.Mid(0, pos)); + setWString(hContact, "LastName", realName.Mid(pos + 1)); + } + else { + setWString(hContact, "FirstName", realName); + delSetting(hContact, "LastName"); + } } else { - setWString(hContact, "FirstName", realName); + delSetting(hContact, "Nick"); + delSetting(hContact, "FirstName"); delSetting(hContact, "LastName"); } } - else { - delSetting(hContact, "Nick"); - delSetting(hContact, "FirstName"); - delSetting(hContact, "LastName"); - } // avatar if (F->avatar_hash.len != 0) { @@ -158,37 +160,28 @@ void CSteamProto::OnGotFriendInfo(const CMsgClientPersonaState &reply, const CMs } // client - auto stateflags = F->persona_state_flags; - if (stateflags == PersonaStateFlag::None) { - // nothing special, either standard client or in different status (only online, I want to play, I want to trade statuses support this flags) - uint16_t status = getWord(hContact, "Status", ID_STATUS_OFFLINE); - if (status == ID_STATUS_ONLINE || status == ID_STATUS_FREECHAT) - setWString(hContact, "MirVer", L"Steam"); - } - else if (stateflags & PersonaStateFlag::InJoinableGame) { - // game - setWString(hContact, "MirVer", L"Steam (in game)"); - } - else if (stateflags & PersonaStateFlag::ClientTypeWeb) { - // on website - setWString(hContact, "MirVer", L"Steam (website)"); - } - else if (stateflags & PersonaStateFlag::ClientTypeMobile) { - // on mobile - setWString(hContact, "MirVer", L"Steam (mobile)"); - } - else if (stateflags & PersonaStateFlag::ClientTypeBigPicture) { - // on big picture - setWString(hContact, "MirVer", L"Steam (Big Picture)"); - } - else if (stateflags & PersonaStateFlag::ClientTypeVR) { - // on VR - setWString(hContact, "MirVer", L"Steam (VR)"); - } - else { - // none/unknown (e.g. when contact is offline) - delSetting(hContact, "MirVer"); + if (F->has_persona_state_flags) { + auto stateflags = F->persona_state_flags; + if (stateflags == PersonaStateFlag::None) { + // nothing special, either standard client or in different status (only online, I want to play, I want to trade statuses support this flags) + uint16_t status = getWord(hContact, "Status", ID_STATUS_OFFLINE); + if (status == ID_STATUS_ONLINE || status == ID_STATUS_FREECHAT) + setWString(hContact, "MirVer", L"Steam"); + } + else if (stateflags & PersonaStateFlag::InJoinableGame) // game + setWString(hContact, "MirVer", L"Steam (in game)"); + else if (stateflags & PersonaStateFlag::ClientTypeWeb) // on website + setWString(hContact, "MirVer", L"Steam (website)"); + else if (stateflags & PersonaStateFlag::ClientTypeMobile) // on mobile + setWString(hContact, "MirVer", L"Steam (mobile)"); + else if (stateflags & PersonaStateFlag::ClientTypeBigPicture) // on big picture + setWString(hContact, "MirVer", L"Steam (Big Picture)"); + else if (stateflags & PersonaStateFlag::ClientTypeVR) // on VR + setWString(hContact, "MirVer", L"Steam (VR)"); + else // none/unknown (e.g. when contact is offline) + delSetting(hContact, "MirVer"); } + else delSetting(hContact, "MirVer"); // playing game auto gameId = F->has_game_played_app_id ? F->game_played_app_id : 0; @@ -232,6 +225,18 @@ void CSteamProto::OnGotFriendInfo(const CMsgClientPersonaState &reply, const CMs SetContactExtraIcon(hContact, NULL); } + + // clan information + if (auto *cd = F->clan_data) { + if (F->player_name) + setUString(hContact, "Nick", F->player_name); + + setByte(hContact, "ChatRoom", GCW_SERVER); + if (cd->has_chat_group_id) + SetId(hContact, DBKEY_CHAT_ID, cd->chat_group_id); + else + delSetting(hContact, DBKEY_CHAT_ID); + } } } |