mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
fixed adhoc conference creation behaviour. properly show errors. fixes #2290
This commit is contained in:
parent
c8f97be68e
commit
9116782cdc
@ -2410,7 +2410,7 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String findConferenceServer(final Account account) {
|
public String findConferenceServer(final Account account) {
|
||||||
String server;
|
String server;
|
||||||
if (account.getXmppConnection() != null) {
|
if (account.getXmppConnection() != null) {
|
||||||
server = account.getXmppConnection().getMucServer();
|
server = account.getXmppConnection().getMucServer();
|
||||||
@ -2429,7 +2429,7 @@ public class XmppConnectionService extends Service {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAdhocConference(final Account account,
|
public boolean createAdhocConference(final Account account,
|
||||||
final String subject,
|
final String subject,
|
||||||
final Iterable<Jid> jids,
|
final Iterable<Jid> jids,
|
||||||
final UiCallback<Conversation> callback) {
|
final UiCallback<Conversation> callback) {
|
||||||
@ -2441,7 +2441,7 @@ public class XmppConnectionService extends Service {
|
|||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.error(R.string.no_conference_server_found, null);
|
callback.error(R.string.no_conference_server_found, null);
|
||||||
}
|
}
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
final Jid jid = Jid.fromParts(new BigInteger(64, getRNG()).toString(Character.MAX_RADIX), server, null);
|
final Jid jid = Jid.fromParts(new BigInteger(64, getRNG()).toString(Character.MAX_RADIX), server, null);
|
||||||
final Conversation conversation = findOrCreateConversation(account, jid, true);
|
final Conversation conversation = findOrCreateConversation(account, jid, true);
|
||||||
@ -2476,15 +2476,18 @@ public class XmppConnectionService extends Service {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
} catch (InvalidJidException e) {
|
} catch (InvalidJidException e) {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.error(R.string.conference_creation_failed, null);
|
callback.error(R.string.conference_creation_failed, null);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.error(R.string.not_connected_try_again, null);
|
callback.error(R.string.not_connected_try_again, null);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +426,7 @@ public class ConversationActivity extends XmppActivity
|
|||||||
menuContactDetails.setVisible(!this.getSelectedConversation().withSelf());
|
menuContactDetails.setVisible(!this.getSelectedConversation().withSelf());
|
||||||
menuMucDetails.setVisible(false);
|
menuMucDetails.setVisible(false);
|
||||||
menuSecure.setVisible(Config.multipleEncryptionChoices());
|
menuSecure.setVisible(Config.multipleEncryptionChoices());
|
||||||
|
menuInviteContact.setVisible(xmppConnectionService != null && xmppConnectionService.findConferenceServer(getSelectedConversation().getAccount()) != null);
|
||||||
}
|
}
|
||||||
if (this.getSelectedConversation().isMuted()) {
|
if (this.getSelectedConversation().isMuted()) {
|
||||||
menuMute.setVisible(false);
|
menuMute.setVisible(false);
|
||||||
|
@ -719,9 +719,10 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (account != null && jids.size() > 0) {
|
if (account != null && jids.size() > 0) {
|
||||||
xmppConnectionService.createAdhocConference(account, subject, jids, mAdhocConferenceCallback);
|
if (xmppConnectionService.createAdhocConference(account, subject, jids, mAdhocConferenceCallback)) {
|
||||||
mToast = Toast.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
|
mToast = Toast.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
|
||||||
mToast.show();
|
mToast.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1116,8 +1116,7 @@ public abstract class XmppActivity extends Activity {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
jids.add(conversation.getJid().toBareJid());
|
jids.add(conversation.getJid().toBareJid());
|
||||||
service.createAdhocConference(conversation.getAccount(), null, jids, activity.adhocCallback);
|
return service.createAdhocConference(conversation.getAccount(), null, jids, activity.adhocCallback);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user