mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 17:52:17 -05:00
error msg on offline subscription changes
This commit is contained in:
parent
03854f30c9
commit
7f825f8027
@ -213,4 +213,5 @@
|
|||||||
<string name="muc_details_conference_subject">Conference Subject</string>
|
<string name="muc_details_conference_subject">Conference Subject</string>
|
||||||
<string name="muc_details_your_nickname">Your nickname</string>
|
<string name="muc_details_your_nickname">Your nickname</string>
|
||||||
<string name="muc_details_other_members">Other Members</string>
|
<string name="muc_details_other_members">Other Members</string>
|
||||||
|
<string name="subscription_not_updated_offline">Account offline. Could not update subscription</string>
|
||||||
</resources>
|
</resources>
|
@ -301,52 +301,69 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
|
boolean online = contact.getAccount().getStatus() == Account.STATUS_ONLINE;
|
||||||
if (contact.getOption(Contact.Options.FROM)) {
|
if (contact.getOption(Contact.Options.FROM)) {
|
||||||
if (!send.isChecked()) {
|
if (!send.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.resetOption(Contact.Options.FROM);
|
contact.resetOption(Contact.Options.FROM);
|
||||||
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
activity.xmppConnectionService.stopPresenceUpdatesTo(contact);
|
activity.xmppConnectionService.stopPresenceUpdatesTo(contact);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (contact
|
if (contact
|
||||||
.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
|
.getOption(Contact.Options.PREEMPTIVE_GRANT)) {
|
||||||
if (!send.isChecked()) {
|
if (!send.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (send.isChecked()) {
|
if (send.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contact.getOption(Contact.Options.TO)) {
|
if (contact.getOption(Contact.Options.TO)) {
|
||||||
if (!receive.isChecked()) {
|
if (!receive.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.resetOption(Contact.Options.TO);
|
contact.resetOption(Contact.Options.TO);
|
||||||
activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
|
activity.xmppConnectionService.stopPresenceUpdatesFrom(contact);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (contact.getOption(Contact.Options.ASKING)) {
|
if (contact.getOption(Contact.Options.ASKING)) {
|
||||||
if (!receive.isChecked()) {
|
if (!receive.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.resetOption(Contact.Options.ASKING);
|
contact.resetOption(Contact.Options.ASKING);
|
||||||
activity.xmppConnectionService
|
activity.xmppConnectionService
|
||||||
.stopPresenceUpdatesFrom(contact);
|
.stopPresenceUpdatesFrom(contact);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (receive.isChecked()) {
|
if (receive.isChecked()) {
|
||||||
|
if (online) {
|
||||||
contact.setOption(Contact.Options.ASKING);
|
contact.setOption(Contact.Options.ASKING);
|
||||||
activity.xmppConnectionService
|
activity.xmppConnectionService
|
||||||
.requestPresenceUpdatesFrom(contact);
|
.requestPresenceUpdatesFrom(contact);
|
||||||
|
}
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updated) {
|
if (updated) {
|
||||||
|
if (online) {
|
||||||
Toast.makeText(getApplicationContext(), getString(R.string.subscription_updated), Toast.LENGTH_SHORT).show();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user