only show muc errors if actually connected

This commit is contained in:
iNPUTmice 2014-07-18 19:36:29 +02:00
parent b561d15720
commit 9cfb4ee6c3

View file

@ -8,6 +8,7 @@ import java.util.Set;
import net.java.otr4j.session.SessionStatus;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
@ -118,7 +119,8 @@ public class ConversationFragment extends Fragment {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), ConferenceDetailsActivity.class);
Intent intent = new Intent(getActivity(),
ConferenceDetailsActivity.class);
intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
intent.putExtra("uuid", conversation.getUuid());
startActivity(intent);
@ -672,7 +674,8 @@ public class ConversationFragment extends Fragment {
@Override
public void userInputRequried(PendingIntent pi, Message message) {
askForPassphraseIntent = pi.getIntentSender();
showSnackbar(R.string.openpgp_messages_found,R.string.decrypt,clickToDecryptListener);
showSnackbar(R.string.openpgp_messages_found,
R.string.decrypt, clickToDecryptListener);
}
@Override
@ -724,11 +727,14 @@ public class ConversationFragment extends Fragment {
makeFingerprintWarning(conversation.getLatestEncryption());
}
} else {
if (!conversation.getMucOptions().online()) {
if (!conversation.getMucOptions().online()
&& conversation.getAccount().getStatus() == Account.STATUS_ONLINE) {
if (conversation.getMucOptions().getError() == MucOptions.ERROR_NICK_IN_USE) {
showSnackbar(R.string.nick_in_use, R.string.edit,clickToMuc);
showSnackbar(R.string.nick_in_use, R.string.edit,
clickToMuc);
} else if (conversation.getMucOptions().getError() == MucOptions.ERROR_ROOM_NOT_FOUND) {
showSnackbar(R.string.conference_not_found,R.string.leave,leaveMuc);
showSnackbar(R.string.conference_not_found,
R.string.leave, leaveMuc);
}
}
}
@ -783,22 +789,25 @@ public class ConversationFragment extends Fragment {
&& (conversation.hasValidOtrSession()
&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!knownFingerprints
.contains(conversation.getOtrFingerprint())))) {
showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, new OnClickListener() {
showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify,
new OnClickListener() {
@Override
public void onClick(View v) {
if (conversation.getOtrFingerprint() != null) {
AlertDialog dialog = UIHelper.getVerifyFingerprintDialog(
(ConversationActivity) getActivity(), conversation,
snackbar);
dialog.show();
}
}
});
@Override
public void onClick(View v) {
if (conversation.getOtrFingerprint() != null) {
AlertDialog dialog = UIHelper
.getVerifyFingerprintDialog(
(ConversationActivity) getActivity(),
conversation, snackbar);
dialog.show();
}
}
});
}
}
protected void showSnackbar(int message, int action, OnClickListener clickListener) {
protected void showSnackbar(int message, int action,
OnClickListener clickListener) {
snackbar.setVisibility(View.VISIBLE);
snackbarMessage.setText(message);
snackbarAction.setText(action);