Move appservice/ to /
This commit is contained in:
parent
a8e87e378e
commit
67c7f7361d
5 changed files with 10 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
||||||
package appservice
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,4 +1,4 @@
|
||||||
package appservice
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
17
main.go
17
main.go
|
@ -15,7 +15,6 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"git.deuxfleurs.fr/Deuxfleurs/easybridge/appservice"
|
|
||||||
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
|
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
|
||||||
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/irc"
|
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/irc"
|
||||||
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/mattermost"
|
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/mattermost"
|
||||||
|
@ -166,15 +165,7 @@ func main() {
|
||||||
reg_file := readRegistration(config.Registration)
|
reg_file := readRegistration(config.Registration)
|
||||||
registration = ®_file
|
registration = ®_file
|
||||||
|
|
||||||
as_config := &appservice.Config{
|
errch, err := StartAppService()
|
||||||
HttpBindAddr: config.HttpBindAddr,
|
|
||||||
Server: config.Server,
|
|
||||||
DbType: config.DbType,
|
|
||||||
DbPath: config.DbPath,
|
|
||||||
MatrixDomain: config.MatrixDomain,
|
|
||||||
}
|
|
||||||
|
|
||||||
errch, err := appservice.Start(registration, as_config)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -192,7 +183,7 @@ func main() {
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Invalid protocol %s", params.Protocol)
|
log.Fatalf("Invalid protocol %s", params.Protocol)
|
||||||
}
|
}
|
||||||
account := &appservice.Account{
|
account := &Account{
|
||||||
MatrixUser: fmt.Sprintf("@%s:%s", user, config.MatrixDomain),
|
MatrixUser: fmt.Sprintf("@%s:%s", user, config.MatrixDomain),
|
||||||
AccountName: name,
|
AccountName: name,
|
||||||
Protocol: params.Protocol,
|
Protocol: params.Protocol,
|
||||||
|
@ -200,7 +191,7 @@ func main() {
|
||||||
JoinedRooms: map[connector.RoomID]bool{},
|
JoinedRooms: map[connector.RoomID]bool{},
|
||||||
}
|
}
|
||||||
conn.SetHandler(account)
|
conn.SetHandler(account)
|
||||||
appservice.AddAccount(account)
|
AddAccount(account)
|
||||||
go connectAndJoin(account, params)
|
go connectAndJoin(account, params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +202,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectAndJoin(account *appservice.Account, params ConfigAccount) {
|
func connectAndJoin(account *Account, params ConfigAccount) {
|
||||||
log.Printf("Connecting to %s", params.Protocol)
|
log.Printf("Connecting to %s", params.Protocol)
|
||||||
err := account.Conn.Configure(params.Config)
|
err := account.Conn.Configure(params.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package appservice
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -21,16 +21,10 @@ type Config struct {
|
||||||
MatrixDomain string
|
MatrixDomain string
|
||||||
}
|
}
|
||||||
|
|
||||||
var registration *mxlib.Registration
|
|
||||||
var config *Config
|
|
||||||
|
|
||||||
var mx *mxlib.Client
|
var mx *mxlib.Client
|
||||||
|
|
||||||
func Start(r *mxlib.Registration, c *Config) (chan error, error) {
|
func StartAppService() (chan error, error) {
|
||||||
registration = r
|
mx = mxlib.NewClient(config.Server, registration.AsToken)
|
||||||
config = c
|
|
||||||
|
|
||||||
mx = mxlib.NewClient(c.Server, r.AsToken)
|
|
||||||
|
|
||||||
err := InitDb()
|
err := InitDb()
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -1,4 +1,4 @@
|
||||||
package appservice
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
Loading…
Reference in a new issue