mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: send presence update when name changed
This commit is contained in:
@@ -466,6 +466,10 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
const processSyncActionsLocal = (actions: ChatMutation[]) => {
|
||||
const events = processSyncActions(actions, authState.creds.me!, logger)
|
||||
emitEventsFromMap(events)
|
||||
// resend available presence to update name on servers
|
||||
if(events['creds.update']?.me?.name) {
|
||||
sendPresenceUpdate('available')
|
||||
}
|
||||
}
|
||||
|
||||
const appPatch = async(patchCreate: WAPatchCreate) => {
|
||||
|
||||
@@ -583,8 +583,10 @@ export const processSyncActions = (
|
||||
name: action.contactAction!.fullName
|
||||
}
|
||||
} else if(action?.pushNameSetting) {
|
||||
map['creds.update'] = map['creds.update'] || { }
|
||||
map['creds.update'].me = { ...me, name: action?.pushNameSetting?.name! }
|
||||
if(me?.name !== action?.pushNameSetting) {
|
||||
map['creds.update'] = map['creds.update'] || { }
|
||||
map['creds.update'].me = { ...me, name: action?.pushNameSetting?.name! }
|
||||
}
|
||||
} else if(action?.pinAction) {
|
||||
update.pin = action.pinAction?.pinned ? toNumber(action.timestamp) : undefined
|
||||
} else if(action?.unarchiveChatsSetting) {
|
||||
|
||||
Reference in New Issue
Block a user