Skip to content

Instantly share code, notes, and snippets.

@benlangfeld
Created October 28, 2010 11:56
Show Gist options
  • Save benlangfeld/651194 to your computer and use it in GitHub Desktop.
Save benlangfeld/651194 to your computer and use it in GitHub Desktop.
- (BOOL)_didReceiveVCard:(TNStropheStanza)aStanza
{
var aVCard = [aStanza firstChildWithName:@"vCard"];
if (aVCard)
{
_vCard = aVCard;
if ((_nickname == _nodeName) && ([aVCard firstChildWithName:@"NAME"]))
_nickname = [[aVCard firstChildWithName:@"NAME"] text];
var photoNode;
if (photoNode = [aVCard firstChildWithName:@"PHOTO"])
{
var contentType = [[photoNode firstChildWithName:@"TYPE"] text],
data = [[photoNode firstChildWithName:@"BINVAL"] text];
_avatar = [TNBase64Image base64ImageWithContentType:contentType andData:data];
[CPTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(_fireVCardReceivedNotification) userInfo:nil repeats:NO];
}
else
[self _fireVCardReceivedNotification];
}
return YES;
}
- (BOOL)_fireVCardReceivedNotification
{
[[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactVCardReceivedNotification object:self];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment