Skip to content

Commit

Permalink
Allow adding gateway components as contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
lissine0 authored and tmolitor-stud-tu committed Oct 15, 2024
1 parent 18e05fb commit 85595ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Monal/Classes/xmpp.m
Original file line number Diff line number Diff line change
Expand Up @@ -4477,9 +4477,15 @@ -(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([features containsObject:@"http://jabber.org/protocol/muc"])
return resolve(@"muc");
else
return resolve(@"account");
Expand Down

0 comments on commit 85595ec

Please sign in to comment.