29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
export { isIcqScreenName } from './screenname.js';
|
|
// src/icq-presence.js - isolated best-effort ICQ presence shim.
|
|
//
|
|
// Problem: AIM users see webui login/logout presence correctly, ICQ (all-digit UIN)
|
|
// users may not. OSCAR/TOC presence semantics can differ for ICQ; this module keeps
|
|
// any ICQ-specific nudges separate from the working AIM/TOC flow.
|
|
//
|
|
// Limitation: this does not guarantee native AIM/ICQ clients see ICQ webui users online.
|
|
// That requires server-side BuddyArrived/presence behavior. See web-presence.js for the
|
|
// webui-only SSE overlay workaround.
|
|
//
|
|
// Do not add guessing here. Only safe, documented TOC commands with clear intent.
|
|
// Wrapped in try/catch by caller so failures never break normal login.
|
|
|
|
import { isIcqScreenName } from './screenname.js';
|
|
|
|
// Best-effort: after TOC signon, nudge presence for ICQ UINs.
|
|
// toc_set_idle 0 is documented by TiK/Open OSCAR Server as "not idle at all".
|
|
export function applyIcqPresenceHints(rec, { logger = console } = {}) {
|
|
try {
|
|
if (!rec?.toc || !rec?.tocConnected) return;
|
|
if (!isIcqScreenName(rec.screenName)) return;
|
|
|
|
logger.info?.(`[icq-presence] applying TOC presence hints for ${rec.screenName}`);
|
|
rec.toc.sendCommand('toc_set_idle 0');
|
|
} catch (err) {
|
|
logger.warn?.('[icq-presence] hint failed:', err?.message || err);
|
|
}
|
|
}
|