diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-20 17:00:50 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-20 17:00:50 +0100 |
commit | c82179c0b8728a9c2cd567d4227c60c758a1e682 (patch) | |
tree | b866a099bb79225bf31a6498374f24f757af163e /src/de/gultsch/chat/utils/MessageParser.java | |
parent | 94ab61d5c0b060e2aea5caf58ac06864f980956b (diff) |
adding and removing roster items now possible. basic error display on error messages
Diffstat (limited to '')
-rw-r--r-- | src/de/gultsch/chat/utils/MessageParser.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/utils/MessageParser.java b/src/de/gultsch/chat/utils/MessageParser.java index aec492c8..1dca7343 100644 --- a/src/de/gultsch/chat/utils/MessageParser.java +++ b/src/de/gultsch/chat/utils/MessageParser.java @@ -116,4 +116,19 @@ public class MessageParser { Conversation conversation = service.findOrCreateConversation(account, parts[0],false); return new Message(conversation,fullJid, message.findChild("body").getContent(), Message.ENCRYPTION_NONE,status); } + + public static Message parseError(MessagePacket packet, Account account, XmppConnectionService service) { + + String[] fromParts = packet.getFrom().split("/"); + Conversation conversation = service.findOrCreateConversation(account, fromParts[0],false); + Element error = packet.findChild("error"); + String errorName = error.getChildren().get(0).getName(); + String displayError; + if (errorName.equals("service-unavailable")) { + displayError = "Contact is offline and does not have offline storage"; + } else { + displayError = errorName.replace("-", " "); + } + return new Message(conversation, packet.getFrom(), displayError, Message.ENCRYPTION_NONE, Message.STATUS_ERROR); + } } |