aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-05-24 11:17:55 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-05-24 11:17:55 +0200
commit7f825f802704a8d1103a667550ce5223ac270956 (patch)
tree7399aba68a48155878cfc9b2ea2480bd88cab31a /src/eu
parent03854f30c95eb5146ca5019c16d747cd472f0f33 (diff)
error msg on offline subscription changes
Diffstat (limited to 'src/eu')
-rw-r--r--src/eu/siacs/conversations/ui/ContactDetailsActivity.java41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 83ae99d9..154533db 100644
--- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -301,52 +301,69 @@ public class ContactDetailsActivity extends XmppActivity {
protected void onStop() {
super.onStop();
boolean updated = false;
+ boolean online = contact.getAccount().getStatus() == Account.STATUS_ONLINE;
if (contact.getOption(Contact.Options.FROM)) {
if (!send.isChecked()) {
- contact.resetOption(Contact.Options.FROM);
- contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
- activity.xmppConnectionService.stopPresenceUpdatesTo(contact);
+ if (online) {
+ contact.resetOption(Contact.Options.FROM);
+ contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
+ activity.xmppConnectionService.stopPresenceUpdatesTo(contact);
+ }
updated = true;
}
} else {
if (contact
.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
if (!send.isChecked()) {
- contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
+ if (online) {
+ contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
+ }
updated = true;
}
} else {
if (send.isChecked()) {
- contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
+ if (online) {
+ contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
+ }
updated = true;
}
}
}
if (contact.getOption(Contact.Options.TO)) {
if (!receive.isChecked()) {
- contact.resetOption(Contact.Options.TO);
- activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
+ if (online) {
+ contact.resetOption(Contact.Options.TO);
+ activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
+ }
updated = true;
}
} else {
if (contact.getOption(Contact.Options.ASKING)) {
if (!receive.isChecked()) {
- contact.resetOption(Contact.Options.ASKING);
- activity.xmppConnectionService
+ if (online) {
+ contact.resetOption(Contact.Options.ASKING);
+ activity.xmppConnectionService
.stopPresenceUpdatesFrom(contact);
+ }
updated = true;
}
} else {
if (receive.isChecked()) {
- contact.setOption(Contact.Options.ASKING);
- activity.xmppConnectionService
+ if (online) {
+ contact.setOption(Contact.Options.ASKING);
+ activity.xmppConnectionService
.requestPresenceUpdatesFrom(contact);
+ }
updated = true;
}
}
}
if (updated) {
- Toast.makeText(getApplicationContext(), getString(R.string.subscription_updated), Toast.LENGTH_SHORT).show();
+ if (online) {
+ Toast.makeText(getApplicationContext(), getString(R.string.subscription_updated), Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(getApplicationContext(), getString(R.string.subscription_not_updated_offline), Toast.LENGTH_SHORT).show();
+ }
}
}