Remove maulogger
This commit is contained in:
parent
42d56b9e71
commit
c41dbebc0d
4 changed files with 3 additions and 32 deletions
|
@ -100,7 +100,7 @@ func (prov *ProvisioningAPI) BridgeStatePing(w http.ResponseWriter, r *http.Requ
|
|||
remote = remote.Fill(user)
|
||||
resp.RemoteStates[remote.RemoteID] = remote
|
||||
}
|
||||
user.log.Debugfln("Responding bridge state in bridge status endpoint: %+v", resp)
|
||||
user.zlog.Debug().Any("bridge_state", &resp).Msg("Responding bridge state in bridge status endpoint")
|
||||
jsonResponse(w, http.StatusOK, &resp)
|
||||
if len(resp.RemoteStates) > 0 {
|
||||
user.BridgeState.SetPrev(remote)
|
||||
|
|
1
go.mod
1
go.mod
|
@ -13,7 +13,6 @@ require (
|
|||
go.mau.fi/util v0.4.1-0.20240311141448-53cb04950f7e
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
|
||||
google.golang.org/protobuf v1.33.0
|
||||
maunium.net/go/maulogger/v2 v2.4.1
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa
|
||||
)
|
||||
|
||||
|
|
2
go.sum
2
go.sum
|
@ -86,7 +86,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
|
||||
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
|
||||
maunium.net/go/maulogger/v2 v2.4.1 h1:N7zSdd0mZkB2m2JtFUsiGTQQAdP0YeFWT7YMc80yAL8=
|
||||
maunium.net/go/maulogger/v2 v2.4.1/go.mod h1:omPuYwYBILeVQobz8uO3XC8DIRuEb5rXYlQSuqrbCho=
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa h1:TLSWIAWKIWxLghgzWfp7o92pVCcFR3yLsArc0s/tsMs=
|
||||
maunium.net/go/mautrix v0.18.0-beta.1.0.20240311183606-94246ffc85aa/go.mod h1:0sfLB2ejW+lhgio4UlZMmn5i9SuZ8mxFkonFSamrfTE=
|
||||
|
|
30
user.go
30
user.go
|
@ -29,8 +29,6 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"maunium.net/go/maulogger/v2"
|
||||
"maunium.net/go/maulogger/v2/maulogadapt"
|
||||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/appservice"
|
||||
"maunium.net/go/mautrix/bridge"
|
||||
|
@ -40,7 +38,6 @@ import (
|
|||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/format"
|
||||
"maunium.net/go/mautrix/id"
|
||||
"maunium.net/go/mautrix/pushrules"
|
||||
|
||||
"go.mau.fi/mautrix-gmessages/database"
|
||||
"go.mau.fi/mautrix-gmessages/libgm"
|
||||
|
@ -54,8 +51,6 @@ type User struct {
|
|||
|
||||
bridge *GMBridge
|
||||
zlog zerolog.Logger
|
||||
// Deprecated
|
||||
log maulogger.Logger
|
||||
|
||||
Admin bool
|
||||
Whitelisted bool
|
||||
|
@ -229,7 +224,6 @@ func (br *GMBridge) NewUser(dbUser *database.User) *User {
|
|||
bridge: br,
|
||||
zlog: br.ZLog.With().Str("user_id", dbUser.MXID.String()).Logger(),
|
||||
}
|
||||
user.log = maulogadapt.ZeroAsMau(&user.zlog)
|
||||
user.longPollingError = errors.New("not connected")
|
||||
user.phoneResponding = true
|
||||
|
||||
|
@ -1131,26 +1125,6 @@ func (user *User) syncConversation(v *gmproto.Conversation, source string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (user *User) updateChatMute(ctx context.Context, portal *Portal, mutedUntil time.Time) {
|
||||
intent := user.DoublePuppetIntent
|
||||
if intent == nil || len(portal.MXID) == 0 {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
if mutedUntil.IsZero() && mutedUntil.Before(time.Now()) {
|
||||
user.log.Debugfln("Portal %s is muted until %s, unmuting...", portal.MXID, mutedUntil)
|
||||
err = intent.DeletePushRule(ctx, "global", pushrules.RoomRule, string(portal.MXID))
|
||||
} else {
|
||||
user.log.Debugfln("Portal %s is muted until %s, muting...", portal.MXID, mutedUntil)
|
||||
err = intent.PutPushRule(ctx, "global", pushrules.RoomRule, string(portal.MXID), &mautrix.ReqPutPushRule{
|
||||
Actions: []pushrules.PushActionType{pushrules.ActionDontNotify},
|
||||
})
|
||||
}
|
||||
if err != nil && !errors.Is(err, mautrix.MNotFound) {
|
||||
user.log.Warnfln("Failed to update push rule for %s through double puppet: %v", portal.MXID, err)
|
||||
}
|
||||
}
|
||||
|
||||
type CustomTagData struct {
|
||||
Order json.Number `json:"order"`
|
||||
DoublePuppet string `json:"fi.mau.double_puppet_source"`
|
||||
|
@ -1264,7 +1238,7 @@ func (user *User) UpdateDirectChats(ctx context.Context, chats map[id.UserID][]i
|
|||
existingChats := make(map[id.UserID][]id.RoomID)
|
||||
err = intent.GetAccountData(ctx, event.AccountDataDirectChats.Type, &existingChats)
|
||||
if err != nil {
|
||||
user.log.Warnln("Failed to get m.direct list to update it:", err)
|
||||
user.zlog.Err(err).Msg("Failed to get m.direct list to update it")
|
||||
return
|
||||
}
|
||||
for userID, rooms := range existingChats {
|
||||
|
@ -1279,7 +1253,7 @@ func (user *User) UpdateDirectChats(ctx context.Context, chats map[id.UserID][]i
|
|||
err = intent.SetAccountData(ctx, event.AccountDataDirectChats.Type, &chats)
|
||||
}
|
||||
if err != nil {
|
||||
user.log.Warnln("Failed to update m.direct list:", err)
|
||||
user.zlog.Err(err).Msg("Failed to update m.direct list")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue