added error message for #240
This commit is contained in:
parent
f7f730e804
commit
53533ca74e
|
@ -249,4 +249,5 @@
|
|||
<string name="openpgp_messages_found">OpenPGP encrypted messages found</string>
|
||||
<string name="openpgp_click_to_decrypt">Click here to enter passphrase and decrypt messages</string>
|
||||
<string name="reception_failed">Reception failed</string>
|
||||
<string name="no_muc_server_found">No suitable Conference Server found</string>
|
||||
</resources>
|
|
@ -240,6 +240,15 @@ public class ContactsActivity extends XmppActivity {
|
|||
String mucName = CryptoHelper.randomMucName(xmppConnectionService.getRNG());
|
||||
String serverName = account.getXmppConnection()
|
||||
.getMucServer();
|
||||
if (serverName==null) {
|
||||
List<String> servers = getMucServers();
|
||||
if (servers.size() >= 1) {
|
||||
serverName = servers.get(0);
|
||||
} else {
|
||||
displayErrorDialog(R.string.no_muc_server_found);
|
||||
return;
|
||||
}
|
||||
}
|
||||
String jid = mucName + "@" + serverName;
|
||||
Conversation conversation = xmppConnectionService
|
||||
.findOrCreateConversation(account, jid, true);
|
||||
|
@ -462,15 +471,22 @@ public class ContactsActivity extends XmppActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isMuc(Contact contact) {
|
||||
private List<String> getMucServers() {
|
||||
ArrayList<String> mucServers = new ArrayList<String>();
|
||||
for(Account account : accounts) {
|
||||
if (account.getXmppConnection()!=null) {
|
||||
mucServers.add(account.getXmppConnection().getMucServer());
|
||||
String server = account.getXmppConnection().getMucServer();
|
||||
if (server!=null) {
|
||||
mucServers.add(server);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mucServers;
|
||||
}
|
||||
|
||||
private boolean isMuc(Contact contact) {
|
||||
String server = contact.getJid().split("@")[1];
|
||||
return mucServers.contains(server);
|
||||
return getMucServers().contains(server);
|
||||
}
|
||||
|
||||
public void startConversation(Contact contact, Account account, boolean muc) {
|
||||
|
|
Loading…
Reference in a new issue