changed git call from https to git readonly
[atutor.git] / mods / atsocial_iphone_app / Classes / Contact.m
1 //
2 //  Contact.m
3 //  ATutor
4 //
5 //  Created by Quang Anh Do on 03/07/2010.
6 //  Copyright 2010 Quang Anh Do. All rights reserved.
7 //
8
9 #import "Contact.h"
10
11
12 @implementation Contact
13
14 @synthesize identifier;
15 @synthesize displayName;
16
17
18 /* dealloc */
19 - (void) dealloc {
20     [displayName release];
21         
22     [super dealloc];
23 }
24
25 + (Contact *)contactWithDictionary:(NSDictionary *)dictionary {
26         Contact *contact = [[self alloc] init]; 
27         contact.identifier = [[dictionary objectForKey:@"id"] intValue];
28         contact.displayName = [dictionary objectForKey:@"displayName"];
29         
30         return [contact autorelease];
31 }
32
33 #pragma mark -
34 #pragma mark Keyed Archiving
35
36 /*  Keyed Archiving */
37 //
38 - (void) encodeWithCoder: (NSCoder *)encoder {
39     [encoder encodeInt: [self identifier] forKey: @"identifier"];
40     [encoder encodeObject: [self displayName] forKey: @"displayName"];
41 }
42
43 - (id) initWithCoder: (NSCoder *)decoder {
44     self = [super init];
45     if (self) {
46         [self setIdentifier: [decoder decodeIntForKey: @"identifier"]];
47         [self setDisplayName: [decoder decodeObjectForKey: @"displayName"]];
48     }
49     return self;
50 }
51
52 @end