fix: send message to LID addressing_mode groups

This commit is contained in:
canove
2025-04-23 10:17:30 -03:00
parent fb1d21b312
commit 53d6e3a8d5
3 changed files with 11 additions and 1 deletions

View File

@@ -339,6 +339,7 @@ export const extractGroupMetadata = (result: BinaryNode) => {
const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add' const memberAddMode = getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add'
const metadata: GroupMetadata = { const metadata: GroupMetadata = {
id: groupId, id: groupId,
addressingMode: group.attrs.addressing_mode,
subject: group.attrs.subject, subject: group.attrs.subject,
subjectOwner: group.attrs.s_o, subjectOwner: group.attrs.s_o,
subjectTime: +group.attrs.s_t, subjectTime: +group.attrs.s_t,

View File

@@ -406,6 +406,13 @@ export const makeMessagesSocket = (config: SocketConfig) => {
participantsList.push(...statusJidList) participantsList.push(...statusJidList)
} }
if(!isStatus) {
additionalAttributes = {
...additionalAttributes,
addressing_mode: groupData?.addressingMode || 'pn'
}
}
const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false) const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false)
devices.push(...additionalDevices) devices.push(...additionalDevices)
} }
@@ -429,7 +436,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
const senderKeyJids: string[] = [] const senderKeyJids: string[] = []
// ensure a connection is established with every device // ensure a connection is established with every device
for(const { user, device } of devices) { for(const { user, device } of devices) {
const jid = jidEncode(user, isLid ? 'lid' : 's.whatsapp.net', device) const jid = jidEncode(user, groupData?.addressingMode ? 'lid' : 's.whatsapp.net', device)
if(!senderKeyMap[jid] || !!participant) { if(!senderKeyMap[jid] || !!participant) {
senderKeyJids.push(jid) senderKeyJids.push(jid)
// store that this person has had the sender keys sent to them // store that this person has had the sender keys sent to them

View File

@@ -10,6 +10,8 @@ export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin
export interface GroupMetadata { export interface GroupMetadata {
id: string id: string
/** group uses 'lid' or 'pn' to send messages */
addressingMode: string
owner: string | undefined owner: string | undefined
subject: string subject: string
/** group subject owner */ /** group subject owner */