aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-30 10:36:21 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-30 10:36:21 +0200
commit53533ca74e4b395917088ffd26391cb8da1d2a73 (patch)
tree7389d19f702b676e6711b9c61dd7435dea390a4b /src/eu/siacs
parentf7f730e80466a8843d3c512a583f78309ce0f0ea (diff)
added error message for #240
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/ui/ContactsActivity.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/ui/ContactsActivity.java b/src/eu/siacs/conversations/ui/ContactsActivity.java
index 4e9c8af6..811ae876 100644
--- a/src/eu/siacs/conversations/ui/ContactsActivity.java
+++ b/src/eu/siacs/conversations/ui/ContactsActivity.java
@@ -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) {