|
|
|
@ -806,9 +806,11 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) {
|
|
|
|
|
ForceRead: true,
|
|
|
|
|
})
|
|
|
|
|
// forward message to XMPP
|
|
|
|
|
gateway.SendMessageWithOOB(c.jid, strconv.FormatInt(chatId, 10), text, c.xmpp, oob)
|
|
|
|
|
sId := strconv.FormatInt(message.Id, 10)
|
|
|
|
|
sChatId := strconv.FormatInt(chatId, 10)
|
|
|
|
|
gateway.SendMessageWithOOB(c.jid, sChatId, text, sId, c.xmpp, oob)
|
|
|
|
|
if auxText != "" {
|
|
|
|
|
gateway.SendMessage(c.jid, strconv.FormatInt(chatId, 10), auxText, c.xmpp)
|
|
|
|
|
gateway.SendMessage(c.jid, sChatId, auxText, sId, c.xmpp)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -823,7 +825,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
// try to execute commands
|
|
|
|
|
response, isCommand := c.ProcessChatCommand(chatID, text)
|
|
|
|
|
if response != "" {
|
|
|
|
|
gateway.SendMessage(returnJid, strconv.FormatInt(chatID, 10), response, c.xmpp)
|
|
|
|
|
gateway.SendMessage(returnJid, strconv.FormatInt(chatID, 10), response, "", c.xmpp)
|
|
|
|
|
}
|
|
|
|
|
// do not send on success
|
|
|
|
|
if isCommand {
|
|
|
|
@ -849,6 +851,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Failed to fetch the uploaded file: %s", err.Error()),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
return nil
|
|
|
|
@ -861,6 +864,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Received status code %v", response.StatusCode),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
return nil
|
|
|
|
@ -872,6 +876,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Failed to create a temporary directory: %s", err.Error()),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
return nil
|
|
|
|
@ -882,6 +887,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Failed to create a temporary file: %s", err.Error()),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
return nil
|
|
|
|
@ -893,6 +899,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Failed to write a temporary file: %s", err.Error()),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
return nil
|
|
|
|
@ -943,6 +950,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
|
|
|
|
returnJid,
|
|
|
|
|
strconv.FormatInt(chatID, 10),
|
|
|
|
|
fmt.Sprintf("Not sent: %s", err.Error()),
|
|
|
|
|
"",
|
|
|
|
|
c.xmpp,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|