Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ignore roster pushes if roster has not been retrieved yet

  • Loading branch information...
commit bd68bb35535660d8b52f23cc698de3d516948a61 1 parent c25d6e9
@primalmotion primalmotion authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 TNStropheRoster.j
View
11 TNStropheRoster.j
@@ -44,6 +44,8 @@ TNStropheRosterSubGroupDelimiterReceivedNotification = @"TNStropheRosterSubGr
@implementation TNStropheRoster : TNStropheRosterBase
{
CPDictionary _pendingPresence @accessors(getter=pendingPresence);
+
+ BOOL _rosterRetrieved;
}
@@ -87,6 +89,7 @@ TNStropheRosterSubGroupDelimiterReceivedNotification = @"TNStropheRosterSubGr
[_groupCache removeAllObjects];
[_pendingPresence removeAllObjects];
+ _rosterRetrieved = NO;
[super clear];
}
@@ -194,9 +197,12 @@ TNStropheRosterSubGroupDelimiterReceivedNotification = @"TNStropheRosterSubGr
if (!subscription || ![allowedSubs containsObject:subscription])
[item setValue:@"none" forAttribute:@"subscription"];
- [self _addContactFromRosterItem:item];
+ if (![self containsJID:[TNStropheJID stropheJIDWithString:[item valueForAttribute:@"jid"]]])
+ [self _addContactFromRosterItem:item];
}
+ _rosterRetrieved = YES;
+
[[CPNotificationCenter defaultCenter] postNotificationName:TNStropheRosterRetrievedNotification object:self];
return NO;
@@ -282,6 +288,9 @@ TNStropheRosterSubGroupDelimiterReceivedNotification = @"TNStropheRosterSubGr
*/
- (BOOL)_didReceiveRosterPush:(TNStropheStanzas)aStanza
{
+ if (!_rosterRetrieved)
+ return;
+
var item = [aStanza firstChildWithName:@"item"],
theJID = [TNStropheJID stropheJIDWithString:[item valueForAttribute:@"jid"]],
subscription = [item valueForAttribute:@"subscription"],

0 comments on commit bd68bb3

Please sign in to comment.
Something went wrong with that request. Please try again.