summaryrefslogtreecommitdiffstats
path: root/bridge/whatsappmulti/helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/whatsappmulti/helpers.go')
-rw-r--r--bridge/whatsappmulti/helpers.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/bridge/whatsappmulti/helpers.go b/bridge/whatsappmulti/helpers.go
index 963eafa1..b0686190 100644
--- a/bridge/whatsappmulti/helpers.go
+++ b/bridge/whatsappmulti/helpers.go
@@ -64,6 +64,29 @@ func (b *Bwhatsapp) getSenderName(info types.MessageInfo) string {
return "Someone"
}
+func (b *Bwhatsapp) getSenderNameFromJID(senderJid types.JID) string {
+ sender, exists := b.contacts[senderJid]
+
+ if !exists || (sender.FullName == "" && sender.FirstName == "") {
+ b.reloadContacts() // Contacts may need to be reloaded
+ sender, exists = b.contacts[senderJid]
+ }
+
+ if exists && sender.FullName != "" {
+ return sender.FullName
+ }
+
+ if exists && sender.FirstName != "" {
+ return sender.FirstName
+ }
+
+ if sender.PushName != "" {
+ return sender.PushName
+ }
+
+ return "Someone"
+}
+
func (b *Bwhatsapp) getSenderNotify(senderJid types.JID) string {
sender, exists := b.contacts[senderJid]