While matchedContact is only set one time, it is set as a reference to c (defined on line 692). By the time the loop is finished, the contents of c will always be the last entry in the bb.contacts list.
My workaround for this issue (not a general solution):
diff --git a/imessage/bluebubbles/api.go b/imessage/bluebubbles/api.go
index 6fb6e4d..fe4636d 100644
--- a/imessage/bluebubbles/api.go
+++ b/imessage/bluebubbles/api.go
@@ -725,7 +725,8 @@ func (bb *blueBubbles) matchHandleToContact(address string) *Contact {
// Contacts with a source type of "api" are stored on the mac and can be used as fallback in case an imported one isn't found
if contact != nil && matchedContact == nil {
- matchedContact = contact
+ return contact
+ //matchedContact = contact
}
}
Sorry, I would come up with a PR, but I've never written any Go before. I poked at it for a bit, but I didn't get anywhere.
This bug report applies to commit e1f79bc in the bluebubbles branch.
When I run this version of mautrix_imessage on my system, it loops through all of my conversations and sets every contact to same name
The root cause is line 728 in api.go.
While
matchedContact
is only set one time, it is set as a reference toc
(defined on line 692). By the time the loop is finished, the contents ofc
will always be the last entry in thebb.contacts
list.My workaround for this issue (not a general solution):
Sorry, I would come up with a PR, but I've never written any Go before. I poked at it for a bit, but I didn't get anywhere.