summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Rhymen/go-whatsapp/handler.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-05-30 00:25:30 +0200
committerGitHub <noreply@github.com>2021-05-30 00:25:30 +0200
commit4091b6f6b4fe01876f8720332675f9c69be39541 (patch)
tree07a1f2b2eeba6fb680b5edc19d2d38ec81243c0a /vendor/github.com/Rhymen/go-whatsapp/handler.go
parent766f35554e16ee5462370be714ef29b71745d478 (diff)
downloadmatterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.tar.gz
matterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.tar.bz2
matterbridge-msglm-4091b6f6b4fe01876f8720332675f9c69be39541.zip
Update vendor (#1498)
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/handler.go')
-rw-r--r--vendor/github.com/Rhymen/go-whatsapp/handler.go42
1 files changed, 40 insertions, 2 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/handler.go b/vendor/github.com/Rhymen/go-whatsapp/handler.go
index 4f8ef858..1e447018 100644
--- a/vendor/github.com/Rhymen/go-whatsapp/handler.go
+++ b/vendor/github.com/Rhymen/go-whatsapp/handler.go
@@ -98,6 +98,22 @@ type ContactMessageHandler interface {
}
/*
+The ProductMessageHandler interface needs to be implemented to receive product messages dispatched by the dispatcher.
+*/
+type ProductMessageHandler interface {
+ Handler
+ HandleProductMessage(message ProductMessage)
+}
+
+/*
+The OrderMessageHandler interface needs to be implemented to receive order messages dispatched by the dispatcher.
+*/
+type OrderMessageHandler interface {
+ Handler
+ HandleOrderMessage(message OrderMessage)
+}
+
+/*
The JsonMessageHandler interface needs to be implemented to receive json messages dispatched by the dispatcher.
These json messages contain status updates of every kind sent by WhatsAppWeb servers. WhatsAppWeb uses these messages
to built a Store, which is used to save these "secondary" information. These messages may contain
@@ -301,7 +317,7 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
}
-
+
case BatteryMessage:
for _, h := range handlers {
if x, ok := h.(BatteryMessageHandler); ok {
@@ -312,7 +328,7 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
}
-
+
case Contact:
for _, h := range handlers {
if x, ok := h.(NewContactHandler); ok {
@@ -324,6 +340,28 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
+ case ProductMessage:
+ for _, h := range handlers {
+ if x, ok := h.(ProductMessageHandler); ok {
+ if wac.shouldCallSynchronously(h) {
+ x.HandleProductMessage(m)
+ } else {
+ go x.HandleProductMessage(m)
+ }
+ }
+ }
+
+ case OrderMessage:
+ for _, h := range handlers {
+ if x, ok := h.(OrderMessageHandler); ok {
+ if wac.shouldCallSynchronously(h) {
+ x.HandleOrderMessage(m)
+ } else {
+ go x.HandleOrderMessage(m)
+ }
+ }
+ }
+
case *proto.WebMessageInfo:
for _, h := range handlers {
if x, ok := h.(RawMessageHandler); ok {