diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/AbstractParser.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/AbstractParser.java b/src/main/java/de/pixart/messenger/parser/AbstractParser.java index 937327261..f67a00a76 100644 --- a/src/main/java/de/pixart/messenger/parser/AbstractParser.java +++ b/src/main/java/de/pixart/messenger/parser/AbstractParser.java @@ -92,4 +92,18 @@ public abstract class AbstractParser { user.setRole(role); return user; } + + public static String extractErrorMessage(Element packet) { + final Element error = packet.findChild("error"); + if (error != null && error.getChildren().size() > 0) { + final String text = error.findChildContent("text"); + if (text != null && !text.trim().isEmpty()) { + return text; + } else { + return error.getChildren().get(0).getName().replace("-"," "); + } + } else { + return null; + } + } } |