mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chats: stop using getMessage to decrypt poll votes
The new expected behavior is to decrypt the new votes yourself like in the Example.ts file
This commit is contained in:
@@ -896,7 +896,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
keyStore: authState.keys,
|
keyStore: authState.keys,
|
||||||
logger,
|
logger,
|
||||||
options: config.options,
|
options: config.options,
|
||||||
getMessage: config.getMessage,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { AxiosRequestConfig } from 'axios'
|
import { AxiosRequestConfig } from 'axios'
|
||||||
import { proto } from '../../WAProto'
|
import { proto } from '../../WAProto'
|
||||||
import { AuthenticationCreds, BaileysEventEmitter, CacheStore, Chat, GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod, SignalKeyStoreWithTransaction, SocketConfig, WAMessageStubType } from '../Types'
|
import { AuthenticationCreds, BaileysEventEmitter, CacheStore, Chat, GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod, SignalKeyStoreWithTransaction, WAMessageStubType } from '../Types'
|
||||||
import { getContentType, normalizeMessageContent } from '../Utils/messages'
|
import { getContentType, normalizeMessageContent } from '../Utils/messages'
|
||||||
import { areJidsSameUser, isJidBroadcast, isJidStatusBroadcast, jidNormalizedUser } from '../WABinary'
|
import { areJidsSameUser, isJidBroadcast, isJidStatusBroadcast, jidNormalizedUser } from '../WABinary'
|
||||||
import { aesDecryptGCM, hmacSign } from './crypto'
|
import { aesDecryptGCM, hmacSign } from './crypto'
|
||||||
import { getKeyAuthor, toNumber } from './generics'
|
import { toNumber } from './generics'
|
||||||
import { downloadAndProcessHistorySyncNotification } from './history'
|
import { downloadAndProcessHistorySyncNotification } from './history'
|
||||||
import { ILogger } from './logger'
|
import { ILogger } from './logger'
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@ type ProcessMessageContext = {
|
|||||||
creds: AuthenticationCreds
|
creds: AuthenticationCreds
|
||||||
keyStore: SignalKeyStoreWithTransaction
|
keyStore: SignalKeyStoreWithTransaction
|
||||||
ev: BaileysEventEmitter
|
ev: BaileysEventEmitter
|
||||||
getMessage: SocketConfig['getMessage']
|
|
||||||
logger?: ILogger
|
logger?: ILogger
|
||||||
options: AxiosRequestConfig<{}>
|
options: AxiosRequestConfig<{}>
|
||||||
}
|
}
|
||||||
@@ -158,8 +157,7 @@ const processMessage = async(
|
|||||||
creds,
|
creds,
|
||||||
keyStore,
|
keyStore,
|
||||||
logger,
|
logger,
|
||||||
options,
|
options
|
||||||
getMessage
|
|
||||||
}: ProcessMessageContext
|
}: ProcessMessageContext
|
||||||
) => {
|
) => {
|
||||||
const meId = creds.me!.id
|
const meId = creds.me!.id
|
||||||
@@ -418,9 +416,11 @@ const processMessage = async(
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(content?.pollUpdateMessage) {
|
} /* else if(content?.pollUpdateMessage) {
|
||||||
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey!
|
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey!
|
||||||
// we need to fetch the poll creation message to get the poll enc key
|
// we need to fetch the poll creation message to get the poll enc key
|
||||||
|
// TODO: make standalone, remove getMessage reference
|
||||||
|
// TODO: Remove entirely
|
||||||
const pollMsg = await getMessage(creationMsgKey)
|
const pollMsg = await getMessage(creationMsgKey)
|
||||||
if(pollMsg) {
|
if(pollMsg) {
|
||||||
const meIdNormalised = jidNormalizedUser(meId)
|
const meIdNormalised = jidNormalizedUser(meId)
|
||||||
@@ -464,7 +464,7 @@ const processMessage = async(
|
|||||||
'poll creation message not found, cannot decrypt update'
|
'poll creation message not found, cannot decrypt update'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
if(Object.keys(chat).length > 1) {
|
if(Object.keys(chat).length > 1) {
|
||||||
ev.emit('chats.update', [chat])
|
ev.emit('chats.update', [chat])
|
||||||
|
|||||||
Reference in New Issue
Block a user