This commit is contained in:
Tulir Asokan 2018-08-26 22:53:13 +03:00
parent 65f077c645
commit 22e76b6a37
14 changed files with 40 additions and 27 deletions

View File

@ -17,10 +17,11 @@
package main package main
import ( import (
"maunium.net/go/mautrix-whatsapp/types"
"strings" "strings"
"maunium.net/go/mautrix-appservice"
"maunium.net/go/maulogger" "maunium.net/go/maulogger"
"maunium.net/go/mautrix-appservice"
"maunium.net/go/mautrix-whatsapp/types"
) )
type CommandHandler struct { type CommandHandler struct {

View File

@ -18,11 +18,12 @@ package config
import ( import (
"bytes" "bytes"
"text/template"
"maunium.net/go/mautrix-appservice"
"strings"
"strconv" "strconv"
"strings"
"text/template"
"github.com/Rhymen/go-whatsapp" "github.com/Rhymen/go-whatsapp"
"maunium.net/go/mautrix-appservice"
"maunium.net/go/mautrix-whatsapp/types" "maunium.net/go/mautrix-whatsapp/types"
) )
@ -86,10 +87,10 @@ func (bc BridgeConfig) FormatUsername(receiver types.MatrixUserID, userID types.
func (bc BridgeConfig) MarshalYAML() (interface{}, error) { func (bc BridgeConfig) MarshalYAML() (interface{}, error) {
bc.DisplaynameTemplate = bc.FormatDisplayname(whatsapp.Contact{ bc.DisplaynameTemplate = bc.FormatDisplayname(whatsapp.Contact{
Jid: "{{.Jid}}", Jid: "{{.Jid}}",
Notify: "{{.Notify}}", Notify: "{{.Notify}}",
Name: "{{.Name}}", Name: "{{.Name}}",
Short: "{{.Short}}", Short: "{{.Short}}",
}) })
bc.UsernameTemplate = bc.FormatUsername("{{.Receiver}}", "{{.UserID}}") bc.UsernameTemplate = bc.FormatUsername("{{.Receiver}}", "{{.UserID}}")
return bc, nil return bc, nil

View File

@ -17,9 +17,10 @@
package config package config
import ( import (
"maunium.net/go/mautrix-appservice"
"io/ioutil" "io/ioutil"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"maunium.net/go/mautrix-appservice"
) )
type Config struct { type Config struct {

View File

@ -17,9 +17,10 @@
package config package config
import ( import (
"maunium.net/go/mautrix-appservice"
"regexp"
"fmt" "fmt"
"regexp"
"maunium.net/go/mautrix-appservice"
) )
func (config *Config) NewRegistration() (*appservice.Registration, error) { func (config *Config) NewRegistration() (*appservice.Registration, error) {

View File

@ -18,6 +18,7 @@ package database
import ( import (
"database/sql" "database/sql"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
log "maunium.net/go/maulogger" log "maunium.net/go/maulogger"
) )

View File

@ -17,9 +17,10 @@
package database package database
import ( import (
"database/sql"
log "maunium.net/go/maulogger" log "maunium.net/go/maulogger"
"maunium.net/go/mautrix-whatsapp/types" "maunium.net/go/mautrix-whatsapp/types"
"database/sql"
) )
type MessageQuery struct { type MessageQuery struct {

View File

@ -17,9 +17,10 @@
package database package database
import ( import (
"database/sql"
log "maunium.net/go/maulogger" log "maunium.net/go/maulogger"
"maunium.net/go/mautrix-whatsapp/types" "maunium.net/go/mautrix-whatsapp/types"
"database/sql"
) )
type PortalQuery struct { type PortalQuery struct {

View File

@ -17,9 +17,10 @@
package database package database
import ( import (
"database/sql"
log "maunium.net/go/maulogger" log "maunium.net/go/maulogger"
"maunium.net/go/mautrix-whatsapp/types" "maunium.net/go/mautrix-whatsapp/types"
"database/sql"
) )
type PuppetQuery struct { type PuppetQuery struct {

View File

@ -17,10 +17,11 @@
package database package database
import ( import (
log "maunium.net/go/maulogger"
"github.com/Rhymen/go-whatsapp"
"maunium.net/go/mautrix-whatsapp/types"
"database/sql" "database/sql"
"github.com/Rhymen/go-whatsapp"
log "maunium.net/go/maulogger"
"maunium.net/go/mautrix-whatsapp/types"
) )
type UserQuery struct { type UserQuery struct {
@ -46,8 +47,8 @@ func (uq *UserQuery) CreateTable() error {
func (uq *UserQuery) New() *User { func (uq *UserQuery) New() *User {
return &User{ return &User{
db: uq.db, db: uq.db,
log: uq.log, log: uq.log,
} }
} }

View File

@ -19,12 +19,13 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"maunium.net/go/mautrix-whatsapp/config"
flag "maunium.net/go/mauflag"
"os/signal" "os/signal"
"syscall" "syscall"
"maunium.net/go/mautrix-appservice"
flag "maunium.net/go/mauflag"
log "maunium.net/go/maulogger" log "maunium.net/go/maulogger"
"maunium.net/go/mautrix-appservice"
"maunium.net/go/mautrix-whatsapp/config"
"maunium.net/go/mautrix-whatsapp/database" "maunium.net/go/mautrix-whatsapp/database"
"maunium.net/go/mautrix-whatsapp/types" "maunium.net/go/mautrix-whatsapp/types"
) )

View File

@ -17,11 +17,12 @@
package main package main
import ( import (
"maunium.net/go/gomatrix"
"maunium.net/go/mautrix-appservice"
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"os" "os"
"maunium.net/go/gomatrix"
"maunium.net/go/mautrix-appservice"
) )
type AutosavingStateStore struct { type AutosavingStateStore struct {
@ -70,4 +71,4 @@ func (store *AutosavingStateStore) SetMembership(roomID, userID, membership stri
func (store *AutosavingStateStore) SetPowerLevels(roomID string, levels *gomatrix.PowerLevels) { func (store *AutosavingStateStore) SetPowerLevels(roomID string, levels *gomatrix.PowerLevels) {
store.BasicStateStore.SetPowerLevels(roomID, levels) store.BasicStateStore.SetPowerLevels(roomID, levels)
store.Save() store.Save()
} }

View File

@ -29,4 +29,4 @@ type MatrixUserID = string
type MatrixRoomID = string type MatrixRoomID = string
// MatrixEventID is the internal ID of a Matrix event. // MatrixEventID is the internal ID of a Matrix event.
type MatrixEventID = string type MatrixEventID = string

View File

@ -17,8 +17,9 @@
package whatsappExt package whatsappExt
import ( import (
"github.com/Rhymen/go-whatsapp"
"encoding/json" "encoding/json"
"github.com/Rhymen/go-whatsapp"
) )
type ProtocolProps struct { type ProtocolProps struct {

View File

@ -18,6 +18,7 @@ package whatsappExt
import ( import (
"encoding/json" "encoding/json"
"github.com/Rhymen/go-whatsapp" "github.com/Rhymen/go-whatsapp"
) )