Ver código fonte

Add more logging to debug chat mute bridging

Tulir Asokan 4 anos atrás
pai
commit
29254ee29a
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      user.go

+ 3 - 2
user.go

@@ -691,10 +691,10 @@ func (user *User) updateChatMute(intent *appservice.IntentAPI, portal *Portal, m
 	}
 	}
 	var err error
 	var err error
 	if mutedUntil < time.Now().Unix() {
 	if mutedUntil < time.Now().Unix() {
-		user.log.Debugln("Unmuting", portal.MXID)
+		user.log.Debugfln("Portal %s is muted until %d, unmuting...", portal.MXID, mutedUntil)
 		err = intent.DeletePushRule("global", pushrules.RoomRule, string(portal.MXID))
 		err = intent.DeletePushRule("global", pushrules.RoomRule, string(portal.MXID))
 	} else {
 	} else {
-		user.log.Debugln("Muting", portal.MXID)
+		user.log.Debugfln("Portal %s is muted until %d, muting...", portal.MXID, mutedUntil)
 		err = intent.PutPushRule("global", pushrules.RoomRule, string(portal.MXID), &mautrix.ReqPutPushRule{
 		err = intent.PutPushRule("global", pushrules.RoomRule, string(portal.MXID), &mautrix.ReqPutPushRule{
 			Actions: []pushrules.PushActionType{pushrules.ActionDontNotify},
 			Actions: []pushrules.PushActionType{pushrules.ActionDontNotify},
 		})
 		})
@@ -834,6 +834,7 @@ func (user *User) syncPortals(chatMap map[string]whatsapp.Chat, createAll bool)
 		}
 		}
 		create := (chat.LastMessageTime >= user.LastConnection && user.LastConnection > 0) || i < limit
 		create := (chat.LastMessageTime >= user.LastConnection && user.LastConnection > 0) || i < limit
 		if len(chat.Portal.MXID) > 0 || create || createAll {
 		if len(chat.Portal.MXID) > 0 || create || createAll {
+			user.log.Debugfln("Syncing chat %+v", chat.Chat.Source)
 			justCreated := len(chat.Portal.MXID) == 0
 			justCreated := len(chat.Portal.MXID) == 0
 			user.syncPortal(chat)
 			user.syncPortal(chat)
 			user.syncChatDoublePuppetDetails(doublePuppet, chat, justCreated)
 			user.syncChatDoublePuppetDetails(doublePuppet, chat, justCreated)