fixed regression that caused messages in muc not being send

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 13 
src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java            |  2 
2 files changed, 8 insertions(+), 7 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -287,7 +287,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 				}
 				List<Conversation> conversations = getConversations();
 				for (Conversation conversation : conversations) {
-					if (conversation.getAccount() == account && conversation.getMode() == Conversation.MODE_SINGLE) {
+					if (conversation.getAccount() == account
+							&& !account.pendingConferenceJoins.contains(conversation)) {
 						if (!conversation.startOtrIfNeeded()) {
 							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();
 		for (Conversation conversation : conversations) {
 			if (conversation.getMode() == Conversation.MODE_MULTI && conversation.getAccount() == account) {
-				joinMuc(conversation, true, null);
+				joinMuc(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.pendingConferenceJoins.remove(conversation);
 		account.pendingConferenceLeaves.remove(conversation);
-		if (account.getStatus() == Account.State.ONLINE || now) {
+		if (account.getStatus() == Account.State.ONLINE) {
 			conversation.resetMucOptions();
 			fetchConferenceConfiguration(conversation, new OnConferenceConfigurationFetched() {
 
@@ -1949,7 +1950,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 				String name = new BigInteger(75, getRNG()).toString(32);
 				Jid jid = Jid.fromParts(name, server, null);
 				final Conversation conversation = findOrCreateConversation(account, jid, true);
-				joinMuc(conversation, true, new OnConferenceJoined() {
+				joinMuc(conversation, new OnConferenceJoined() {
 					@Override
 					public void onConferenceJoined(final Conversation conversation) {
 						Bundle options = new Bundle();

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java 🔗

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