use of com.xabber.android.data.NetworkException in project xabber-android by redsolution.
the class OTRManager method initSmp.
/**
* Initiate request using SM protocol.
*/
public void initSmp(AccountJid account, UserJid user, String question, String secret) throws NetworkException {
LogManager.i(this, "initializing smp... " + user);
removeSMRequest(account.toString(), user.toString());
addSMProgress(account, user);
try {
getOrCreateSession(account.toString(), user.toString()).initSmp(question, secret);
} catch (OtrException e) {
throw new NetworkException(R.string.OTR_ERROR, e);
}
}
use of com.xabber.android.data.NetworkException in project xabber-android by redsolution.
the class OTRManager method respondSmp.
/**
* Respond using SM protocol.
*/
public void respondSmp(AccountJid account, UserJid user, String question, String secret) throws NetworkException {
LogManager.i(this, "responding smp... " + user);
removeSMRequest(account, user);
addSMProgress(account, user);
try {
getOrCreateSession(account.toString(), user.toString()).respondSmp(question, secret);
} catch (OtrException e) {
throw new NetworkException(R.string.OTR_ERROR, e);
}
}
use of com.xabber.android.data.NetworkException in project xabber-android by redsolution.
the class OTRManager method startSession.
public void startSession(AccountJid account, UserJid user) throws NetworkException {
LogManager.i(this, "Starting session for " + user);
try {
getOrCreateSession(account.toString(), user.toString()).startSession();
} catch (OtrException e) {
throw new NetworkException(R.string.OTR_ERROR, e);
}
LogManager.i(this, "Started session for " + user);
}
use of com.xabber.android.data.NetworkException in project xabber-android by redsolution.
the class SSNManager method sendFeature.
private void sendFeature(AccountJid account, Jid user, String session, Feature feature) {
Message message = new Message(user, Message.Type.normal);
message.setThread(session);
message.addExtension(feature);
try {
StanzaSender.sendStanza(account, message);
} catch (NetworkException e) {
LogManager.exception(this, e);
}
}
use of com.xabber.android.data.NetworkException in project xabber-android by redsolution.
the class ChatActivity method onMenuItemClick.
@Override
public boolean onMenuItemClick(MenuItem item) {
AbstractChat abstractChat = MessageManager.getInstance().getChat(account, user);
switch(item.getItemId()) {
case R.id.action_start_encryption:
if (chatFragment != null)
chatFragment.showResourceChoiceAlert(account, user, false);
return true;
case R.id.action_restart_encryption:
if (chatFragment != null)
chatFragment.showResourceChoiceAlert(account, user, true);
return true;
case R.id.action_stop_encryption:
if (chatFragment != null)
chatFragment.stopEncryption(account, user);
return true;
case R.id.action_verify_with_fingerprint:
startActivity(FingerprintActivity.createIntent(this, account, user));
return true;
case R.id.action_verify_with_question:
startActivity(QuestionActivity.createIntent(this, account, user, true, false, null));
return true;
case R.id.action_verify_with_shared_secret:
startActivity(QuestionActivity.createIntent(this, account, user, false, false, null));
return true;
case R.id.action_send_contact:
sendContact();
return true;
case R.id.action_view_contact:
if (chatFragment != null)
chatFragment.showContactInfo();
return true;
case R.id.action_configure_notifications:
startActivity(CustomNotifySettings.createIntent(this, account, user));
return true;
case R.id.action_authorization_settings:
startActivity(ConferenceAddActivity.createIntent(this, account, user.getBareUserJid()));
return true;
case R.id.action_clear_history:
if (chatFragment != null)
chatFragment.clearHistory(account, user);
return true;
case R.id.action_export_chat:
if (chatFragment != null)
chatFragment.onExportChatClick();
return true;
case R.id.action_call_attention:
if (chatFragment != null)
chatFragment.callAttention();
return true;
case R.id.action_block_contact:
BlockContactDialog.newInstance(account, user).show(getFragmentManager(), BlockContactDialog.class.getName());
return true;
case R.id.action_request_subscription:
try {
PresenceManager.getInstance().requestSubscription(account, user);
} catch (NetworkException e) {
Application.getInstance().onError(e);
}
return true;
case R.id.action_archive_chat:
if (abstractChat != null)
abstractChat.setArchived(true, true);
return true;
case R.id.action_unarchive_chat:
if (abstractChat != null)
abstractChat.setArchived(false, true);
return true;
case R.id.action_mute_chat:
showSnoozeDialog(abstractChat);
return true;
case R.id.action_unmute_chat:
if (abstractChat != null)
abstractChat.setNotificationStateOrDefault(new NotificationState(NotificationState.NotificationMode.enabled, 0), true);
onSnoozed();
return true;
case R.id.action_join_conference:
onJoinConferenceClick();
return true;
case R.id.action_invite_to_chat:
startActivity(ContactListActivity.createRoomInviteIntent(this, account, user.getBareUserJid()));
return true;
case R.id.action_leave_conference:
if (chatFragment != null)
chatFragment.leaveConference(account, user);
return true;
case R.id.action_show_archived:
this.showArchived = !this.showArchived;
if (recentChatFragment != null) {
recentChatFragment.closeSnackbar();
recentChatFragment.updateChats();
Toast.makeText(this, this.showArchived ? R.string.toast_archived_show : R.string.toast_archived_hide, Toast.LENGTH_SHORT).show();
}
return true;
case R.id.action_edit_alias:
editAlias();
return true;
case R.id.action_edit_groups:
startActivity(GroupEditActivity.createIntent(this, account, user));
return true;
case R.id.action_remove_contact:
ContactDeleteDialogFragment.newInstance(account, user).show(getFragmentManager(), "CONTACT_DELETE");
return true;
case R.id.action_delete_conference:
ContactDeleteDialogFragment.newInstance(account, user).show(getFragmentManager(), "CONTACT_DELETE");
return true;
default:
return false;
}
}
Aggregations