diff options
Diffstat (limited to 'telegram')
-rw-r--r-- | telegram/commands.go | 1 | ||||
-rw-r--r-- | telegram/handlers.go | 2 | ||||
-rw-r--r-- | telegram/utils.go | 17 |
3 files changed, 15 insertions, 5 deletions
diff --git a/telegram/commands.go b/telegram/commands.go index 2f879b1..184ebfc 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -200,6 +200,7 @@ func (c *Client) sendMessagesReverse(chatID int64, messages []*client.Message) { c.xmpp, reply, false, + "", ) } } diff --git a/telegram/handlers.go b/telegram/handlers.go index 57402ab..8457b05 100644 --- a/telegram/handlers.go +++ b/telegram/handlers.go @@ -242,7 +242,7 @@ func (c *Client) updateMessageContent(update *client.UpdateMessageContent) { textContent.Text.Entities, markupFunction, )) - gateway.SendMessage(c.jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, false) + gateway.SendMessage(c.jid, strconv.FormatInt(update.ChatId, 10), text, "e"+strconv.FormatInt(update.MessageId, 10), c.xmpp, nil, false, "") } } 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) } } } |