Search in sources :

Example 31 with Conversation

use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.

the class StartConversationActivity method openConversationsForBookmark.

protected void openConversationsForBookmark(Bookmark bookmark) {
    final Jid jid = bookmark.getFullJid();
    if (jid == null) {
        Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
        return;
    }
    Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true);
    bookmark.setConversation(conversation);
    if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin))) {
        bookmark.setAutojoin(true);
        xmppConnectionService.createBookmark(bookmark.getAccount(), bookmark);
    }
    SoftKeyboardUtils.hideSoftKeyboard(this);
    switchToConversation(conversation);
}
Also used : Jid(eu.siacs.conversations.xmpp.Jid) Conversation(eu.siacs.conversations.entities.Conversation)

Example 32 with Conversation

use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.

the class StartConversationActivity method switchToConversationDoNotAppend.

protected void switchToConversationDoNotAppend(Contact contact, String body) {
    Conversation conversation = xmppConnectionService.findOrCreateConversation(contact.getAccount(), contact.getJid(), false, true);
    switchToConversationDoNotAppend(conversation, body);
}
Also used : Conversation(eu.siacs.conversations.entities.Conversation)

Example 33 with Conversation

use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.

the class StartConversationActivity method handleJid.

private boolean handleJid(Invite invite) {
    List<Contact> contacts = xmppConnectionService.findContacts(invite.getJid(), invite.account);
    if (invite.isAction(XmppUri.ACTION_JOIN)) {
        Conversation muc = xmppConnectionService.findFirstMuc(invite.getJid());
        if (muc != null && !invite.forceDialog) {
            switchToConversationDoNotAppend(muc, invite.getBody());
            return true;
        } else {
            showJoinConferenceDialog(invite.getJid().asBareJid().toEscapedString());
            return false;
        }
    } else if (contacts.size() == 0) {
        showCreateContactDialog(invite.getJid().toEscapedString(), invite);
        return false;
    } else if (contacts.size() == 1) {
        Contact contact = contacts.get(0);
        if (!invite.isSafeSource() && invite.hasFingerprints()) {
            displayVerificationWarningDialog(contact, invite);
        } else {
            if (invite.hasFingerprints()) {
                if (xmppConnectionService.verifyFingerprints(contact, invite.getFingerprints())) {
                    Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
                }
            }
            if (invite.account != null) {
                xmppConnectionService.getShortcutService().report(contact);
            }
            switchToConversationDoNotAppend(contact, invite.getBody());
        }
        return true;
    } else {
        if (mMenuSearchView != null) {
            mMenuSearchView.expandActionView();
            mSearchEditText.setText("");
            mSearchEditText.append(invite.getJid().toEscapedString());
            filter(invite.getJid().toEscapedString());
        } else {
            mInitialSearchValue.push(invite.getJid().toEscapedString());
        }
        return true;
    }
}
Also used : Conversation(eu.siacs.conversations.entities.Conversation) Contact(eu.siacs.conversations.entities.Contact)

Example 34 with Conversation

use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.

the class StartConversationActivity method switchToConversation.

protected void switchToConversation(Contact contact) {
    Conversation conversation = xmppConnectionService.findOrCreateConversation(contact.getAccount(), contact.getJid(), false, true);
    switchToConversation(conversation);
}
Also used : Conversation(eu.siacs.conversations.entities.Conversation)

Example 35 with Conversation

use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.

the class ShareWithActivity method share.

private void share() {
    final Conversation conversation;
    Account account;
    try {
        account = xmppConnectionService.findAccountByJid(Jid.ofEscaped(share.account));
    } catch (final IllegalArgumentException e) {
        account = null;
    }
    if (account == null) {
        return;
    }
    try {
        conversation = xmppConnectionService.findOrCreateConversation(account, Jid.of(share.contact), false, true);
    } catch (final IllegalArgumentException e) {
        return;
    }
    share(conversation);
}
Also used : Account(eu.siacs.conversations.entities.Account) Conversation(eu.siacs.conversations.entities.Conversation)

Aggregations

Conversation (eu.siacs.conversations.entities.Conversation)110 Account (eu.siacs.conversations.entities.Account)27 Message (eu.siacs.conversations.entities.Message)24 Jid (eu.siacs.conversations.xmpp.Jid)22 Contact (eu.siacs.conversations.entities.Contact)17 MucOptions (eu.siacs.conversations.entities.MucOptions)10 Intent (android.content.Intent)9 Element (eu.siacs.conversations.xml.Element)9 PendingIntent (android.app.PendingIntent)8 XmppAxolotlMessage (eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage)8 MessagePacket (eu.siacs.conversations.xmpp.stanzas.MessagePacket)8 Uri (android.net.Uri)7 Conversational (eu.siacs.conversations.entities.Conversational)7 InvalidJidException (eu.siacs.conversations.xmpp.jid.InvalidJidException)7 SuppressLint (android.annotation.SuppressLint)6 SpannableString (android.text.SpannableString)6 XmppConnection (eu.siacs.conversations.xmpp.XmppConnection)6 Jid (eu.siacs.conversations.xmpp.jid.Jid)6 ArrayList (java.util.ArrayList)6 Fragment (android.app.Fragment)4