Add database models and improve config/main

This commit is contained in:
Tulir Asokan
2018-08-13 23:24:44 +03:00
parent ace08205d9
commit fd3c1fb77c
11 changed files with 440 additions and 16 deletions

View File

@ -1,4 +1,4 @@
// mautrix-whatsapp - A Matrix-Whatsapp puppeting bridge.
// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.
// Copyright (C) 2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
@ -16,6 +16,35 @@
package main
func InitMatrix() {
import (
log "maunium.net/go/maulogger"
)
type MatrixListener struct {
bridge *Bridge
log *log.Sublogger
stop chan struct{}
}
func NewMatrixListener(bridge *Bridge) *MatrixListener {
return &MatrixListener{
bridge: bridge,
stop: make(chan struct{}, 1),
log: bridge.Log.CreateSublogger("Matrix", log.LevelDebug),
}
}
func (ml *MatrixListener) Start() {
for {
select {
case evt := <-ml.bridge.AppService.Events:
log.Debugln("Received Matrix event:", evt)
case <-ml.stop:
return
}
}
}
func (ml *MatrixListener) Stop() {
ml.stop <- struct{}{}
}