Properly check for MUC MAM support

saqura created

Only use MAM (XEP-0313) in MUCs if it is supported.

This should fix #1264

Change summary

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 14 
1 file changed, 8 insertions(+), 6 deletions(-)

Detailed changes

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

@@ -1078,13 +1078,15 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 					checkDeletedFiles(conversation);
 					callback.onMoreMessagesLoaded(messages.size(), conversation);
 				} else if (conversation.hasMessagesLeftOnServer()
-						&& account.isOnlineAndConnected()
-						&& account.getXmppConnection().getFeatures().mam()) {
-					MessageArchiveService.Query query = getMessageArchiveService().query(conversation,0,timestamp - 1);
-					if (query != null) {
-						query.setCallback(callback);
+						&& account.isOnlineAndConnected()) {
+					if ((conversation.getMode() == Conversation.MODE_SINGLE && account.getXmppConnection().getFeatures().mam())
+							|| (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().mamSupport())) {
+						MessageArchiveService.Query query = getMessageArchiveService().query(conversation,0,timestamp - 1);
+						if (query != null) {
+							query.setCallback(callback);
+						}
+						callback.informUser(R.string.fetching_history_from_server);
 					}
-					callback.informUser(R.string.fetching_history_from_server);
 				}
 			}
 		};