aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-05 13:29:45 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-05 13:29:45 +0200
commitdc0213710640911a796880fcd68a75d2b576918d (patch)
treee5a480c2b53da55a828147ea2af2da53740ba95d /src/eu/siacs/conversations
parent34228d0e7820eedec1d610d28db99fb91783de60 (diff)
warn user if no presence subscription exists
Diffstat (limited to 'src/eu/siacs/conversations')
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index 72902c65..7d903e86 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -36,11 +36,13 @@ import android.os.IBinder;
import android.text.InputType;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
+import android.widget.Toast;
public abstract class XmppActivity extends Activity {
@@ -298,6 +300,26 @@ public abstract class XmppActivity extends Activity {
builder.create().show();
}
+ private void showAskForPresenceDialog(final Contact contact) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(contact.getJid());
+ builder.setMessage(R.string.request_presence_updates);
+ builder.setNegativeButton(getString(R.string.cancel), null);
+ builder.setPositiveButton(getString(R.string.request_now),
+ new DialogInterface.OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (xmppConnectionServiceBound) {
+ xmppConnectionService.sendPresencePacket(contact.getAccount(),
+ xmppConnectionService.getPresenceGenerator()
+ .requestPresenceUpdatesFrom(contact));
+ }
+ }
+ });
+ builder.create().show();
+ }
+
protected void quickEdit(String previousValue, OnValueEdited callback) {
quickEdit(previousValue, callback, false);
}
@@ -346,6 +368,18 @@ public abstract class XmppActivity extends Activity {
} else {
Presences presences = contact.getPresences();
if (presences.size() == 0) {
+ if (!contact.getOption(Contact.Options.TO)
+ && !contact.getOption(Contact.Options.ASKING)
+ && contact.getAccount().getStatus() == Account.STATUS_ONLINE) {
+ showAskForPresenceDialog(contact);
+ return;
+ } else if (!contact.getOption(Contact.Options.TO)) {
+ Toast toast = Toast.makeText(this,
+ R.string.missing_presence_updates,
+ Toast.LENGTH_LONG);
+ toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
+ toast.show();
+ }
conversation.setNextPresence(null);
listener.onPresenceSelected();
} else if (presences.size() == 1) {