Skip to content

Commit 3637734

Browse files
committed
Change syntax to RemoveContact
1 parent fe33c47 commit 3637734

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

appstate/encode.go

+17-7
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,37 @@ func BuildMute(target types.JID, mute bool, muteDuration time.Duration) PatchInf
6363
}
6464
}
6565

66-
func BuildContact(target types.JID, fullName string, add bool) PatchInfo {
67-
operation := waServerSync.SyncdMutation_SET
68-
if !add {
69-
operation = waServerSync.SyncdMutation_REMOVE
70-
}
66+
func BuildContact(target types.JID, fullName string) PatchInfo {
7167
return PatchInfo{
7268
Type: WAPatchCriticalUnblockLow,
73-
Operation: operation,
69+
Operation: waServerSync.SyncdMutation_SET,
7470
Mutations: []MutationInfo{{
7571
Index: []string{IndexContact, target.String()},
7672
Version: 2,
7773
Value: &waSyncAction.SyncActionValue{
7874
ContactAction: &waSyncAction.ContactAction{
7975
FullName: &fullName,
80-
SaveOnPrimaryAddressbook: proto.Bool(add),
76+
SaveOnPrimaryAddressbook: proto.Bool(true),
8177
},
8278
},
8379
}},
8480
}
8581
}
8682

83+
func RemoveContact(target types.JID) PatchInfo {
84+
return PatchInfo{
85+
Type: WAPatchCriticalUnblockLow,
86+
Operation: waServerSync.SyncdMutation_REMOVE,
87+
Mutations: []MutationInfo{{
88+
Index: []string{IndexContact, target.String()},
89+
Version: 2,
90+
Value: &waSyncAction.SyncActionValue{
91+
ContactAction: &waSyncAction.ContactAction{},
92+
},
93+
}},
94+
}
95+
}
96+
8797
func newPinMutationInfo(target types.JID, pin bool) MutationInfo {
8898
return MutationInfo{
8999
Index: []string{IndexPin, target.String()},

0 commit comments

Comments
 (0)