summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Rhymen/go-whatsapp/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/handler.go')
-rw-r--r--vendor/github.com/Rhymen/go-whatsapp/handler.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/handler.go b/vendor/github.com/Rhymen/go-whatsapp/handler.go
index a70d15bf..1188f794 100644
--- a/vendor/github.com/Rhymen/go-whatsapp/handler.go
+++ b/vendor/github.com/Rhymen/go-whatsapp/handler.go
@@ -82,7 +82,7 @@ type LocationMessageHandler interface {
}
/*
-The StickerMessageHandler interface needs to be implemented to receive location messages dispatched by the dispatcher.
+The StickerMessageHandler interface needs to be implemented to receive sticker messages dispatched by the dispatcher.
*/
type StickerMessageHandler interface {
Handler
@@ -90,6 +90,14 @@ type StickerMessageHandler interface {
}
/*
+The ContactMessageHandler interface needs to be implemented to receive contact messages dispatched by the dispatcher.
+*/
+type ContactMessageHandler interface {
+ Handler
+ HandleContactMessage(message ContactMessage)
+}
+
+/*
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
@@ -267,6 +275,17 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
}
}
+ case ContactMessage:
+ for _, h := range handlers {
+ if x, ok := h.(ContactMessageHandler); ok {
+ if wac.shouldCallSynchronously(h) {
+ x.HandleContactMessage(m)
+ } else {
+ go x.HandleContactMessage(m)
+ }
+ }
+ }
+
case *proto.WebMessageInfo:
for _, h := range handlers {
if x, ok := h.(RawMessageHandler); ok {