Friends, presence and privacy
=============================

Where it lives
  zeal_accounts/store.py     friendships, requests, blocks, social_settings
  ranked_lobby/service.py    presence (from open Ranked lobby sessions), invites
  client_native/Ranked.cpp   friends feeder 93, idle report, privacy toggles
  client_native/RankedMenus.hpp   bottom-right FRIENDS (n ONLINE) button
  client_menu/ui_mp/scriptmenus/ranked_friends.menu

Friends screen (Ranked -> FRIENDS, bottom right, always visible)
  NAME | STATUS | DOING
  STATUS  ^2Online  ^3Away (no keyboard/mouse input for 5 minutes, AWAY_AFTER)
          ^1Offline, or REQUEST RECEIVED / REQUEST SENT / BLOCKED
  DOING   In menus | In a party (3/8) | Ranked: Searching | Ranked: In Game - <map>
          | In "<server hostname>" (public server, from the client's report)
  Order   requests to answer, online, away, offline, sent requests, blocked
  INVITE shows for a friend who is solo while your party has room (max 8).
  JOIN GAME shows for a friend on a public server and connects you to it.
  The party screen refreshes the list every 15 s for the online count.

Lobby friends response (POST /v1/friends, /v1/social)
  friends[]: name, kind, status (unchanged legacy set for old clients),
             presence online|away|offline, activity offline|party|server|
             ranked_searching|ranked_ingame, party 0..8, map, mode,
             server, server_name, can_invite, can_join, dnd bool
             (Do Not Disturb is presence "away" + dnd true, so older
             clients that only know online|away|offline still parse it)
  settings:  requests everyone|nobody, invisible bool, status auto|away|dnd
  Clients send "idle" (seconds since last input) and "public_server"
  {address, name} or null with every lobby request.

Privacy (stored per account in social_settings; missing row = defaults)
  RECEIVE FRIEND REQUESTS: YES | NO (everyone | nobody)
    nobody: others get requests_closed; the player can still send requests and
    friends added that way work normally.
  MY STATUS: ONLINE | AFK | DND | OFFLINE (client cycles them)
    ONLINE  status auto, invisible false: Online, AFK after 5 idle minutes.
    AFK     status away: always AFK.
    DND     status dnd: friends see DND and cannot invite them (friend_dnd);
            the player can still invite and play.
    OFFLINE invisible true: friends see Offline with no activity and cannot
            invite them (friend_offline); the player can still invite and play.
  The friends list draws OFFLINE / AFK / ONLINE / DND badges from
  client_menu/artwork/status-badges.png (512x132 sprites, in that order).
  POST /v1/social {requests?, invisible?, status?} saves and returns the list.
  The status column is added to existing account databases on start-up.

Limits: see docs/NOTES.txt (presence needs the party session to be open).

Tests: python -m unittest tests.test_ranked_social
