feat(feature/group-invite-v4): initial/final commit (#958)

This commit is contained in:
Rajeh Taher
2024-08-14 12:10:37 +03:00
committed by GitHub
parent 020add8b9b
commit 7c9f2ebd46
4 changed files with 48 additions and 1 deletions

View File

@@ -191,7 +191,7 @@ export const makeGroupsSocket = (config: SocketConfig) => {
]
)
const node = getBinaryNodeChild(result, action)
const participantsAffected = getBinaryNodeChildren(node!, 'participant')
const participantsAffected = getBinaryNodeChildren(node, 'participant')
return participantsAffected.map(p => {
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p }
})
@@ -232,6 +232,18 @@ export const makeGroupsSocket = (config: SocketConfig) => {
const result = getBinaryNodeChild(results, 'group')
return result?.attrs.jid
},
/**
* revoke a v4 invite for someone
* @param groupJid group jid
* @param invitedJid jid of person you invited
* @returns true if successful
*/
groupRevokeInviteV4: async(groupJid: string, invitedJid: string) => {
const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }])
return !!result
},
/**
* accept a GroupInviteMessage
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite