fixed regression that caused messages in muc not being send

This commit is contained in:
Daniel Gultsch 2016-02-17 16:50:48 +01:00
parent c2fbdbde83
commit 3626e4b3a0
2 changed files with 8 additions and 7 deletions

View File

@ -287,7 +287,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} }
List<Conversation> conversations = getConversations(); List<Conversation> conversations = getConversations();
for (Conversation conversation : conversations) { for (Conversation conversation : conversations) {
if (conversation.getAccount() == account && conversation.getMode() == Conversation.MODE_SINGLE) { if (conversation.getAccount() == account
&& !account.pendingConferenceJoins.contains(conversation)) {
if (!conversation.startOtrIfNeeded()) { if (!conversation.startOtrIfNeeded()) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": couldn't start OTR with "+conversation.getContact().getJid()+" when needed"); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": couldn't start OTR with "+conversation.getContact().getJid()+" when needed");
} }
@ -1757,20 +1758,20 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
List<Conversation> conversations = getConversations(); List<Conversation> conversations = getConversations();
for (Conversation conversation : conversations) { for (Conversation conversation : conversations) {
if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getAccount() == account) { if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getAccount() == account) {
joinMuc(conversation, true, null); joinMuc(conversation);
} }
} }
} }
public void joinMuc(Conversation conversation) { public void joinMuc(Conversation conversation) {
joinMuc(conversation, false, null); joinMuc(conversation, null);
} }
private void joinMuc(Conversation conversation, boolean now, final OnConferenceJoined onConferenceJoined) { private void joinMuc(Conversation conversation, final OnConferenceJoined onConferenceJoined) {
Account account = conversation.getAccount(); Account account = conversation.getAccount();
account.pendingConferenceJoins.remove(conversation); account.pendingConferenceJoins.remove(conversation);
account.pendingConferenceLeaves.remove(conversation); account.pendingConferenceLeaves.remove(conversation);
if (account.getStatus() == Account.State.ONLINE || now) { if (account.getStatus() == Account.State.ONLINE) {
conversation.resetMucOptions(); conversation.resetMucOptions();
fetchConferenceConfiguration(conversation, new OnConferenceConfigurationFetched() { fetchConferenceConfiguration(conversation, new OnConferenceConfigurationFetched() {
@ -1949,7 +1950,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
String name = new BigInteger(75, getRNG()).toString(32); String name = new BigInteger(75, getRNG()).toString(32);
Jid jid = Jid.fromParts(name, server, null); Jid jid = Jid.fromParts(name, server, null);
final Conversation conversation = findOrCreateConversation(account, jid, true); final Conversation conversation = findOrCreateConversation(account, jid, true);
joinMuc(conversation, true, new OnConferenceJoined() { joinMuc(conversation, new OnConferenceJoined() {
@Override @Override
public void onConferenceJoined(final Conversation conversation) { public void onConferenceJoined(final Conversation conversation) {
Bundle options = new Bundle(); Bundle options = new Bundle();

View File

@ -1077,10 +1077,10 @@ public class XmppConnection implements Runnable {
if (mPendingServiceDiscoveries == 0) { if (mPendingServiceDiscoveries == 0) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done with service discovery"); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": done with service discovery");
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": online with resource " + account.getResource()); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": online with resource " + account.getResource());
changeStatus(Account.State.ONLINE);
if (bindListener != null) { if (bindListener != null) {
bindListener.onBind(account); bindListener.onBind(account);
} }
changeStatus(Account.State.ONLINE);
} }
} }
} }