diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-16 10:39:59 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-26 19:41:18 +0200 |
commit | da1edafd495b82a0a9b176f7718cd3fe7b334521 (patch) | |
tree | 87e3db8671b84de9177d758de43761c24e7d4448 /src/main/java/de/pixart/messenger/xmpp | |
parent | bbf63481873eaa39a215b6c5b2f88f16ba807d61 (diff) |
add payment required error
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 9af0a0eb3..081f8975c 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -397,6 +397,8 @@ public class XmppConnection implements Runnable { this.changeStatus(Account.State.SECURITY_ERROR); } catch (final UnauthorizedException e) { this.changeStatus(Account.State.UNAUTHORIZED); + } catch (final PaymentRequiredException e) { + this.changeStatus(Account.State.PAYMENT_REQUIRED); } catch (final UnknownHostException | ConnectException e) { this.changeStatus(Account.State.SERVER_NOT_FOUND); } catch (final SocksSocketFactory.SocksProxyNotFoundException e) { @@ -518,7 +520,16 @@ public class XmppConnection implements Runnable { } break; } else if (nextTag.isStart("failure")) { - throw new UnauthorizedException(); + final Element failure = tagReader.readElement(nextTag); + final String accountDisabled = failure.findChildContent("account-disabled"); + if (accountDisabled != null + && accountDisabled.contains("renew") + && Config.MAGIC_CREATE_DOMAIN != null + && accountDisabled.contains(Config.MAGIC_CREATE_DOMAIN)) { + throw new PaymentRequiredException(); + } else { + throw new UnauthorizedException(); + } } else if (nextTag.isStart("challenge")) { final String challenge = tagReader.readElement(nextTag).getContent(); final Element response = new Element("response"); @@ -1548,6 +1559,10 @@ public class XmppConnection implements Runnable { } + private class PaymentRequiredException extends IOException { + + } + public enum Identity { FACEBOOK, SLACK, |