| | 248 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [accounts count])]; |
| | 249 | |
| | 250 | [accounts addObserver:self toObjectsAtIndexes:indexSet |
| | 251 | forKeyPath:@"enabled" |
| | 252 | options:0 context:LPAccountIDChangeContext]; |
| | 253 | [accounts addObserver:self toObjectsAtIndexes:indexSet |
| | 254 | forKeyPath:@"name" |
| | 255 | options:0 context:LPAccountIDChangeContext]; |
| | 256 | [accounts addObserver:self toObjectsAtIndexes:indexSet |
| | 257 | forKeyPath:@"JID" |
| | 258 | options:0 context:LPAccountIDChangeContext]; |
| | 259 | [accounts addObserver:self toObjectsAtIndexes:indexSet |
| | 260 | forKeyPath:@"pubManager.mainPubURL" |
| | 261 | options:0 context:LPPubChangeContext]; |
| | 262 | [accounts addObserver:self toObjectsAtIndexes:indexSet |
| | 263 | forKeyPath:@"pubManager.statusPhraseHTML" |
| | 264 | options:0 context:LPPubChangeContext]; |
| | 265 | |
| 283 | | NSEnumerator *groupEnumerator = [groups objectEnumerator]; |
| 284 | | id group; |
| 285 | | while (group = [groupEnumerator nextObject]) { |
| 286 | | [group addObserver:self |
| 287 | | forKeyPath:@"name" |
| 288 | | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| 289 | | context:LPRosterGroupPropertyChangeContext]; |
| 290 | | [group addObserver:self |
| 291 | | forKeyPath:@"type" |
| 292 | | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| 293 | | context:LPRosterGroupPropertyChangeContext]; |
| 294 | | [group addObserver:self |
| 295 | | forKeyPath:@"contacts" |
| 296 | | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| 297 | | context:LPRosterCollectionsChangeContext]; |
| 298 | | } |
| | 295 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [groups count])]; |
| | 296 | |
| | 297 | [groups addObserver:self toObjectsAtIndexes:indexSet |
| | 298 | forKeyPath:@"name" |
| | 299 | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| | 300 | context:LPRosterGroupPropertyChangeContext]; |
| | 301 | [groups addObserver:self toObjectsAtIndexes:indexSet |
| | 302 | forKeyPath:@"type" |
| | 303 | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| | 304 | context:LPRosterGroupPropertyChangeContext]; |
| | 305 | [groups addObserver:self toObjectsAtIndexes:indexSet |
| | 306 | forKeyPath:@"contacts" |
| | 307 | options:( NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld ) |
| | 308 | context:LPRosterCollectionsChangeContext]; |
| 304 | | NSEnumerator *groupEnumerator = [groups objectEnumerator]; |
| 305 | | id group; |
| 306 | | while (group = [groupEnumerator nextObject]) { |
| 307 | | [group removeObserver:self forKeyPath:@"name"]; |
| 308 | | [group removeObserver:self forKeyPath:@"type"]; |
| 309 | | [group removeObserver:self forKeyPath:@"contacts"]; |
| 310 | | } |
| | 314 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [groups count])]; |
| | 315 | |
| | 316 | [groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"name"]; |
| | 317 | [groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"type"]; |
| | 318 | [groups removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"contacts"]; |
| 316 | | NSEnumerator *contactEnumerator = [contacts objectEnumerator]; |
| 317 | | id contact; |
| 318 | | while (contact = [contactEnumerator nextObject]) { |
| 319 | | [contact addObserver:self forKeyPath:@"name" options:0 context:LPRosterItemPropertyChangeContext]; |
| 320 | | [contact addObserver:self forKeyPath:@"avatar" options:0 context:LPRosterItemPropertyChangeContext]; |
| 321 | | [contact addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionOld context:LPRosterItemPropertyChangeContext]; |
| 322 | | [contact addObserver:self forKeyPath:@"statusMessage" options:0 context:LPRosterItemPropertyChangeContext]; |
| 323 | | } |
| | 324 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contacts count])]; |
| | 325 | |
| | 326 | [contacts addObserver:self toObjectsAtIndexes:indexSet |
| | 327 | forKeyPath:@"name" |
| | 328 | options:0 context:LPRosterItemPropertyChangeContext]; |
| | 329 | [contacts addObserver:self toObjectsAtIndexes:indexSet |
| | 330 | forKeyPath:@"avatar" |
| | 331 | options:0 context:LPRosterItemPropertyChangeContext]; |
| | 332 | [contacts addObserver:self toObjectsAtIndexes:indexSet |
| | 333 | forKeyPath:@"status" |
| | 334 | options:NSKeyValueObservingOptionOld context:LPRosterItemPropertyChangeContext]; |
| | 335 | [contacts addObserver:self toObjectsAtIndexes:indexSet |
| | 336 | forKeyPath:@"statusMessage" |
| | 337 | options:0 context:LPRosterItemPropertyChangeContext]; |
| 329 | | NSEnumerator *contactEnumerator = [contacts objectEnumerator]; |
| 330 | | id contact; |
| 331 | | while (contact = [contactEnumerator nextObject]) { |
| 332 | | [contact removeObserver:self forKeyPath:@"name"]; |
| 333 | | [contact removeObserver:self forKeyPath:@"avatar"]; |
| 334 | | [contact removeObserver:self forKeyPath:@"status"]; |
| 335 | | [contact removeObserver:self forKeyPath:@"statusMessage"]; |
| 336 | | } |
| | 343 | NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [contacts count])]; |
| | 344 | |
| | 345 | [contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"name"]; |
| | 346 | [contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"avatar"]; |
| | 347 | [contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"status"]; |
| | 348 | [contacts removeObserver:self fromObjectsAtIndexes:indexSet forKeyPath:@"statusMessage"]; |