( message: Element, )
| 103 | ]; |
| 104 | |
| 105 | export const parseRoomChatState = ( |
| 106 | message: Element, |
| 107 | ): { roomJid: string; senderId: string; state: DmChatState } | null => { |
| 108 | if (message.getAttribute('type') !== 'groupchat' || textOf(message, 'body')) { |
| 109 | return null; |
| 110 | } |
| 111 | |
| 112 | const state = chatStates.find((name) => |
| 113 | childOf(message, name, NS_CHAT_STATES), |
| 114 | ); |
| 115 | const occupant = state && splitOccupant(message.getAttribute('from')); |
| 116 | const senderId = occupant && senderFromNick(occupant.nick); |
| 117 | |
| 118 | return occupant && senderId && state |
| 119 | ? { roomJid: occupant.roomJid, senderId, state } |
| 120 | : null; |
| 121 | }; |
| 122 | |
| 123 | export const parseRoomReaction = ( |
| 124 | message: Element, |
no test coverage detected