Permalink
Browse files

smackable: handle error stanzas. fixes #108

  • Loading branch information...
ge0rg committed Jan 15, 2014
1 parent 007aea3 commit 1593c4d18dab8fbcbe9e58a4bea2eba74205fb82
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/org/yaxim/androidclient/service/SmackableImp.java
@@ -1002,19 +1002,23 @@ public void processPacket(Packet packet) {
}
String chatMessage = msg.getBody();
// display error inline
if (msg.getType() == Message.Type.error) {
changeMessageDeliveryStatus(msg.getPacketID(), ChatConstants.DS_FAILED);
chatMessage = msg.getError().toString();
}
// ignore empty messages
if (chatMessage == null) {
Log.d(TAG, "empty message.");
return;
}
// display error inline
if (msg.getType() == Message.Type.error) {
chatMessage = "<Error> " + chatMessage;
}
// carbons are old. all others are new
int is_new = (cc == null) ? ChatConstants.DS_NEW : ChatConstants.DS_SENT_OR_READ;
if (msg.getType() == Message.Type.error)
is_new = ChatConstants.DS_FAILED;
addChatMessageToDB(direction, fromJID, chatMessage, is_new, ts, msg.getPacketID());
if (direction == ChatConstants.INCOMING)

0 comments on commit 1593c4d

Please sign in to comment.