aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-06-29 22:27:28 +0200
committerChristian Schneppe <christian@pix-art.de>2018-06-29 22:27:28 +0200
commitdda1f862f0d96571e1353e4deefe10bb57a7d269 (patch)
tree12dfdedbcdf7e50be5d66b169374e4357675fb3c /src/main/java
parentd9d6909c69b57b81380798fabe3a4e2d3d347cb1 (diff)
code clean up in contact details presence handling
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Contact.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java15
2 files changed, 8 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java
index 0bcabb9b1..f76e141bf 100644
--- a/src/main/java/de/pixart/messenger/entities/Contact.java
+++ b/src/main/java/de/pixart/messenger/entities/Contact.java
@@ -388,7 +388,10 @@ public class Contact implements ListItem, Blockable {
String ask = item.getAttribute("ask");
String subscription = item.getAttribute("subscription");
- if (subscription != null) {
+ if (subscription == null) {
+ this.resetOption(Options.FROM);
+ this.resetOption(Options.TO);
+ } else {
switch (subscription) {
case "to":
this.resetOption(Options.FROM);
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index 6ce1e7e70..11cf78858 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -72,23 +72,16 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() {
@Override
- public void onCheckedChanged(CompoundButton buttonView,
- boolean isChecked) {
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
- if (contact
- .getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
- xmppConnectionService.sendPresencePacket(contact
- .getAccount(),
- xmppConnectionService.getPresenceGenerator()
- .sendPresenceUpdatesTo(contact));
+ if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
+ xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().sendPresenceUpdatesTo(contact));
} else {
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
}
} else {
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
- xmppConnectionService.sendPresencePacket(contact.getAccount(),
- xmppConnectionService.getPresenceGenerator()
- .stopPresenceUpdatesTo(contact));
+ xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().stopPresenceUpdatesTo(contact));
}
}
};