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

Implement XEP-0157: Contact Addresses for XMPP Services #1238

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

lissine0
Copy link
Contributor

yax.im conversations.im

resultDictionary[fieldName] = addresses;
}
}
account.connectionProperties.serverContactAddresses = resultDictionary;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fine? or is [ copy] / [ mutableCopy] more appropriate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having this non-mutable would be better...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do you mean just
account.connectionProperties.serverContactAddresses = [resultDictionary copy];

Or do you also mean changing MLXMPPConnection.serverContactAddresses's type from NSMutableDictionary* to NSDictionary*

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both, copy and change to NSDictionary

//get the server's contact addresses (XEP-0157)
XMPPDataForm* dataForm = [iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{http://jabber.org/network/serverinfo}result\\"];
NSMutableDictionary* resultDictionary = [NSMutableDictionary dictionary];
NSString* fieldName;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question: would it be more efficient if NSMutableString is used here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use NSMutableString where?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NSMutableString* fieldName; instead of NSString* fieldName;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the field name isn't mutated at all, why use NSMutableString? You'd even have to mutably copy the NSString over into an NSMutableString as opposed to just using the NSString directly as is.

XMPPDataForm* dataForm = [iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{http://jabber.org/network/serverinfo}result\\"];
NSMutableDictionary* resultDictionary = [NSMutableDictionary dictionary];
NSString* fieldName;
for (MLXMLNode* field in dataForm.children)
Copy link
Member

@tmolitor-stud-tu tmolitor-stud-tu Sep 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the data-forms part of my xml query article and check out the dictionary and array interfaces in XMPPDataForm.h as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be addressed...

resultDictionary[fieldName] = addresses;
}
}
account.connectionProperties.serverContactAddresses = resultDictionary;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having this non-mutable would be better...

//get the server's contact addresses (XEP-0157)
XMPPDataForm* dataForm = [iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{http://jabber.org/network/serverinfo}result\\"];
NSMutableDictionary* resultDictionary = [NSMutableDictionary dictionary];
NSString* fieldName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use NSMutableString where?

Monal/Classes/MLIQProcessor.m Show resolved Hide resolved
@tmolitor-stud-tu
Copy link
Member

quick heads up: this is still missing the dataforms rewrite to be mergeable...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants