File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,28 @@ +(MLMessage* _Nullable) processMessage:(XMPPMessage*) messageNode andOuterMessag
117117 return nil ;
118118 }
119119
120- if ([messageNode check: @" /<type=headline>/{http://jabber.org/protocol/pubsub#event}event" ])
120+ if ([messageNode check: @" /<type=headline>/{http://jabber.org/protocol/pubsub#event}event" ] && !isMLhistory )
121121 {
122122 [account.pubsub handleHeadlineMessage: messageNode];
123123 return nil ;
124124 }
125125
126+ // ignore messages older than our autodelete time
127+ // (history backscrolling ones AND normal ones, both would otherwise disappear again immediately afterwards)
128+ // do this before handling the message stanza: only non-MLhistory pubsub messages and error-type stanzas should be processed
129+ // regardless of their age (but pubsub messages only if they aren't MLhistory ones)
130+ NSInteger autodeleteInterval = [[HelperTools defaultsDB ] integerForKey: @" AutodeleteInterval" ];
131+ if (autodeleteInterval > 0 )
132+ {
133+ NSDate * pastDate = [NSDate dateWithTimeIntervalSinceNow: -autodeleteInterval];
134+ NSDate * messageTimestamp = [messageNode findFirst: @" {urn:xmpp:delay}delay@stamp|datetime" ];
135+ if (messageTimestamp != nil && [messageTimestamp compare: pastDate] == NSOrderedAscending)
136+ {
137+ DDLogInfo (@" Ignoring incoming message being too old (probably an MLhistory one)..." );
138+ return nil ;
139+ }
140+ }
141+
126142 // ignore messages from our own device, see this github issue: https://github.com/monal-im/Monal/issues/941
127143 if (![messageNode check: @" /<type=groupchat>" ] && !isMLhistory && [messageNode.from isEqualToString: account.connectionProperties.identity.fullJid] && [messageNode.toUser isEqualToString: account.connectionProperties.identity.jid])
128144 return nil ;
You can’t perform that action at this time.
0 commit comments