respond to chat marker request only when mutual presence subscription exists
This commit is contained in:
		
							parent
							
								
									26e33de79a
								
							
						
					
					
						commit
						1f7f82da7b
					
				| 
						 | 
					@ -665,7 +665,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
 | 
				
			||||||
			final List<Jid> jids = getCryptoTargets(conversation);
 | 
								final List<Jid> jids = getCryptoTargets(conversation);
 | 
				
			||||||
			for(Jid jid : jids) {
 | 
								for(Jid jid : jids) {
 | 
				
			||||||
				if (!hasAny(jid) && (!deviceIds.containsKey(jid) || deviceIds.get(jid).isEmpty())) {
 | 
									if (!hasAny(jid) && (!deviceIds.containsKey(jid) || deviceIds.get(jid).isEmpty())) {
 | 
				
			||||||
					if (conversation.getAccount().getRoster().getContact(jid).trusted()) {
 | 
										if (conversation.getAccount().getRoster().getContact(jid).mutualPresenceSubscription()) {
 | 
				
			||||||
						return new Pair<>(AxolotlCapability.MISSING_KEYS,jid);
 | 
											return new Pair<>(AxolotlCapability.MISSING_KEYS,jid);
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						return new Pair<>(AxolotlCapability.MISSING_PRESENCE,jid);
 | 
											return new Pair<>(AxolotlCapability.MISSING_PRESENCE,jid);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ public class Contact implements ListItem, Blockable {
 | 
				
			||||||
			return this.systemName;
 | 
								return this.systemName;
 | 
				
			||||||
		} else if (this.serverName != null) {
 | 
							} else if (this.serverName != null) {
 | 
				
			||||||
			return this.serverName;
 | 
								return this.serverName;
 | 
				
			||||||
		} else if (this.presenceName != null && trusted()) {
 | 
							} else if (this.presenceName != null && mutualPresenceSubscription()) {
 | 
				
			||||||
			return this.presenceName;
 | 
								return this.presenceName;
 | 
				
			||||||
		} else if (jid.hasLocalpart()) {
 | 
							} else if (jid.hasLocalpart()) {
 | 
				
			||||||
			return jid.getLocalpart();
 | 
								return jid.getLocalpart();
 | 
				
			||||||
| 
						 | 
					@ -487,7 +487,7 @@ public class Contact implements ListItem, Blockable {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public boolean trusted() {
 | 
						public boolean mutualPresenceSubscription() {
 | 
				
			||||||
		return getOption(Options.FROM) && getOption(Options.TO);
 | 
							return getOption(Options.FROM) && getOption(Options.TO);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -542,7 +542,7 @@ public class Message extends AbstractEntity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public boolean trusted() {
 | 
						public boolean trusted() {
 | 
				
			||||||
		Contact contact = this.getContact();
 | 
							Contact contact = this.getContact();
 | 
				
			||||||
		return (status > STATUS_RECEIVED || (contact != null && contact.trusted()));
 | 
							return (status > STATUS_RECEIVED || (contact != null && contact.mutualPresenceSubscription()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public boolean fixCounterpart() {
 | 
						public boolean fixCounterpart() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -539,7 +539,11 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
 | 
				
			||||||
				mXmppConnectionService.updateConversationUi();
 | 
									mXmppConnectionService.updateConversationUi();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
 | 
								if (mXmppConnectionService.confirmMessages()
 | 
				
			||||||
 | 
										&& message.trusted()
 | 
				
			||||||
 | 
										&& remoteMsgId != null
 | 
				
			||||||
 | 
										&& !isForwarded
 | 
				
			||||||
 | 
										&& !isTypeGroupChat) {
 | 
				
			||||||
				sendMessageReceipts(account, packet);
 | 
									sendMessageReceipts(account, packet);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3115,7 +3115,10 @@ public class XmppConnectionService extends Service {
 | 
				
			||||||
		if (this.markRead(conversation)) {
 | 
							if (this.markRead(conversation)) {
 | 
				
			||||||
			updateConversationUi();
 | 
								updateConversationUi();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (confirmMessages() && markable != null && markable.getRemoteMsgId() != null) {
 | 
							if (confirmMessages()
 | 
				
			||||||
 | 
									&& markable != null
 | 
				
			||||||
 | 
									&& markable.trusted()
 | 
				
			||||||
 | 
									&& markable.getRemoteMsgId() != null) {
 | 
				
			||||||
			Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": sending read marker to " + markable.getCounterpart().toString());
 | 
								Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": sending read marker to " + markable.getCounterpart().toString());
 | 
				
			||||||
			Account account = conversation.getAccount();
 | 
								Account account = conversation.getAccount();
 | 
				
			||||||
			final Jid to = markable.getCounterpart();
 | 
								final Jid to = markable.getCounterpart();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue