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);
}
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);
}
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;
}
}
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);
}
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);
}
Aggregations