avoid unnessary muc mam queries when message count is 0 after subject
This commit is contained in:
parent
ba5d0892a6
commit
fe1cff016f
|
@ -249,6 +249,12 @@ public class Conversation extends AbstractEntity implements Blockable {
|
||||||
this.mLastReceivedOtrMessageId = id;
|
this.mLastReceivedOtrMessageId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int countMessages() {
|
||||||
|
synchronized (this.messages) {
|
||||||
|
return this.messages.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface OnMessageFound {
|
public interface OnMessageFound {
|
||||||
public void onMessageFound(final Message message);
|
public void onMessageFound(final Message message);
|
||||||
|
|
|
@ -367,7 +367,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (packet.hasChild("subject") && isTypeGroupChat) {
|
if (packet.hasChild("subject") && isTypeGroupChat) {
|
||||||
Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
|
Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
|
||||||
if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) {
|
if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
conversation.setHasMessagesLeftOnServer(true);
|
conversation.setHasMessagesLeftOnServer(conversation.countMessages() > 0);
|
||||||
conversation.getMucOptions().setSubject(packet.findChildContent("subject"));
|
conversation.getMucOptions().setSubject(packet.findChildContent("subject"));
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue