diff options
author | ilmaisin <iiro.laiho@iki.fi> | 2022-12-15 00:47:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 23:47:30 +0100 |
commit | 4cf313c4c6b25d19c4128f8e79d22d9a2a001cf0 (patch) | |
tree | f017c72eee1fcae1c36850f43dbc35698d0744c3 /bridge/whatsappmulti/handlers.go | |
parent | 91353d0a4daba4d6453deb718848acddf51d7dc4 (diff) | |
download | matterbridge-msglm-4cf313c4c6b25d19c4128f8e79d22d9a2a001cf0.tar.gz matterbridge-msglm-4cf313c4c6b25d19c4128f8e79d22d9a2a001cf0.tar.bz2 matterbridge-msglm-4cf313c4c6b25d19c4128f8e79d22d9a2a001cf0.zip |
Fix the "Someone" nickname problem (whatsapp) (#1931)
* Apply patch to work around the "Someone" nickname problem
* Code cleanup (whatsapp)
* Cleanup
* Code cleanup (whatsapp)
* Re-examine if sender exists
* Cleanup (whatsapp)
Diffstat (limited to 'bridge/whatsappmulti/handlers.go')
-rw-r--r-- | bridge/whatsappmulti/handlers.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/bridge/whatsappmulti/handlers.go b/bridge/whatsappmulti/handlers.go index 379699d9..34dce471 100644 --- a/bridge/whatsappmulti/handlers.go +++ b/bridge/whatsappmulti/handlers.go @@ -51,10 +51,7 @@ func (b *Bwhatsapp) handleTextMessage(messageInfo types.MessageInfo, msg *proto. senderJID := messageInfo.Sender channel := messageInfo.Chat - senderName := b.getSenderName(messageInfo.Sender) - if senderName == "" { - senderName = "Someone" // don't expose telephone number - } + senderName := b.getSenderName(messageInfo) if msg.GetExtendedTextMessage() == nil && msg.GetConversation() == "" { b.Log.Debugf("message without text content? %#v", msg) @@ -82,9 +79,6 @@ func (b *Bwhatsapp) handleTextMessage(messageInfo types.MessageInfo, msg *proto. // mentions comes as telephone numbers and we don't want to expose it to other bridges // replace it with something more meaninful to others mention := b.getSenderNotify(types.NewJID(numberAndSuffix[0], types.DefaultUserServer)) - if mention == "" { - mention = "someone" - } text = strings.Replace(text, "@"+numberAndSuffix[0], "@"+mention, 1) } @@ -118,7 +112,7 @@ func (b *Bwhatsapp) handleImageMessage(msg *events.Message) { imsg := msg.Message.GetImageMessage() senderJID := msg.Info.Sender - senderName := b.getSenderName(senderJID) + senderName := b.getSenderName(msg.Info) ci := imsg.GetContextInfo() if senderJID == (types.JID{}) && ci.Participant != nil { @@ -181,7 +175,7 @@ func (b *Bwhatsapp) handleVideoMessage(msg *events.Message) { imsg := msg.Message.GetVideoMessage() senderJID := msg.Info.Sender - senderName := b.getSenderName(senderJID) + senderName := b.getSenderName(msg.Info) ci := imsg.GetContextInfo() if senderJID == (types.JID{}) && ci.Participant != nil { @@ -238,7 +232,7 @@ func (b *Bwhatsapp) handleAudioMessage(msg *events.Message) { imsg := msg.Message.GetAudioMessage() senderJID := msg.Info.Sender - senderName := b.getSenderName(senderJID) + senderName := b.getSenderName(msg.Info) ci := imsg.GetContextInfo() if senderJID == (types.JID{}) && ci.Participant != nil { @@ -295,7 +289,7 @@ func (b *Bwhatsapp) handleDocumentMessage(msg *events.Message) { imsg := msg.Message.GetDocumentMessage() senderJID := msg.Info.Sender - senderName := b.getSenderName(senderJID) + senderName := b.getSenderName(msg.Info) ci := imsg.GetContextInfo() if senderJID == (types.JID{}) && ci.Participant != nil { |