robbiehanson/XMPPFramework — Issue #9: Roster doesn't update correctly upon removing user from contacts list
Author: niha9088
Created: 2012-01-05 17:30:33+00:00
State: open

Every time client get presence update this method got called and without the code which I commented below, upon removing user, the removed ( unsubscribed user ) still available, with the code uncommented, it works, but I was wondering will there is an update which create new section for pending user ( instead of throw all in offline section ? ). Thanks in advance.

- (void)updateWithPresence:(XMPPPresence *)presence streamBareJidStr:(NSString *)streamBareJidStr
{
XMPPResourceCoreDataStorageObject *resource;
resource = (XMPPResourceCoreDataStorageObject *)[self resourceForJID:[presence from]];
if ([[presence type] isEqualToString:@"unavailable"]

// || [[presence type] isEqualToString:@"unsubscribed"]
// || [[presence type] isEqualToString:@"unsubscribe"]

|| [presence isErrorPresence])
{
if (resource)
{
[self removeResourcesObject:resource];
//[[self managedObjectContext] deleteObject:resource];
[[self managedObjectContext] processPendingChanges];
}
}
else
{
if(resource)
{
[resource updateWithPresence:presence];
}
else
{
XMPPResourceCoreDataStorageObject *newResource;
newResource = [XMPPResourceCoreDataStorageObject insertInManagedObjectContext:[self managedObjectContext]
withPresence:presence
streamBareJidStr:streamBareJidStr];
[self addResourcesObject:newResource];
}
}
[self recalculatePrimaryResource];
}

The old code which now in tags folder doesn't get affected by this matter because I made a work around exploiting didReceivedIQ but that is not the corrected way to implemented the function, error prone and unable to maintain in future.

And not to mentioned the code that Cecillia also known when I show her the google link which show Nicky fixes for the framework.

I would fix them all, but just to note what I must do here.