~singpolyma/cheogram-android

335f4b21f1f7bb0b00ae104292898cf28cfc254b — Stephen Paul Weber 1 year, 7 months ago f75e6bf
Make sure command intent can work even if we don't have caps for the jid
M src/main/java/eu/siacs/conversations/ui/ConversationFragment.java => src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +11 -1
@@ 2764,7 2764,17 @@ public class ConversationFragment extends XmppFragment
                if (adapter != null && adapter.getCount() > 1) {
                    binding.conversationViewPager.setCurrentItem(1);
                }
                final Jid commandJid = conversation.getContact().resourceWhichSupport(Namespace.COMMANDS);
                final String jid = extras.getString(ConversationsActivity.EXTRA_JID);
                Jid commandJid = null;
                if (jid != null) {
                    try {
                        commandJid = Jid.of(jid);
                    } catch (final IllegalArgumentException e) { }
                }
                if (commandJid == null || !commandJid.isFullJid()) {
                    final Jid discoJid = conversation.getContact().resourceWhichSupport(Namespace.COMMANDS);
                    if (discoJid != null) commandJid = discoJid;
                }
                if (node != null && commandJid != null) {
                    conversation.startCommand(commandFor(commandJid, node), activity.xmppConnectionService);
                }

M src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java => src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +1 -0
@@ 100,6 100,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
    public static final String POST_ACTION_RECORD_VOICE = "record_voice";
    public static final String EXTRA_TYPE = "type";
    public static final String EXTRA_NODE = "node";
    public static final String EXTRA_JID = "jid";

    private static final List<String> VIEW_AND_SHARE_ACTIONS = Arrays.asList(
            ACTION_VIEW_CONVERSATION,

M src/main/java/eu/siacs/conversations/ui/XmppActivity.java => src/main/java/eu/siacs/conversations/ui/XmppActivity.java +1 -0
@@ 480,6 480,7 @@ public abstract class XmppActivity extends ActionBarActivity {
        intent.putExtra(ConversationsActivity.EXTRA_CONVERSATION, xmppConnectionService.findOrCreateConversation(account, jid, false, false).getUuid());
        intent.putExtra(ConversationsActivity.EXTRA_POST_INIT_ACTION, "command");
        intent.putExtra(ConversationsActivity.EXTRA_NODE, node);
        intent.putExtra(ConversationsActivity.EXTRA_JID, (CharSequence) jid);
        intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
    }