fix: read receipts

This commit is contained in:
Adhiraj Singh
2021-11-06 15:41:49 +05:30
parent 12eb181e37
commit 5a33fd85a4
3 changed files with 38 additions and 27 deletions

View File

@@ -13,7 +13,8 @@ export const makeChatsSocket = (config: SocketConfig) => {
authState,
generateMessageTag,
sendNode,
query
query,
fetchPrivacySettings,
} = sock
const interactiveQuery = async(userNodes: BinaryNode[], queryNode: BinaryNode) => {
@@ -145,28 +146,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
})
}
const fetchPrivacySettings = async() => {
const result = await query({
tag: 'iq',
attrs: {
xmlns: 'privacy',
to: S_WHATSAPP_NET,
type: 'get'
},
content: [
{ tag: 'privacy', attrs: { } }
]
})
const nodes = getBinaryNodeChildren(result, 'category')
const settings = nodes.reduce(
(dict, { attrs }) => {
dict[attrs.name] = attrs.value
return dict
}, { } as { [_: string]: string }
)
return settings
}
const updateAccountSyncTimestamp = async() => {
await sendNode({
tag: 'iq',
@@ -486,7 +465,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
profilePictureUrl,
onWhatsApp,
fetchBlocklist,
fetchPrivacySettings,
fetchStatus,
updateProfilePicture,
updateBlockStatus,