Add basic Matrix puppeting support

May contain bugs.
EDUs from /sync are not yet handled.
This commit is contained in:
Tulir Asokan
2019-05-24 02:33:26 +03:00
parent 95e62fae77
commit 2c9c473040
14 changed files with 379 additions and 55 deletions

View File

@ -166,6 +166,10 @@ func (mx *MatrixHandler) HandleMessage(evt *mautrix.Event) {
if _, isPuppet := mx.bridge.ParsePuppetMXID(evt.Sender); evt.Sender == mx.bridge.Bot.UserID || isPuppet {
return
}
isCustomPuppet, ok := evt.Content.Raw["net.maunium.whatsapp.puppet"].(bool)
if ok && isCustomPuppet && mx.bridge.GetPuppetByCustomMXID(evt.Sender) != nil {
return
}
roomID := types.MatrixRoomID(evt.RoomID)
user := mx.bridge.GetUserByMXID(types.MatrixUserID(evt.Sender))