log reason for message failure

This commit is contained in:
Daniel Gultsch 2015-07-28 14:44:11 +02:00
parent 36d31e7e24
commit 6b8e1ecb95

View file

@ -202,6 +202,13 @@ public class MessageParser extends AbstractParser implements
if (packet.getType() == MessagePacket.TYPE_ERROR) { if (packet.getType() == MessagePacket.TYPE_ERROR) {
Jid from = packet.getFrom(); Jid from = packet.getFrom();
if (from != null) { if (from != null) {
Element error = packet.findChild("error");
String text = error == null ? null : error.findChildContent("text");
if (text != null) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": sending message to "+ from+ " failed - " + text);
} else if (error != null) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": sending message to "+ from+ " failed - " + error);
}
Message message = mXmppConnectionService.markMessage(account, Message message = mXmppConnectionService.markMessage(account,
from.toBareJid(), from.toBareJid(),
packet.getId(), packet.getId(),