mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-11 01:52:30 +00:00
Update whatsapp vendor and fix a panic (#1209)
* Fix another whatsapp panic * Update whatsapp vendor
This commit is contained in:
23
vendor/github.com/Rhymen/go-whatsapp/handler.go
generated
vendored
23
vendor/github.com/Rhymen/go-whatsapp/handler.go
generated
vendored
@@ -133,6 +133,14 @@ type ChatListHandler interface {
|
||||
HandleChatList(contacts []Chat)
|
||||
}
|
||||
|
||||
/**
|
||||
The BatteryMessageHandler interface needs to be implemented to receive percentage the device connected dispatched by the dispatcher.
|
||||
*/
|
||||
type BatteryMessageHandler interface {
|
||||
Handler
|
||||
HandleBatteryMessage(battery BatteryMessage)
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
@@ -285,6 +293,17 @@ func (wac *Conn) handleWithCustomHandlers(message interface{}, handlers []Handle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case BatteryMessage:
|
||||
for _, h := range handlers {
|
||||
if x, ok := h.(BatteryMessageHandler); ok {
|
||||
if wac.shouldCallSynchronously(h) {
|
||||
x.HandleBatteryMessage(m)
|
||||
} else {
|
||||
go x.HandleBatteryMessage(m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case *proto.WebMessageInfo:
|
||||
for _, h := range handlers {
|
||||
@@ -379,6 +398,10 @@ func (wac *Conn) dispatch(msg interface{}) {
|
||||
wac.handle(ParseProtoMessage(v))
|
||||
}
|
||||
}
|
||||
} else if con, ok := message.Content.([]binary.Node); ok {
|
||||
for a := range con {
|
||||
wac.handle(ParseNodeMessage(con[a]))
|
||||
}
|
||||
}
|
||||
} else if message.Description == "response" && message.Attributes["type"] == "contacts" {
|
||||
wac.updateContacts(message.Content)
|
||||
|
Reference in New Issue
Block a user