Reply own messages
This commit is contained in:
parent
7215d11d79
commit
945b9c063b
|
@ -114,13 +114,23 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
|
||||||
var err error
|
var err error
|
||||||
text := msg.Body
|
text := msg.Body
|
||||||
if len(reply.Id) > 0 {
|
if len(reply.Id) > 0 {
|
||||||
id := reply.Id
|
chatId, msgId, err := gateway.IdsDB.GetByXmppId(session.Session.Login, bare, reply.Id)
|
||||||
if id[0] == 'e' {
|
if err == nil {
|
||||||
id = id[1:]
|
if chatId != toID {
|
||||||
}
|
log.Warnf("Chat mismatch: %v ≠ %v", chatId, toID)
|
||||||
replyId, err = strconv.ParseInt(id, 10, 64)
|
} else {
|
||||||
if err != nil {
|
replyId = msgId
|
||||||
log.Warn(errors.Wrap(err, "Failed to parse message ID!"))
|
log.Debugf("replace tg: %#v %#v", chatId, msgId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
id := reply.Id
|
||||||
|
if id[0] == 'e' {
|
||||||
|
id = id[1:]
|
||||||
|
}
|
||||||
|
replyId, err = strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn(errors.Wrap(err, "Failed to parse message ID!"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if replyId != 0 && fallback.For == "urn:xmpp:reply:0" && len(fallback.Body) > 0 {
|
if replyId != 0 && fallback.For == "urn:xmpp:reply:0" && len(fallback.Body) > 0 {
|
||||||
|
|
Loading…
Reference in a new issue