From 00f1417cb2ed8199633a12989e9befb53298d407 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Thu, 8 Jun 2023 13:33:22 -0400 Subject: [PATCH] Version 1.6.0 --- badger/ids.go | 2 +- telegabber.go | 2 +- telegram/commands.go | 2 +- telegram/handlers.go | 2 +- telegram/utils.go | 12 ++++++------ xmpp/handlers.go | 16 ++++++++-------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/badger/ids.go b/badger/ids.go index 079887a..1295e8a 100644 --- a/badger/ids.go +++ b/badger/ids.go @@ -92,7 +92,7 @@ func toKeyPrefix(tgAccount, xmppAccount string) []byte { } func toByteKey(prefix, suffix []byte, typ string) []byte { - key := make([]byte, 0, len(prefix) + len(suffix) + 6) + key := make([]byte, 0, len(prefix)+len(suffix)+6) key = append(key, prefix...) key = append(key, []byte(typ)...) key = append(key, []byte("/")...) diff --git a/telegabber.go b/telegabber.go index d133d80..48db544 100644 --- a/telegabber.go +++ b/telegabber.go @@ -15,7 +15,7 @@ import ( goxmpp "gosrc.io/xmpp" ) -var version string = "1.6.0-dev" +var version string = "1.6.0" var commit string var sm *goxmpp.StreamManager diff --git a/telegram/commands.go b/telegram/commands.go index f36108a..5e16a6a 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -652,7 +652,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool) keyValueString("Chat title", info.Fn), keyValueString("Photo", link), keyValueString("Username", info.Nickname), - keyValueString("Full name", info.Given + " " + info.Family), + keyValueString("Full name", info.Given+" "+info.Family), keyValueString("Phone number", info.Tel), } return strings.Join(entries, "\n"), true diff --git a/telegram/handlers.go b/telegram/handlers.go index 6de59e7..57402ab 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -274,7 +274,7 @@ func (c *Client) updateAuthorizationState(update *client.UpdateAuthorizationStat func (c *Client) updateMessageSendSucceeded(update *client.UpdateMessageSendSucceeded) { log.Debugf("replace message %v with %v", update.OldMessageId, update.Message.Id) if err := gateway.IdsDB.ReplaceTgId(c.Session.Login, c.jid, update.Message.ChatId, update.OldMessageId, update.Message.Id); err != nil { - log.Error("failed to replace %v with %v: %v", update.OldMessageId, update.Message.Id, err.Error()) + log.Errorf("failed to replace %v with %v: %v", update.OldMessageId, update.Message.Id, err.Error()) } file, _ := c.contentToFile(update.Message.Content) diff --git a/telegram/utils.go b/telegram/utils.go index a4a2bd4..58f7712 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -25,13 +25,13 @@ import ( ) type VCardInfo struct { - Fn string - Photo *client.File + Fn string + Photo *client.File Nickname string - Given string - Family string - Tel string - Info string + Given string + Family string + Tel string + Info string } var errOffline = errors.New("TDlib instance is offline") diff --git a/xmpp/handlers.go b/xmpp/handlers.go index 5034551..d5666b1 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -183,13 +183,13 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { } } else { /* - // if a message failed to edit on Telegram side, match new XMPP ID with old Telegram ID anyway - if replaceId != 0 { - err = gateway.IdsDB.ReplaceXmppId(session.Session.Login, bare, replace.Id, msg.Id) - if err != nil { - log.Errorf("Failed to replace id %v with %v", replace.Id, msg.Id) - } - } */ + // if a message failed to edit on Telegram side, match new XMPP ID with old Telegram ID anyway + if replaceId != 0 { + err = gateway.IdsDB.ReplaceXmppId(session.Session.Login, bare, replace.Id, msg.Id) + if err != nil { + log.Errorf("Failed to replace id %v with %v", replace.Id, msg.Id) + } + } */ } return } else { @@ -225,7 +225,7 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) { suffix := "@" + msg.From for bare := range sessions { if strings.HasSuffix(bare, suffix) { - gateway.SendServiceMessage(bare, "Your server \"" + msg.From + "\" does not allow to send carbons", component) + gateway.SendServiceMessage(bare, "Your server \""+msg.From+"\" does not allow to send carbons", component) } } }