diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-06-27 16:14:35 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-06-27 16:14:35 +0300 |
commit | b5920822c4489897248b770cf7e0e4324b84db89 (patch) | |
tree | c40afc9f8423d022199b27457e95e170522d6c4d /telegram/utils.go | |
parent | 739fc4110a9c12aa51cbd6361e5c4398c8ed7ff8 (diff) |
Send nick in messages (specially für Sava, but nahuj nado)message-nick
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 58f7712..fe00467 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -891,13 +891,22 @@ func (c *Client) ensureDownloadFile(file *client.File) *client.File { // ProcessIncomingMessage transfers a message to XMPP side and marks it as read on Telegram side func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) { - var text, oob, auxText string + var text, oob, auxText, nick, contentType string var err error reply, replyMsg := c.getMessageReply(message) content := message.Content - if content != nil && content.MessageContentType() == client.TypeMessageChatChangePhoto { + if content != nil { + contentType = content.MessageContentType() + } + + if contentType == client.TypeMessageChatChangeTitle { + changeTitle, _ := content.(*client.MessageChatChangeTitle) + nick = changeTitle.Title + } + + if contentType == client.TypeMessageChatChangePhoto { chat, err := c.client.GetChat(&client.GetChatRequest{ ChatId: chatId, }) @@ -983,9 +992,9 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) { } for _, jid := range jids { - gateway.SendMessageWithOOB(jid, sChatId, text, sId, c.xmpp, reply, oob, isOutgoing) + gateway.SendMessageWithOOB(jid, sChatId, text, sId, c.xmpp, reply, oob, isOutgoing, nick) if auxText != "" { - gateway.SendMessage(jid, sChatId, auxText, sId, c.xmpp, reply, isOutgoing) + gateway.SendMessage(jid, sChatId, auxText, sId, c.xmpp, reply, isOutgoing, nick) } } } |