show 'try again' button when remote server wasn't found in previously active muc
This commit is contained in:
parent
483304c697
commit
1ac0c2f453
|
@ -1007,6 +1007,18 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int receivedMessagesCount() {
|
||||||
|
int count = 0;
|
||||||
|
synchronized (this.messages) {
|
||||||
|
for(Message message : messages) {
|
||||||
|
if (message.getStatus() == Message.STATUS_RECEIVED) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
private int sentMessagesCount() {
|
private int sentMessagesCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
synchronized (this.messages) {
|
synchronized (this.messages) {
|
||||||
|
|
|
@ -2267,6 +2267,7 @@ public class XmppConnectionService extends Service {
|
||||||
public void onFetchFailed(final Conversation conversation, Element error) {
|
public void onFetchFailed(final Conversation conversation, Element error) {
|
||||||
if (error != null && "remote-server-not-found".equals(error.getName())) {
|
if (error != null && "remote-server-not-found".equals(error.getName())) {
|
||||||
conversation.getMucOptions().setError(MucOptions.Error.SERVER_NOT_FOUND);
|
conversation.getMucOptions().setError(MucOptions.Error.SERVER_NOT_FOUND);
|
||||||
|
updateConversationUi();
|
||||||
} else {
|
} else {
|
||||||
join(conversation);
|
join(conversation);
|
||||||
fetchConferenceConfiguration(conversation);
|
fetchConferenceConfiguration(conversation);
|
||||||
|
|
|
@ -1038,7 +1038,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
showSnackbar(R.string.joining_conference, 0, null);
|
showSnackbar(R.string.joining_conference, 0, null);
|
||||||
break;
|
break;
|
||||||
case SERVER_NOT_FOUND:
|
case SERVER_NOT_FOUND:
|
||||||
|
if (conversation.receivedMessagesCount() > 0) {
|
||||||
|
showSnackbar(R.string.remote_server_not_found,R.string.try_again, joinMuc);
|
||||||
|
} else {
|
||||||
showSnackbar(R.string.remote_server_not_found, R.string.leave, leaveMuc);
|
showSnackbar(R.string.remote_server_not_found, R.string.leave, leaveMuc);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PASSWORD_REQUIRED:
|
case PASSWORD_REQUIRED:
|
||||||
showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword);
|
showSnackbar(R.string.conference_requires_password, R.string.enter_password, enterPassword);
|
||||||
|
@ -1059,6 +1063,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
showSnackbar(R.string.conference_shutdown, R.string.join, joinMuc);
|
showSnackbar(R.string.conference_shutdown, R.string.join, joinMuc);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
hideSnackbar();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (account.hasPendingPgpIntent(conversation)) {
|
} else if (account.hasPendingPgpIntent(conversation)) {
|
||||||
|
|
Loading…
Reference in a new issue