Add WhatsApp->Matrix read receipts and phone connection notifications

This commit is contained in:
Tulir Asokan
2018-08-24 19:46:14 +03:00
parent 60529bf022
commit 1f87deb317
12 changed files with 178 additions and 69 deletions

View File

@ -18,6 +18,7 @@ package whatsapp_ext
import (
"encoding/json"
"github.com/Rhymen/go-whatsapp"
)
@ -27,6 +28,7 @@ type JSONMessageType string
const (
MessageMsgInfo JSONMessageType = "MsgInfo"
MessageMsg JSONMessageType = "Msg"
MessagePresence JSONMessageType = "Presence"
MessageStream JSONMessageType = "Stream"
MessageConn JSONMessageType = "Conn"
@ -76,11 +78,11 @@ func (ext *ExtendedConn) HandleJsonMessage(message string) {
case MessageStream:
ext.handleMessageStream(msg[1:])
case MessageConn:
ext.handleMessageProps(msg[1])
ext.handleMessageConn(msg[1])
case MessageProps:
ext.handleMessageProps(msg[1])
case MessageMsgInfo:
ext.handleMessageMsgInfo(msg[1])
case MessageMsgInfo, MessageMsg:
ext.handleMessageMsgInfo(msgType, msg[1])
default:
for _, handler := range ext.handlers {
ujmHandler, ok := handler.(UnhandledJSONMessageHandler)