fix private chat room name/avatar update bug
This commit is contained in:
parent
04b043426e
commit
5dcee4ba03
|
@ -272,7 +272,8 @@ func (puppet *Puppet) UpdateName(source *User, contact skype.Contact) bool {
|
|||
|
||||
func (puppet *Puppet) updatePortalMeta(meta func(portal *Portal)) {
|
||||
if puppet.bridge.Config.Bridge.PrivateChatPortalMeta {
|
||||
for _, portal := range puppet.bridge.GetAllPortalsByJID(puppet.JID) {
|
||||
jid := strings.Replace(puppet.JID, whatsappExt.NewUserSuffix, "", 1)
|
||||
for _, portal := range puppet.bridge.GetAllPortalsByJID(jid) {
|
||||
meta(portal)
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +307,6 @@ func (puppet *Puppet) updatePortalName() {
|
|||
}
|
||||
|
||||
func (puppet *Puppet) Sync(source *User, contact skype.Contact) {
|
||||
fmt.Println("sync")
|
||||
err := puppet.DefaultIntent().EnsureRegistered()
|
||||
if err != nil {
|
||||
puppet.log.Errorln("Failed to ensure registered:", err)
|
||||
|
|
24
user.go
24
user.go
|
@ -21,7 +21,6 @@ import (
|
|||
waProto "github.com/Rhymen/go-whatsapp/binary/proto"
|
||||
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/format"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
||||
"github.com/kelaresg/matrix-skype/database"
|
||||
|
@ -969,17 +968,18 @@ func (user *User) HandleCommand(cmd skypeExt.Command) {
|
|||
go portal.UpdateAvatar(user, cmd.ProfilePicInfo)
|
||||
}
|
||||
case skypeExt.CommandDisconnect:
|
||||
var msg string
|
||||
if cmd.Kind == "replaced" {
|
||||
msg = "\u26a0 Your WhatsApp connection was closed by the server because you opened another WhatsApp Web client.\n\n" +
|
||||
"Use the `reconnect` command to disconnect the other client and resume bridging."
|
||||
} else {
|
||||
user.log.Warnln("Unknown kind of disconnect:", string(cmd.Raw))
|
||||
msg = fmt.Sprintf("\u26a0 Your WhatsApp connection was closed by the server (reason code: %s).\n\n"+
|
||||
"Use the `reconnect` command to reconnect.", cmd.Kind)
|
||||
}
|
||||
user.cleanDisconnection = true
|
||||
go user.bridge.Bot.SendMessageEvent(user.GetManagementRoom(), event.EventMessage, format.RenderMarkdown(msg, true, false))
|
||||
//var msg string
|
||||
//if cmd.Kind == "replaced" {
|
||||
// msg = "\u26a0 Your Skype connection was closed by the server because you opened another Skype Web client.\n\n" +
|
||||
// "Use the `reconnect` command to disconnect the other client and resume bridging."
|
||||
//} else {
|
||||
// user.log.Warnln("Unknown kind of disconnect:", string(cmd.Raw))
|
||||
// msg = fmt.Sprintf("\u26a0 Your Skype connection was closed by the server (reason code: %s).\n\n"+
|
||||
// "Use the `reconnect` command to reconnect.", cmd.Kind)
|
||||
//}
|
||||
//msg = "can not disconnect"
|
||||
//user.cleanDisconnection = true
|
||||
//go user.bridge.Bot.SendMessageEvent(user.GetManagementRoom(), event.EventMessage, format.RenderMarkdown(msg, true, false))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue