diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index aa117b51d48..9a84e29ad21 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -2,7 +2,7 @@ import { Boom } from '@hapi/boom' import NodeCache from 'node-cache' import { proto } from '../../WAProto' import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults' -import { ALL_WA_PATCH_NAMES, ChatModification, ChatMutation, LTHashState, MessageUpsertType, PresenceData, SocketConfig, WABusinessHoursConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPatchName, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types' +import { ALL_WA_PATCH_NAMES, ChatModification, ChatMutation, LTHashState, MessageUpsertType, PresenceData, SocketConfig, WABusinessHoursConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPatchName, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types' import { LabelActionBody } from '../Types/Label' import { chatModificationToAppPatch, ChatMutationMap, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils' import { makeMutex } from '../Utils/make-mutex' @@ -94,6 +94,10 @@ export const makeChatsSocket = (config: SocketConfig) => { }) } + const updateMessagesPrivacy = async(value: WAPrivacyMessagesValue) => { + await privacyQuery('messages', value) + } + const updateCallPrivacy = async(value: WAPrivacyCallValue) => { await privacyQuery('calladd', value) } @@ -1027,6 +1031,7 @@ export const makeChatsSocket = (config: SocketConfig) => { updateProfileName, updateBlockStatus, updateCallPrivacy, + updateMessagesPrivacy, updateLastSeenPrivacy, updateOnlinePrivacy, updateProfilePicturePrivacy, diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts index 58018891e34..32b8af07ad8 100644 --- a/src/Types/Chat.ts +++ b/src/Types/Chat.ts @@ -17,6 +17,8 @@ export type WAReadReceiptsValue = 'all' | 'none' export type WAPrivacyCallValue = 'all' | 'known' +export type WAPrivacyMessagesValue = 'all' | 'contacts' + /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */ export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'