aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java4
-rw-r--r--src/main/java/de/pixart/messenger/parser/PresenceParser.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java23
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShareWithActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java10
-rw-r--r--src/main/java/de/pixart/messenger/utils/ExceptionHelper.java2
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java2
8 files changed, 26 insertions, 21 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index f988a1956..76519eda8 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -192,7 +192,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
public boolean execute(Account account) {
if (jid != null) {
- Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true);
+ Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true, false);
if (!conversation.getMucOptions().online()) {
conversation.getMucOptions().setPassword(password);
mXmppConnectionService.databaseBackend.updateConversation(conversation);
@@ -414,7 +414,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
}
if ((body != null || pgpEncrypted != null || axolotlEncrypted != null || oobUrl != null) && !isMucStatusMessage) {
- final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query);
+ final Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query, false);
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
if (serverMsgId == null) {
serverMsgId = extractStanzaId(packet, isTypeGroupChat, conversation);
diff --git a/src/main/java/de/pixart/messenger/parser/PresenceParser.java b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
index 810a6dcc5..f87353ac7 100644
--- a/src/main/java/de/pixart/messenger/parser/PresenceParser.java
+++ b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
@@ -252,7 +252,7 @@ public class PresenceParser extends AbstractParser implements
} else {
contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST);
final Conversation conversation = mXmppConnectionService.findOrCreateConversation(
- account, contact.getJid().toBareJid(), false);
+ account, contact.getJid().toBareJid(), false, false);
final String statusMessage = packet.findChildContent("status");
if (statusMessage != null
&& !statusMessage.isEmpty()
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index f2f8a1ba5..2a0aa62dd 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -1542,7 +1542,7 @@ public class XmppConnectionService extends Service {
if (conversation != null) {
conversation.setBookmark(bookmark);
} else if (bookmark.autojoin() && bookmark.getJid() != null && autojoin) {
- conversation = findOrCreateConversation(account, bookmark.getJid(), true, true);
+ conversation = findOrCreateConversation(account, bookmark.getJid(), true, true, false);
conversation.setBookmark(bookmark);
}
}
@@ -1809,15 +1809,15 @@ public class XmppConnectionService extends Service {
return null;
}
- public Conversation findOrCreateConversation(Account account, Jid jid, boolean muc) {
- return this.findOrCreateConversation(account, jid, muc, false);
+ public Conversation findOrCreateConversation(Account account, Jid jid, boolean muc, final boolean async) {
+ return this.findOrCreateConversation(account, jid, muc, false, async);
}
- public Conversation findOrCreateConversation(final Account account, final Jid jid, final boolean muc, final boolean joinAfterCreate) {
- return this.findOrCreateConversation(account, jid, muc, joinAfterCreate, null);
+ public Conversation findOrCreateConversation(final Account account, final Jid jid, final boolean muc, final boolean joinAfterCreate, final boolean async) {
+ return this.findOrCreateConversation(account, jid, muc, joinAfterCreate, null, async);
}
- public Conversation findOrCreateConversation(final Account account, final Jid jid, final boolean muc, final boolean joinAfterCreate, final MessageArchiveService.Query query) {
+ public Conversation findOrCreateConversation(final Account account, final Jid jid, final boolean muc, final boolean joinAfterCreate, final MessageArchiveService.Query query, final boolean async) {
synchronized (this.conversations) {
Conversation conversation = find(account, jid);
if (conversation != null) {
@@ -1856,7 +1856,7 @@ public class XmppConnectionService extends Service {
loadMessagesFromDb = false;
}
final Conversation c = conversation;
- mDatabaseExecutor.execute(new Runnable() {
+ final Runnable runnable = new Runnable() {
@Override
public void run() {
if (loadMessagesFromDb) {
@@ -1880,7 +1880,12 @@ public class XmppConnectionService extends Service {
joinMuc(c);
}
}
- });
+ };
+ if (async) {
+ mDatabaseExecutor.execute(runnable);
+ } else {
+ runnable.run();
+ }
this.conversations.add(conversation);
updateConversationUi();
return conversation;
@@ -2637,7 +2642,7 @@ public class XmppConnectionService extends Service {
return false;
}
final Jid jid = Jid.fromParts(new BigInteger(64, getRNG()).toString(Character.MAX_RADIX), server, null);
- final Conversation conversation = findOrCreateConversation(account, jid, true, false);
+ final Conversation conversation = findOrCreateConversation(account, jid, true, false, true);
joinMuc(conversation, new OnConferenceJoined() {
@Override
public void onConferenceJoined(final Conversation conversation) {
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index 2050a6ddc..ae40e6064 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -493,7 +493,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected void startConversation(User user) {
if (user.getRealJid() != null) {
- Conversation conversation = xmppConnectionService.findOrCreateConversation(this.mConversation.getAccount(), user.getRealJid().toBareJid(), false);
+ Conversation conversation = xmppConnectionService.findOrCreateConversation(this.mConversation.getAccount(), user.getRealJid().toBareJid(), false, true);
switchToConversation(conversation);
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
index c2cf95241..f8a414102 100644
--- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
@@ -301,7 +301,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
try {
conversation = xmppConnectionService
- .findOrCreateConversation(account, Jid.fromString(share.contact), false);
+ .findOrCreateConversation(account, Jid.fromString(share.contact), false, true);
} catch (final InvalidJidException e) {
return;
}
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 93663bda5..f3cbf7be9 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -331,7 +331,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
protected void openConversationForContact(Contact contact) {
Conversation conversation = xmppConnectionService
.findOrCreateConversation(contact.getAccount(),
- contact.getJid(), false);
+ contact.getJid(), false, true);
switchToConversation(conversation);
}
@@ -372,7 +372,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return;
}
- Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true);
+ Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true);
conversation.setBookmark(bookmark);
if (!bookmark.autojoin() && getPreferences().getBoolean("autojoin", true)) {
bookmark.setAutojoin(true);
@@ -528,7 +528,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
account.getBookmarks().add(bookmark);
xmppConnectionService.pushBookmarks(account);
final Conversation conversation = xmppConnectionService
- .findOrCreateConversation(account, conferenceJid, true, true);
+ .findOrCreateConversation(account, conferenceJid, true, true, true);
conversation.setBookmark(bookmark);
dialog.dismiss();
mCurrentDialog = null;
@@ -536,7 +536,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
}
} else {
final Conversation conversation = xmppConnectionService
- .findOrCreateConversation(account,conferenceJid, true, true);
+ .findOrCreateConversation(account,conferenceJid, true, true, true);
dialog.dismiss();
mCurrentDialog = null;
switchToConversation(conversation);
@@ -597,7 +597,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
protected void switchToConversation(Contact contact, String body) {
Conversation conversation = xmppConnectionService
.findOrCreateConversation(contact.getAccount(),
- contact.getJid(), false);
+ contact.getJid(), false, true);
switchToConversation(conversation, body, false);
}
diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
index 5cf46c151..ed58737ac 100644
--- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java
@@ -102,7 +102,7 @@ public class ExceptionHelper {
Conversation conversation = null;
try {
conversation = service.findOrCreateConversation(finalAccount,
- Jid.fromString(Config.BUG_REPORTS), false);
+ Jid.fromString(Config.BUG_REPORTS), false, true);
} catch (final InvalidJidException ignored) {
}
Message message = new Message(conversation, report
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
index 83c28ff5d..ff97732a3 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
@@ -316,7 +316,7 @@ public class JingleConnection implements Transferable {
this.mJingleStatus = JINGLE_STATUS_INITIATED;
Conversation conversation = this.mXmppConnectionService
.findOrCreateConversation(account,
- packet.getFrom().toBareJid(), false);
+ packet.getFrom().toBareJid(), false, true);
this.message = new Message(conversation, "", Message.ENCRYPTION_NONE);
this.message.setStatus(Message.STATUS_RECEIVED);
this.mStatus = Transferable.STATUS_OFFER;