From 2fe20ffa8e8cfdb6b089e034c4f02010a7c740e6 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Mon, 21 Jul 2014 16:16:09 +0200 Subject: [PATCH] fixed #267 --- res/values/strings.xml | 2 ++ .../conversations/ui/ConversationFragment.java | 13 ++++++++++++- src/eu/siacs/conversations/ui/XmppActivity.java | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index ed5383b65..e542b58e6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -272,4 +272,6 @@ Edit conference subject Conference not found Leave + Contact added you to contact list + Add back diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 202bab2ec..546d039ed 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -699,8 +699,19 @@ public class ConversationFragment extends Fragment { return; } hideSnackbar(); - ConversationActivity activity = (ConversationActivity) getActivity(); + final ConversationActivity activity = (ConversationActivity) getActivity(); if (this.conversation != null) { + final Contact contact = this.conversation.getContact(); + if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { + showSnackbar(R.string.contact_added_you, R.string.add_back, new OnClickListener() { + + @Override + public void onClick(View v) { + activity.xmppConnectionService.createContact(contact); + activity.switchToContactDetails(contact); + } + }); + } for (Message message : this.conversation.getMessages()) { if ((message.getEncryption() == Message.ENCRYPTION_PGP) && ((message.getStatus() == Message.STATUS_RECIEVED) || (message diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index fc51abeff..c813182f3 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -264,6 +264,7 @@ public abstract class XmppActivity extends Activity { Account account = conversation.getAccount(); Contact contact = account.getRoster().getContact(jid); xmppConnectionService.createContact(contact); + switchToContactDetails(contact); } }); builder.create().show();