Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements for slidge #1245

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Monal/Classes/MLMessageProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,6 @@ +(MLMessage* _Nullable) processMessage:(XMPPMessage*) messageNode andOuterMessag
return nil;
}

//ignore all other groupchat messages coming from bare jid (e.g. not being a "normal" muc message nor a subject update handled above)
lissine0 marked this conversation as resolved.
Show resolved Hide resolved
if([messageNode check:@"/<type=groupchat>"] && !messageNode.fromResource)
{
DDLogVerbose(@"Ignoring groupchat message without resource (should be already handled above)...");
return nil;
}

NSString* decrypted;
if([messageNode check:@"{eu.siacs.conversations.axolotl}encrypted/header"])
{
Expand Down Expand Up @@ -581,6 +574,9 @@ +(MLMessage* _Nullable) processMessage:(XMPPMessage*) messageNode andOuterMessag
else if([lowercaseBody hasPrefix:@"https://"])
messageType = kMessageTypeUrl;
}
//messages from room jids are classified as status messages
if([messageNode check:@"/<type=groupchat>"] && !messageNode.fromResource)
messageType = kMessageTypeStatus;
DDLogInfo(@"Got message of type: %@", messageType);

if(body)
Expand Down
11 changes: 9 additions & 2 deletions Monal/Classes/xmpp.m
Original file line number Diff line number Diff line change
Expand Up @@ -4477,9 +4477,16 @@ -(AnyPromise*) checkJidType:(NSString*) jid
[discoInfo setiqTo:jid];
[discoInfo setDiscoInfoNode];
[self sendIq:discoInfo withResponseHandler:^(XMPPIQ* response) {
NSSet* identities = [NSSet setWithArray:[response find:@"{http://jabber.org/protocol/disco#info}query/identity@category"]];
NSSet* features = [NSSet setWithArray:[response find:@"{http://jabber.org/protocol/disco#info}query/feature@var"]];
//check if this is a muc or account
if([features containsObject:@"http://jabber.org/protocol/muc"])
//check if this is an account or a muc
//this test has to come first because a gateway component may have an "account" identity while also supporintg MUC.
//usually this means that there's a bot at the component's address that facilitates registration without adhoc commands.
//the "account" jidType makes it possible to add the component as a contact.
if([identities containsObject:@"account"])
return resolve(@"account");
else if([identities containsObject:@"conference"]
&& [features containsObject:@"http://jabber.org/protocol/muc"])
return resolve(@"muc");
else
return resolve(@"account");
Expand Down