Differences From Artifact [3d07ff17e7]:
- File src/XMPPRoster.m — part of check-in [7f10dd9950] at 2012-12-13 22:09:30 on branch trunk — Make method names more consistent with ObjFW. (user: js, size: 9662) [annotate] [blame] [check-ins using]
To Artifact [1569eac957]:
- File
src/XMPPRoster.m
— part of check-in
[471aef0278]
at
2013-02-10 16:09:34
on branch trunk
— Fix roster versioning
This fixes two things:
1) We reset the version we stored for the roster, even though it was
still up to date
2) Since we make mutable copies of the items dictionary in
XMPP_updateRosterItem our memory was rather high.
Use a AutoreleasePool around it for now. (user: florob@babelmonkeys.de, size: 9935) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
307 308 309 310 311 312 313 | - (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection_ IQ: (XMPPIQ*)iq { OFXMLElement *rosterElement; OFEnumerator *enumerator; OFXMLElement *element; | < | > | | | | | > > > | | | > | > | | | > | | | > > > > > > > > | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | - (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection_ IQ: (XMPPIQ*)iq { OFXMLElement *rosterElement; OFEnumerator *enumerator; OFXMLElement *element; rosterElement = [iq elementForName: @"query" namespace: XMPP_NS_ROSTER]; if ([connection supportsRosterVersioning]) { if (rosterElement == nil) { OFDictionary *items = [dataStorage dictionaryForPath: @"roster.items"]; OFEnumerator *enumerator = [items objectEnumerator]; OFDictionary *item; while ((item = [enumerator nextObject]) != nil) { XMPPRosterItem *rosterItem; XMPPJID *JID; rosterItem = [XMPPRosterItem rosterItem]; JID = [XMPPJID JIDWithString: [item objectForKey: @"JID"]]; [rosterItem setJID: JID]; [rosterItem setName: [item objectForKey: @"name"]]; [rosterItem setSubscription: [item objectForKey: @"subscription"]]; [rosterItem setGroups: [item objectForKey: @"groups"]]; [rosterItems setObject: rosterItem forKey: [JID bareJID]]; } } else [dataStorage setDictionary: nil forPath: @"roster.items"]; } enumerator = [[rosterElement children] objectEnumerator]; while ((element = [enumerator nextObject]) != nil) { OFAutoreleasePool *pool; XMPPRosterItem *rosterItem; if (![[element name] isEqual: @"item"] || ![[element namespace] isEqual: XMPP_NS_ROSTER]) continue; pool = [OFAutoreleasePool new]; rosterItem = [self XMPP_rosterItemWithXMLElement: element]; [self XMPP_updateRosterItem: rosterItem]; [pool release]; } if ([connection supportsRosterVersioning] && rosterElement != nil) { OFString *ver = [[rosterElement attributeForName: @"ver"] stringValue]; [dataStorage setStringValue: ver forPath: @"roster.ver"]; [dataStorage save]; } |
︙ | ︙ |