diff options
Diffstat (limited to 'telegram')
-rw-r--r-- | telegram/utils.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 40553a4..5c27f7c 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -328,6 +328,8 @@ func (c *Client) JoinMUC(chatId int64, resource string, limit int32) { if err == nil { c.sendMessagesReverse(chatId, messages, false, c.jid+"/"+resource) } + + c.sendMUCSubject(chatId, resource) } func (c *Client) sendMUCStatuses(chatID int64) { @@ -392,6 +394,26 @@ func (c *Client) sendMUCStatuses(chatID int64) { ) } +func (c *Client) sendMUCSubject(chatID int64, resource string) { + pin, err := c.client.GetChatPinnedMessage(&client.GetChatPinnedMessageRequest{ + ChatId: chatID, + }) + mucJid := strconv.FormatInt(chatID, 10) + "@" + gateway.Jid.Bare() + toJid := c.jid + "/" + resource + if err == nil { + gateway.SendSubjectMessage( + toJid, + mucJid + "/" + c.getMUCNickname(c.getSenderId(pin)), + c.messageToText(pin, false), + strconv.FormatInt(pin.Id, 10), + c.xmpp, + int64(pin.Date), + ) + } else { + gateway.SendSubjectMessage(toJid, mucJid, "", "", c.xmpp, 0) + } +} + func (c *Client) getMUCNickname(chatID int64) string { return c.formatContact(chatID) } |