only show muc errors if actually connected
This commit is contained in:
parent
b561d15720
commit
9cfb4ee6c3
|
@ -8,6 +8,7 @@ import java.util.Set;
|
||||||
import net.java.otr4j.session.SessionStatus;
|
import net.java.otr4j.session.SessionStatus;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.crypto.PgpEngine;
|
import eu.siacs.conversations.crypto.PgpEngine;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
|
@ -61,7 +62,7 @@ public class ConversationFragment extends Fragment {
|
||||||
protected ArrayAdapter<Message> messageListAdapter;
|
protected ArrayAdapter<Message> messageListAdapter;
|
||||||
protected Contact contact;
|
protected Contact contact;
|
||||||
protected BitmapCache mBitmapCache = new BitmapCache();
|
protected BitmapCache mBitmapCache = new BitmapCache();
|
||||||
|
|
||||||
protected int mPrimaryTextColor;
|
protected int mPrimaryTextColor;
|
||||||
protected int mSecondaryTextColor;
|
protected int mSecondaryTextColor;
|
||||||
|
|
||||||
|
@ -113,20 +114,21 @@ public class ConversationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private OnClickListener clickToMuc = new OnClickListener() {
|
private OnClickListener clickToMuc = new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
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.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
|
||||||
intent.putExtra("uuid", conversation.getUuid());
|
intent.putExtra("uuid", conversation.getUuid());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private OnClickListener leaveMuc = new OnClickListener() {
|
private OnClickListener leaveMuc = new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
activity.endConversation(conversation);
|
activity.endConversation(conversation);
|
||||||
|
@ -187,12 +189,12 @@ public class ConversationFragment extends Fragment {
|
||||||
|
|
||||||
mPrimaryTextColor = getResources().getColor(R.color.primarytext);
|
mPrimaryTextColor = getResources().getColor(R.color.primarytext);
|
||||||
mSecondaryTextColor = getResources().getColor(R.color.secondarytext);
|
mSecondaryTextColor = getResources().getColor(R.color.secondarytext);
|
||||||
|
|
||||||
final View view = inflater.inflate(R.layout.fragment_conversation,
|
final View view = inflater.inflate(R.layout.fragment_conversation,
|
||||||
container, false);
|
container, false);
|
||||||
chatMsg = (EditText) view.findViewById(R.id.textinput);
|
chatMsg = (EditText) view.findViewById(R.id.textinput);
|
||||||
chatMsg.setOnClickListener(new OnClickListener() {
|
chatMsg.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (activity.getSlidingPaneLayout().isSlideable()) {
|
if (activity.getSlidingPaneLayout().isSlideable()) {
|
||||||
|
@ -672,7 +674,8 @@ public class ConversationFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void userInputRequried(PendingIntent pi, Message message) {
|
public void userInputRequried(PendingIntent pi, Message message) {
|
||||||
askForPassphraseIntent = pi.getIntentSender();
|
askForPassphraseIntent = pi.getIntentSender();
|
||||||
showSnackbar(R.string.openpgp_messages_found,R.string.decrypt,clickToDecryptListener);
|
showSnackbar(R.string.openpgp_messages_found,
|
||||||
|
R.string.decrypt, clickToDecryptListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -724,11 +727,14 @@ public class ConversationFragment extends Fragment {
|
||||||
makeFingerprintWarning(conversation.getLatestEncryption());
|
makeFingerprintWarning(conversation.getLatestEncryption());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!conversation.getMucOptions().online()) {
|
if (!conversation.getMucOptions().online()
|
||||||
|
&& conversation.getAccount().getStatus() == Account.STATUS_ONLINE) {
|
||||||
if (conversation.getMucOptions().getError() == MucOptions.ERROR_NICK_IN_USE) {
|
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) {
|
} 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,28 +789,31 @@ public class ConversationFragment extends Fragment {
|
||||||
&& (conversation.hasValidOtrSession()
|
&& (conversation.hasValidOtrSession()
|
||||||
&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!knownFingerprints
|
&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!knownFingerprints
|
||||||
.contains(conversation.getOtrFingerprint())))) {
|
.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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (conversation.getOtrFingerprint() != null) {
|
if (conversation.getOtrFingerprint() != null) {
|
||||||
AlertDialog dialog = UIHelper.getVerifyFingerprintDialog(
|
AlertDialog dialog = UIHelper
|
||||||
(ConversationActivity) getActivity(), conversation,
|
.getVerifyFingerprintDialog(
|
||||||
snackbar);
|
(ConversationActivity) getActivity(),
|
||||||
dialog.show();
|
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);
|
snackbar.setVisibility(View.VISIBLE);
|
||||||
snackbarMessage.setText(message);
|
snackbarMessage.setText(message);
|
||||||
snackbarAction.setText(action);
|
snackbarAction.setText(action);
|
||||||
snackbarAction.setOnClickListener(clickListener);
|
snackbarAction.setOnClickListener(clickListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideSnackbar() {
|
protected void hideSnackbar() {
|
||||||
snackbar.setVisibility(View.GONE);
|
snackbar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue