-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
base: develop
Are you sure you want to change the base?
Conversation
lissine0
commented
Sep 15, 2024
resultDictionary[fieldName] = addresses; | ||
} | ||
} | ||
account.connectionProperties.serverContactAddresses = resultDictionary; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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*
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use NSMutableString where?
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use NSMutableString where?
quick heads up: this is still missing the dataforms rewrite to be mergeable... |