Buddy status: only online/offline dots

This commit is contained in:
Clay 2026-12-03 14:35:56 -05:00
parent 25efc314e8
commit b7ba76cc13
2 changed files with 6 additions and 9 deletions

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web OSCAR Chat</title>
<link rel="stylesheet" href="/style.css?v=28">
<link rel="stylesheet" href="/style.css?v=29">
</head>
<body>
<div id="app">
@ -98,6 +98,6 @@
</main>
</div>
<script type="module" src="/app.js?v=28"></script>
<script type="module" src="/app.js?v=29"></script>
</body>
</html>

View file

@ -148,14 +148,12 @@ export function renderUserResults(users, onOpen) {
function buddyStatus(b) {
const raw = String(b?.state || b?.status || '').toLowerCase();
if (['online', 'present', 'active'].includes(raw)) return 'online';
if (['away', 'idle', 'dnd', 'busy', 'na'].includes(raw) || Number(b?.idleMins) > 0) return 'away';
if (['offline', 'disconnected'].includes(raw)) return 'offline';
if (['online', 'present', 'active', 'away', 'idle', 'dnd', 'busy', 'na'].includes(raw)) return 'online';
if (b?.online === true || b?.online === 'true' || b?.online === 1) return 'online';
if (b?.online === false || b?.online === 'false' || b?.online === 0) return 'offline';
// If we have an object but no explicit state, default to offline/unknown.
if (b && typeof b === 'object' && !raw) return 'offline';
return raw ? 'away' : 'offline';
// Only online/offline supported; unknown defaults to offline.
return 'offline';
}
export function renderBuddies(buddies, onOpen) {
@ -167,8 +165,7 @@ export function renderBuddies(buddies, onOpen) {
? b
: (b.aimId || b.displayId || b.screenName || b.name || JSON.stringify(b));
const status = typeof b === 'string' ? 'offline' : buddyStatus(b);
const statusMsg = b?.statusMsg || b?.awayMsg || b?.statusMessage || '';
const title = statusMsg ? `${status}: ${statusMsg}` : status;
const title = status === 'online' ? 'Online' : 'Offline';
const btn = document.createElement('button');
btn.type = 'button';