mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 17:52:17 -05:00
Always build own device session automatically
This commit is contained in:
parent
9c1c86ed44
commit
db05d26433
@ -803,9 +803,17 @@ public class AxolotlService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerDevices(final Jid jid, @NonNull final Set<Integer> deviceIds) {
|
public void registerDevices(final Jid jid, @NonNull final Set<Integer> deviceIds) {
|
||||||
|
if(jid.toBareJid().equals(account.getJid().toBareJid())) {
|
||||||
if (deviceIds.contains(getOwnDeviceId())) {
|
if (deviceIds.contains(getOwnDeviceId())) {
|
||||||
deviceIds.remove(getOwnDeviceId());
|
deviceIds.remove(getOwnDeviceId());
|
||||||
}
|
}
|
||||||
|
for(Integer deviceId : deviceIds) {
|
||||||
|
AxolotlAddress ownDeviceAddress = new AxolotlAddress(jid.toBareJid().toString(),deviceId);
|
||||||
|
if(sessions.get(ownDeviceAddress) == null) {
|
||||||
|
buildSessionFromPEP(null, ownDeviceAddress, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Set<Integer> expiredDevices = new HashSet<>(axolotlStore.getSubDeviceSessions(jid.toBareJid().toString()));
|
Set<Integer> expiredDevices = new HashSet<>(axolotlStore.getSubDeviceSessions(jid.toBareJid().toString()));
|
||||||
expiredDevices.removeAll(deviceIds);
|
expiredDevices.removeAll(deviceIds);
|
||||||
setTrustOnSessions(jid, expiredDevices, SQLiteAxolotlStore.Trust.TRUSTED,
|
setTrustOnSessions(jid, expiredDevices, SQLiteAxolotlStore.Trust.TRUSTED,
|
||||||
@ -976,11 +984,10 @@ public class AxolotlService {
|
|||||||
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Retrieving bundle: " + bundlesPacket);
|
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Retrieving bundle: " + bundlesPacket);
|
||||||
mXmppConnectionService.sendIqPacket(account, bundlesPacket, new OnIqPacketReceived() {
|
mXmppConnectionService.sendIqPacket(account, bundlesPacket, new OnIqPacketReceived() {
|
||||||
private void finish() {
|
private void finish() {
|
||||||
AxolotlAddress ownAddress = new AxolotlAddress(conversation.getAccount().getJid().toBareJid().toString(),0);
|
AxolotlAddress ownAddress = new AxolotlAddress(account.getJid().toBareJid().toString(),0);
|
||||||
AxolotlAddress foreignAddress = new AxolotlAddress(conversation.getJid().toBareJid().toString(),0);
|
|
||||||
if (!fetchStatusMap.getAll(ownAddress).containsValue(FetchStatus.PENDING)
|
if (!fetchStatusMap.getAll(ownAddress).containsValue(FetchStatus.PENDING)
|
||||||
&& !fetchStatusMap.getAll(foreignAddress).containsValue(FetchStatus.PENDING)) {
|
&& !fetchStatusMap.getAll(address).containsValue(FetchStatus.PENDING)) {
|
||||||
if (flushWaitingQueueAfterFetch) {
|
if (flushWaitingQueueAfterFetch && conversation != null) {
|
||||||
conversation.findUnsentMessagesWithEncryption(Message.ENCRYPTION_AXOLOTL,
|
conversation.findUnsentMessagesWithEncryption(Message.ENCRYPTION_AXOLOTL,
|
||||||
new Conversation.OnMessageFound() {
|
new Conversation.OnMessageFound() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user