From e450626d5c89c03f82f2c86993f805dcf104e283 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 8 Nov 2018 12:20:46 +0100 Subject: [PATCH] add suggested contacts to roster on first message --- .../conversations/services/XmppConnectionService.java | 10 ++++++++++ .../conversations/ui/StartConversationActivity.java | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 4927a6f35..0165cbbea 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1205,6 +1205,16 @@ public class XmppConnectionService extends Service { } final Conversation conversation = (Conversation) message.getConversation(); account.deactivateGracePeriod(); + + + if (QuickConversationsService.isQuicksy() && conversation.getMode() == Conversation.MODE_SINGLE) { + final Contact contact = conversation.getContact(); + if (!contact.showInRoster() && contact.getOption(Contact.Options.SYNCED_VIA_OTHER)) { + Log.d(Config.LOGTAG,account.getJid().asBareJid()+": adding "+contact.getJid()+" on sending message"); + createContact(contact, true); + } + } + MessagePacket packet = null; final boolean addToConversation = (conversation.getMode() != Conversation.MODE_MULTI || !Patches.BAD_MUC_REFLECTION.contains(account.getServerIdentity())) diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index bcbb2980c..fa69862bc 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -1068,7 +1068,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (contact.isSelf()) { showContactDetailsItem.setVisible(false); } - deleteContactMenuItem.setVisible(contact.showInRoster()); + deleteContactMenuItem.setVisible(contact.showInRoster() && !contact.getOption(Contact.Options.SYNCED_VIA_OTHER)); XmppConnection xmpp = contact.getAccount().getXmppConnection(); if (xmpp != null && xmpp.getFeatures().blocking() && !contact.isSelf()) { if (contact.isBlocked()) { @@ -1115,8 +1115,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } public class ListPagerAdapter extends PagerAdapter { - FragmentManager fragmentManager; - MyListFragment[] fragments; + private final FragmentManager fragmentManager; + private final MyListFragment[] fragments; ListPagerAdapter(FragmentManager fm) { fragmentManager = fm;