|
|
|
@ -764,34 +764,34 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
|
|
|
|
|
text = c.messageToText(message, false)
|
|
|
|
|
|
|
|
|
|
// OTR support (I do not know why would you need it, seriously)
|
|
|
|
|
if !(strings.HasPrefix(text, "?OTR") || c.Session.RawMessages) {
|
|
|
|
|
if !(strings.HasPrefix(text, "?OTR") || (c.Session.RawMessages && !c.Session.OOBMode)) {
|
|
|
|
|
file, preview := c.contentToFile(content)
|
|
|
|
|
|
|
|
|
|
// download file and preview (if present)
|
|
|
|
|
file = c.ensureDownloadFile(file)
|
|
|
|
|
preview = c.ensureDownloadFile(preview)
|
|
|
|
|
|
|
|
|
|
var prefix strings.Builder
|
|
|
|
|
previewName, _ := c.formatFile(preview, true)
|
|
|
|
|
fileName, link := c.formatFile(file, false)
|
|
|
|
|
prefix.WriteString(c.messageToPrefix(message, previewName, fileName))
|
|
|
|
|
|
|
|
|
|
oob = link
|
|
|
|
|
if text != "" {
|
|
|
|
|
// \n if it is groupchat and message is not empty
|
|
|
|
|
if chatId < 0 {
|
|
|
|
|
prefix.WriteString("\n")
|
|
|
|
|
} else if chatId > 0 {
|
|
|
|
|
prefix.WriteString(" | ")
|
|
|
|
|
}
|
|
|
|
|
if c.Session.OOBMode && oob != "" {
|
|
|
|
|
text = oob
|
|
|
|
|
} else if !c.Session.RawMessages {
|
|
|
|
|
var prefix strings.Builder
|
|
|
|
|
prefix.WriteString(c.messageToPrefix(message, previewName, fileName))
|
|
|
|
|
if text != "" {
|
|
|
|
|
// \n if it is groupchat and message is not empty
|
|
|
|
|
if chatId < 0 {
|
|
|
|
|
prefix.WriteString("\n")
|
|
|
|
|
} else if chatId > 0 {
|
|
|
|
|
prefix.WriteString(" | ")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefix.WriteString(text)
|
|
|
|
|
prefix.WriteString(text)
|
|
|
|
|
}
|
|
|
|
|
text = prefix.String()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
text = prefix.String()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if c.Session.OOBMode && oob != "" {
|
|
|
|
|
text = oob
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|