summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Rhymen/go-whatsapp/handler.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-11 23:07:00 +0200
committerGitHub <noreply@github.com>2020-10-11 23:07:00 +0200
commit2d98df61221e23b3be557d7b1931ee3d510ac32d (patch)
tree7898a2d3c2b3003bae97d50541443072046666f3 /vendor/github.com/Rhymen/go-whatsapp/handler.go
parent219a5453f9edaa87aa7aa4b9d5f9c3de9c75b38f (diff)
downloadmatterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.tar.gz
matterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.tar.bz2
matterbridge-msglm-2d98df61221e23b3be557d7b1931ee3d510ac32d.zip
Update vendor (#1257)
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/handler.go')
-rw-r--r--vendor/github.com/Rhymen/go-whatsapp/handler.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/handler.go b/vendor/github.com/Rhymen/go-whatsapp/handler.go
index 86ea43b1..4f8ef858 100644
--- a/vendor/github.com/Rhymen/go-whatsapp/handler.go
+++ b/vendor/github.com/Rhymen/go-whatsapp/handler.go
@@ -141,6 +141,14 @@ type BatteryMessageHandler interface {
HandleBatteryMessage(battery BatteryMessage)
}
+/**
+The NewContactHandler interface needs to be implemented to receive the contact's name for the first time.
+*/
+type NewContactHandler interface {
+ Handler
+ HandleNewContact(contact Contact)
+}
+
/*
AddHandler adds an handler to the list of handler that receive dispatched messages.
The provided handler must at least implement the Handler interface. Additionally implemented
@@ -304,6 +312,17 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
}
+
+ case Contact:
+ for _, h := range handlers {
+ if x, ok := h.(NewContactHandler); ok {
+ if wac.shouldCallSynchronously(h) {
+ x.HandleNewContact(m)
+ } else {
+ go x.HandleNewContact(m)
+ }
+ }
+ }
case *proto.WebMessageInfo:
for _, h := range handlers {
@@ -397,6 +416,10 @@ func (wac *Conn) dispatch(msg interface{}) {
wac.handle(v)
wac.handle(ParseProtoMessage(v))
}
+
+ if v, ok := con[a].(binary.Node); ok {
+ wac.handle(ParseNodeMessage(v))
+ }
}
} else if con, ok := message.Content.([]binary.Node); ok {
for a := range con {