Rename package, bump Go to 1.22

This commit is contained in:
Jarno Rankinen 2024-03-24 14:22:00 +02:00
parent 2e905544ae
commit f3f6b8e23f
18 changed files with 75 additions and 69 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
__debug_bin*
config.yaml
registration.yaml
logs/
matrix-skype.db

View File

@ -5,9 +5,9 @@ import (
"fmt"
"math"
"github.com/0ranki/matrix-skype/database"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
skype "github.com/kelaresg/go-skypeapi"
"github.com/kelaresg/matrix-skype/database"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"maunium.net/go/mautrix/patch"
"sort"
@ -388,8 +388,8 @@ func (handler *CommandHandler) CommandPing(ce *CommandEvent) {
}
ce.Reply("You're logged in as @" + username + ", orgid is " + orgId)
}
var password string;
var username string;
var password string
var username string
ret := ce.User.bridge.DB.User.GetCredentialsByMXID(ce.User.MXID, &password, &username)
if ret && password != "" {
ce.Reply("WARNING, your password is stored in database. Use command `remove-password` to remove it.")

View File

@ -11,7 +11,7 @@ import (
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
)
type BridgeConfig struct {

View File

@ -30,7 +30,7 @@ import (
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/database"
"github.com/0ranki/matrix-skype/database"
)
var levelTrace = maulogger.Level{

View File

@ -24,7 +24,7 @@ import (
log "maunium.net/go/maulogger/v2"
"github.com/kelaresg/matrix-skype/database/upgrades"
"github.com/0ranki/matrix-skype/database/upgrades"
)
type Database struct {

View File

@ -6,7 +6,7 @@ import (
"encoding/json"
log "maunium.net/go/maulogger/v2"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
"maunium.net/go/mautrix/id"
)

View File

@ -2,14 +2,14 @@ package database
import (
"database/sql"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
"strings"
log "maunium.net/go/maulogger/v2"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
)
type PortalKey struct {

View File

@ -5,7 +5,7 @@ import (
log "maunium.net/go/maulogger/v2"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
"maunium.net/go/mautrix/id"
)

View File

@ -3,14 +3,14 @@ package database
import (
"database/sql"
"fmt"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"strings"
"time"
log "maunium.net/go/maulogger/v2"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
"maunium.net/go/mautrix/id"
)

View File

@ -6,13 +6,13 @@ import (
"regexp"
"strings"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/format"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/types"
)
var italicRegex = regexp.MustCompile("([\\s>~*]|^)_(.+?)_([^a-zA-Z\\d]|$)")
@ -81,8 +81,7 @@ func NewFormatter(bridge *Bridge) *Formatter {
return fmt.Sprintf("<code>%s</code>", str)
},
}
formatter.waReplFuncText = map[*regexp.Regexp]func(string) string{
}
formatter.waReplFuncText = map[*regexp.Regexp]func(string) string{}
return formatter
}

View File

@ -1,8 +1,8 @@
package main
import (
"github.com/kelaresg/matrix-skype/database"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/database"
"github.com/0ranki/matrix-skype/types"
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/format"
"reflect"

6
go.mod
View File

@ -1,13 +1,13 @@
module github.com/kelaresg/matrix-skype
module github.com/0ranki/matrix-skype
go 1.18
go 1.22
require (
github.com/gabriel-vasile/mimetype v1.1.2
github.com/gorilla/websocket v1.4.2
github.com/kelaresg/go-skypeapi v0.1.2-0.20210813144457-5bc29092a74e
github.com/lib/pq v1.9.0
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/mattn/go-sqlite3 v1.14.22
github.com/pkg/errors v0.9.1
gopkg.in/yaml.v2 v2.4.0
maunium.net/go/mauflag v1.0.0

2
go.sum
View File

@ -151,6 +151,8 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=

View File

@ -17,10 +17,10 @@ import (
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/config"
"github.com/kelaresg/matrix-skype/database"
"github.com/kelaresg/matrix-skype/database/upgrades"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/config"
"github.com/0ranki/matrix-skype/database"
"github.com/0ranki/matrix-skype/database/upgrades"
"github.com/0ranki/matrix-skype/types"
)
var (

View File

@ -6,8 +6,8 @@ import (
"strings"
"time"
"github.com/0ranki/matrix-skype/database"
skype "github.com/kelaresg/go-skypeapi"
"github.com/kelaresg/matrix-skype/database"
"maunium.net/go/mautrix"
"maunium.net/go/mautrix/patch"

View File

@ -23,8 +23,8 @@ import (
"sync"
"time"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"github.com/pkg/errors"
log "maunium.net/go/maulogger/v2"
@ -36,8 +36,8 @@ import (
"maunium.net/go/mautrix/id"
"maunium.net/go/mautrix/pushrules"
"github.com/kelaresg/matrix-skype/database"
"github.com/kelaresg/matrix-skype/types"
"github.com/0ranki/matrix-skype/database"
"github.com/0ranki/matrix-skype/types"
)
func (bridge *Bridge) GetPortalByMXID(mxid id.RoomID) *Portal {
@ -614,7 +614,7 @@ func (portal *Portal) userMXIDAction(user *User, fn func(mxid id.UserID)) {
}
func (portal *Portal) ensureMXIDInvited(mxid id.UserID) {
portal.log.Debugfln("ensureMXIDInvited portal.MXID %s: %s", portal.MXID, mxid);
portal.log.Debugfln("ensureMXIDInvited portal.MXID %s: %s", portal.MXID, mxid)
err := portal.MainIntent().EnsureInvited(portal.MXID, mxid)
if err != nil {
portal.log.Warnfln("Failed to ensure %s is invited to %s: %v", mxid, portal.MXID, err)
@ -1152,7 +1152,7 @@ func (portal *Portal) CreateMatrixRoom(user *User) error {
portal.Name = portalName
} else {
portal.Name = metadata.Name
if (user.currentCreateRoomName == portal.Name && portal.Name != "") {
if user.currentCreateRoomName == portal.Name && portal.Name != "" {
return errors.New("It looks like a room is being created in the matrix using command 'create', so there is no need to create a new room here.")
}
}

View File

@ -2,21 +2,21 @@ package main
import (
"fmt"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"net/http"
"regexp"
"sync"
"strings"
"sync"
log "maunium.net/go/maulogger/v2"
"maunium.net/go/mautrix/appservice"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/database"
"github.com/kelaresg/matrix-skype/types"
//"github.com/kelaresg/matrix-skype/whatsapp-ext"
"github.com/0ranki/matrix-skype/database"
"github.com/0ranki/matrix-skype/types"
//"github.com/0ranki/matrix-skype/whatsapp-ext"
)
func (bridge *Bridge) ParsePuppetMXID(mxid id.UserID) (types.SkypeID, bool) {

10
user.go
View File

@ -7,8 +7,8 @@ import (
"fmt"
"sort"
skypeExt "github.com/0ranki/matrix-skype/skype-ext"
skype "github.com/kelaresg/go-skypeapi"
skypeExt "github.com/kelaresg/matrix-skype/skype-ext"
"maunium.net/go/mautrix/patch"
//"strconv"
@ -25,9 +25,9 @@ import (
"maunium.net/go/mautrix/event"
"maunium.net/go/mautrix/id"
"github.com/kelaresg/matrix-skype/database"
"github.com/kelaresg/matrix-skype/types"
//"github.com/kelaresg/matrix-skype/whatsapp-ext"
"github.com/0ranki/matrix-skype/database"
"github.com/0ranki/matrix-skype/types"
//"github.com/0ranki/matrix-skype/whatsapp-ext"
)
type User struct {
@ -657,7 +657,7 @@ func (user *User) syncPuppets(contacts map[string]skype.Contact, toHomeserver bo
user.log.Infoln("Syncing puppet info from contacts", personId, skypeExt.NewUserSuffix)
if strings.HasSuffix(personId, skypeExt.NewUserSuffix) {
puppet := user.bridge.GetPuppetByJID(personId)
if (!toHomeserver) {
if !toHomeserver {
puppet.Sync(user, contact)
}
matrixContacts = append(matrixContacts, string(puppet.MXID))