GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.22k stars 259 forks source link

Messaging / SMS wrongly matches contacts and crashes. #1193

Open matlacki opened 3 years ago

matlacki commented 3 years ago

The Messaging has a side menu with Name and avatar. Problem is that this person does not match the phone number of the person with whom that conversation has been carried out. This is the case of fresh install of the GSConnect extension, version 47 on gnome-shell version 40. I have deleted ~/.cache/gsconnect and ~/.congfig/gsconnect prior to any reinstalls, and unpaired from the KDE application.

Issue 1 All the conversations when the sender "number" does not consist of digits (e.g equals to "Facebook") are matched to the one particular contact Also some of the legitimate contacts, with phone number being an actual number have been linked to that person. So I had like 20 conversations with the same person in the left side panel, all wrongly attributed.

The unique feature of the contact that is being matched the left hand side is that in contacts.json she has an "empty" phone number:

    "416i5b91----------------2468": {
      "id": "416i5b91----------------2468",
      "name": "---------------- ----------------",
      "numbers": [
        {
          "value": "+4812----------------",
          "type": "work"
        },
        {
          "value": "",             ### the crucial line 
          "type": "unknown"
        }
      ],
      "origin": "device",
      "timestamp": 1635627533298,
      "avatar": "/home/--------------------------------/----------------/383c334056ab"
    }

restarting GSConnect then results in crash (I specified that in the comment).

I deleted on the phone the entry that has lead to the empty phone number :

  {
    "value": "",
    "type": "unknown"
  }

After reinstall of GSConnect it re-fetched the contacts and the issue did not reoccur for me any more. Still it is true that GSconnect Messaging was awfully malfunctioning. Empty phone number is non-sensical, but the GSConnect should not crash if user has "empty" string for a phone number. In myu case this was likely due to "merge contacts" functionality of Google Contacts that I have applied to contacts from several sources.

Issue 2 Another thing: contact window is normally changed to the name and surname that is picked from the left conversation list. . With the above empty phone number in contacts.json, after picking one of wrongly matched conversations, the name picked for the window title was always the first entry in the contacts.json (it was not the name with the empty phone number).

I consider the above the bug: I did pretty basic thing of merging contacts from old iPhone, those that I already had in Gmail, and some from office Outlook. The person with empty phone number must have come from old iPhone. Still if merging contacts results i contact list of "not prime quality", then the GSConnect should handle comparisons with empty string better, or pre-filter the contacts.

This is somehow similar to the guy who ordered "NULL" as a vanity license plate, and got fined for all traffic tickets where policeman left licence plate number blank.

matlacki commented 3 years ago

I forgot to add: the above errors, given empty entry happen just once. Attempts to relaunch GSConnect Messaging module end up with a crash starting from a second attempt.

    Oct 30 23:35:43 testosteron gjs[94726]: JS ERROR: TypeError: this.avatar.contact is null
set message@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js:747:13
_init@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js:722:9
_onThreadsChanged@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/ui/messaging.js:1033:34
_handleDigest@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js:234:14
_handleMessages@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js:326:22
handlePacket@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/plugins/sms.js:194:22
handlePacket@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:415:25
_readLoop@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:339:22
async*setChannel@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/device.js:320:18
_onChannel@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/manager.js:225:20
channel@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/core.js:445:19
_onIncomingChannel@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/backends/lan.js:216:18
Async*@/home/lacki/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/daemon.js:727:17

(edited by maintainer for clarity)

wargreen commented 2 years ago

I have a similar issue but without syncing my contacts via GSConnect (via our Nextcloud and Gnome Online Account). Lot of threads are shown with a wrong name (always the same) and another name in the header when clicking on the tread.

When investigate in my contacts with Evolution I can see that the showed name is always a contact with a field "File under" not equal to the "Full Name" field. Changing this field in the contact change the contact name in the sms treads list after a Clear Cache. The name in the header not change but it's also a contact with the "File under"/"Full Name" difference.

I'm here if i can help for deeper researches.

andyholmes commented 2 years ago

I'm here if i can help for deeper researches.

You could amend the EContact parsing code to account for that, but it would take some work on your end. I don't use Nextcloud/ownCloud, so I don't really have any contact source to work with there. The FN field (full name) is typically the defacto source for contact names, so you'd have to walk up the tree of the address book ESource to determine if it were a Nextcloud source, then select the "file under" field (maybe that means file_as?) instead.

I also don't really use GSConnect anymore, so at this point the project is basically community-driven and relies on contributions from users :shrug:

kohend commented 1 year ago

I think I saw a related issue, I'm getting promotional messages associated with random contacts instead with the sender name as appears on my phone image