[BUGFIX] error received message

This commit is contained in:
Martin/Geno 2019-06-03 00:02:18 +02:00
parent c21927e4d5
commit f2739ea81f
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
1 changed files with 7 additions and 4 deletions

View File

@ -12,6 +12,13 @@ import (
func (a *Account) receiver(out chan<- xmpp.Packet) { func (a *Account) receiver(out chan<- xmpp.Packet) {
for receivedMessage := range a.receive { for receivedMessage := range a.receive {
if receivedMessage.Err != nil {
log.Warnf("Error Receiving Message: %s\n", receivedMessage.Err)
xMSG := xmpp.NewMessage("chat", "", a.XMPP.String(), "", "en")
xMSG.Body = fmt.Sprintf("error on decoding message:\n%v", receivedMessage.Err)
out <- xMSG
continue
}
sender := receivedMessage.Msg.Sender().String() sender := receivedMessage.Msg.Sender().String()
if string(a.TID) == sender { if string(a.TID) == sender {
continue continue
@ -32,10 +39,6 @@ func requestExtensions(xMSG *xmpp.Message) {
} }
func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error) { func (a *Account) receiving(receivedMessage o3.ReceivedMsg) (xmpp.Packet, error) {
if receivedMessage.Err != nil {
log.Warnf("Error Receiving Message: %s\n", receivedMessage.Err)
return nil, receivedMessage.Err
}
switch msg := receivedMessage.Msg.(type) { switch msg := receivedMessage.Msg.(type) {
case o3.TextMessage: case o3.TextMessage:
sender := msg.Sender().String() sender := msg.Sender().String()