MCPcopy Create free account
hub / github.com/dailydotdev/apps / parseChatState

Function parseChatState

packages/shared/src/features/messages/stanzas.ts:245–256  ·  view source on GitHub ↗
(
  message: Element,
  ownBareJid: string,
)

Source from the content-addressed store, hash-verified

243// XEP-0085, standalone only: a state riding on a message is implied by the
244// message itself.
245export const parseChatState = (
246 message: Element,
247 ownBareJid: string,
248): { peerId: string; senderId: string; state: DmChatState } | null => {
249 const state = chatStates.find((name) =>
250 childOf(message, name, NS_CHAT_STATES),
251 );
252 const parties =
253 state && !textOf(message, 'body') && getParties(message, ownBareJid);
254
255 return parties ? { ...parties, state } : null;
256};
257
258type Reactable = { id: string; reactions?: DmReactions };
259type ReactionChange = Pick<DmReaction, 'messageId' | 'senderId' | 'emojis'>;

Callers 2

stanzas.spec.tsFile · 0.90
onMessageFunction · 0.90

Calls 3

childOfFunction · 0.85
textOfFunction · 0.85
getPartiesFunction · 0.85

Tested by

no test coverage detected