StropheCappuccino API 1.0.0
/tmp/tempDoc.doc/TNStropheContact.j
Go to the documentation of this file.
00001 /*
00002  * TNStropheContact.j
00003  *
00004  * Copyright (C) 2010  Antoine Mercadal <antoine.mercadal@inframonde.eu>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 3.0 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 
00022 
00023 TNStropheContactStatusAway                          = @"away";
00024 TNStropheContactStatusBusy                          = @"xa";
00025 TNStropheContactStatusDND                           = @"dnd";
00026 TNStropheContactStatusOffline                       = @"offline";
00027 TNStropheContactStatusOnline                        = @"online";
00028 
00029 TNStropheContactGroupUpdatedNotification            = @"TNStropheContactGroupUpdatedNotification";
00030 TNStropheContactMessageActiveNotification           = @"TNStropheContactMessageActiveNotification";
00031 TNStropheContactMessageComposingNotification        = @"TNStropheContactMessageComposingNotification";
00032 TNStropheContactMessageGoneNotification             = @"TNStropheContactMessageGoneNotification";
00033 TNStropheContactMessageInactiveNotification         = @"TNStropheContactMessageInactiveNotification";
00034 TNStropheContactMessagePausedNotification           = @"TNStropheContactMessagePausedNotification";
00035 TNStropheContactMessageReceivedNotification         = @"TNStropheContactMessageReceivedNotification";
00036 TNStropheContactMessageSentNotification             = @"TNStropheContactMessageSentNotification";
00037 TNStropheContactMessageTreatedNotification          = @"TNStropheContactMessageTreatedNotification";
00038 TNStropheContactNicknameUpdatedNotification         = @"TNStropheContactNicknameUpdatedNotification";
00039 TNStropheContactPresenceUpdatedNotification         = @"TNStropheContactPresenceUpdatedNotification";
00040 TNStropheContactStanzaSentNotification              = @"TNStropheContactStanzaSentNotification"
00041 TNStropheContactSubscriptionUpdatedNotification     = @"TNStropheContactSubscriptionUpdatedNotification";
00042 TNStropheContactVCardReceivedNotification           = @"TNStropheContactVCardReceivedNotification";
00043 
00044 var TNStropheContactDelegate_avatarForContact_          = 1 << 0;
00045 
00046 TNStropheContactImageOffline = nil;
00047 TNStropheContactImageOnline = nil;
00048 TNStropheContactImageBusy = nil;
00049 TNStropheContactImageAway = nil;
00050 TNStropheContactImageDND = nil;
00051 TNStropheContactImageNewMessage = nil;
00052 TNStropheContactImageNewError = nil;
00053 
00054 
00058 @implementation TNStropheContact: CPObject
00059 {
00060     CPArray             _groups;
00061     CPArray             _messagesQueue;
00062     CPArray             _resources;
00063     CPImage             _avatar;
00064     CPImage             _statusIcon;
00065     CPNumber            _numberOfEvents;
00066     CPString            _nickname;
00067     CPString            _nodeName;
00068     CPString            _subscription;
00069     CPString            _type;
00070     CPString            _XMPPShow;
00071     CPString            _XMPPStatus;
00072     id                  _delegate;
00073     TNStropheConnection _connection;
00074     TNStropheJID        _JID;
00075     TNStropheVCard      _vCard;
00076 
00077     BOOL                _askingVCard;
00078     BOOL                _isComposing;
00079     CPImage             _statusReminder;
00080     int                 _implementedDelegateMethods;
00081 }
00082 
00083 
00084 #pragma mark -
00085 #pragma mark Class methods
00086 
00094 + (TNStropheContact)contactWithConnection:(TNStropheConnection)aConnection JID:(TNStropheJID)aJID group:(TNStropheGroup)aGroup
00095 {
00096     return [[TNStropheContact alloc] initWithConnection:aConnection JID:aJID group:aGroup];
00097 }
00098 
00099 
00100 #pragma mark -
00101 #pragma mark Initialization
00102 
00105 + (void)initialize
00106 {
00107     var bundle = [CPBundle bundleForClass:TNStropheContact];
00108 
00109     TNStropheContactImageOffline       = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"gray.png"] size:CGSizeMake(8.0, 8.0)];
00110     TNStropheContactImageOnline        = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"green.png"] size:CGSizeMake(8.0, 8.0)];
00111     TNStropheContactImageBusy          = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"red.png"] size:CGSizeMake(8.0, 8.0)];
00112     TNStropheContactImageAway          = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"orange.png"] size:CGSizeMake(8.0, 8.0)];
00113     TNStropheContactImageDND           = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"black.png"] size:CGSizeMake(8.0, 8.0)];
00114     TNStropheContactImageNewMessage    = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"blue.png"] size:CGSizeMake(8.0, 8.0)];
00115     TNStropheContactImageNewError      = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"error.png"] size:CGSizeMake(8.0, 8.0)];
00116 }
00117 
00118 
00123 - (id)initWithConnection:(TNStropheConnection)aConnection JID:(TNStropheJID)aJID group:(TNStropheGroup)aGroup
00124 {
00125     if (self = [super init])
00126     {
00127         _type               = @"contact";
00128         _connection         = aConnection;
00129         _messagesQueue      = [CPArray array];
00130         _numberOfEvents     = 0;
00131         _isComposing        = NO;
00132         _askingVCard        = NO;
00133         _resources          = [CPArray array];
00134         _groups             = [CPArray array];
00135 
00136         [self setNickname:[_JID bare]];
00137         [self setJID:aJID];
00138         [self setXMPPStatus:@"Offline"];
00139         [self setXMPPShow:TNStropheContactStatusOffline];
00140         [self setStatusIcon:TNStropheContactImageOffline];
00141 
00142         if (aGroup)
00143             [_groups addObject:aGroup];
00144     }
00145 
00146     return self;
00147 }
00148 
00149 
00150 #pragma mark -
00151 #pragma mark Setters and Getters
00152 
00164 - (void)setDelegate:(id)aDelegate
00165 {
00166     if (aDelegate == _delegate)
00167         return;
00168 
00169     _delegate = aDelegate;
00170     _implementedDelegateMethods = 0;
00171 
00172     if ([_delegate respondsToSelector:@selector(avatarForContact:)])
00173         _implementedDelegateMethods |= TNStropheContactDelegate_avatarForContact_;
00174 }
00175 
00176 - (CPString)name
00177 {
00178     return [_vCard fullName] || _nickname;
00179 }
00180 
00181 
00182 #pragma mark -
00183 #pragma mark Status
00184 
00190 - (BOOL)_didReceivePresence:(TNStropheStanza)aStanza
00191 {
00192     var resource        = [aStanza fromResource],
00193         presenceStatus  = [aStanza firstChildWithName:@"status"];
00194 
00195     if (resource && (typeof(resource) != "undefined") && resource != @"")
00196     {
00197         if (![_resources containsObject:resource])
00198             [_resources addObject:resource];
00199         [_JID setResource:resource];
00200     }
00201 
00202     switch ([aStanza type])
00203     {
00204         case @"error":
00205             var errorCode   = [[aStanza firstChildWithName:@"error"] valueForAttribute:@"code"];
00206             [self setXMPPShow:TNStropheContactStatusOffline];
00207             [self setXMPPStatus:@"Error code: " + errorCode];
00208             [self setStatusIcon:TNStropheContactImageNewError];
00209 
00210             _statusReminder = TNStropheContactImageNewError;
00211             return NO;
00212         case @"unavailable":
00213             [_resources removeObject:resource];
00214             CPLogConsole(@"contact become unavailable from resource: " + resource + @". Resources left : " + _resources + "("+ [_resources count] + ")");
00215 
00216             if ([_resources count] == 0)
00217             {
00218                 [self setXMPPShow:TNStropheContactStatusOffline];
00219                 [self setStatusIcon:TNStropheContactImageOffline];
00220 
00221                 _statusReminder = TNStropheContactImageOffline;
00222 
00223                 if (presenceStatus)
00224                     [self setXMPPStatus:[presenceStatus text]];
00225                 else
00226                     [self setXMPPStatus:@"Offline"];
00227             }
00228             else
00229                 [_JID setResource:[_resources lastObject]];
00230             break;
00231         case @"subscribe":
00232             [self setXMPPStatus:@"Asking subscribtion"];
00233             [self setSubscription:[aStanza type]];
00234             break;
00235         case @"subscribed":
00236             [self setSubscription:[aStanza type]];
00237             break;
00238         case @"unsubscribe":
00239             [self setSubscription:[aStanza type]];
00240             break;
00241         case @"unsubscribed":
00242             [self setSubscription:[aStanza type]];
00243             [self setXMPPStatus:@"Unauthorized"];
00244             break;
00245         default:
00246 
00247             [self setXMPPShow:TNStropheContactStatusOnline];
00248             [self setStatusIcon:TNStropheContactImageOnline];
00249             [self setSubscription:@"subscribed"];
00250 
00251             _statusReminder = TNStropheContactImageOnline;
00252 
00253             if ([aStanza firstChildWithName:@"show"])
00254             {
00255                 [self setXMPPShow:[[aStanza firstChildWithName:@"show"] text]];
00256                 switch (_XMPPShow)
00257                 {
00258                     case TNStropheContactStatusBusy:
00259                         [self setStatusIcon:TNStropheContactImageBusy];
00260                         _statusReminder = TNStropheContactImageBusy;
00261                         break;
00262                     case TNStropheContactStatusAway:
00263                         [self setStatusIcon:TNStropheContactImageAway];
00264                         _statusReminder = TNStropheContactImageAway;
00265                         break;
00266                     case TNStropheContactStatusDND:
00267                         [self setStatusIcon:TNStropheContactImageDND];
00268                         _statusReminder = TNStropheContactImageDND;
00269                         break;
00270                 }
00271             }
00272 
00273             if (_numberOfEvents > 0)
00274                 [self setStatusIcon:TNStropheContactImageNewMessage];
00275 
00276             if (presenceStatus)
00277                 [self setXMPPStatus:[presenceStatus text]];
00278             else
00279                 [self setXMPPStatus:@"Online"];
00280 
00281             if ([aStanza firstChildWithName:@"x"]
00282                 && [[aStanza firstChildWithName:@"x"] valueForAttribute:@"xmlns"] == @"vcard-temp:x:update"
00283                 && ![aStanza firstChildWithName:@"delay"])
00284             {
00285                 [self getVCard];
00286             }
00287 
00288             break;
00289     }
00290 
00291     if (!([aStanza firstChildWithName:@"x"] && [[aStanza firstChildWithName:@"x"] valueForAttribute:@"xmlns"] == @"vcard-temp:x:update"))
00292         [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactPresenceUpdatedNotification object:self];
00293 
00294     return YES;
00295 }
00296 
00297 - (void)sendStatus:(CPString)aStatus
00298 {
00299     var statusStanza = [TNStropheStanza messageTo:_JID withAttributes:{"type": "chat"}];
00300 
00301     [statusStanza addChildWithName:aStatus andAttributes:{"xmlns": "http://jabber.org/protocol/chatstates"}];
00302 
00303     [self sendStanza:statusStanza andRegisterSelector:@selector(_didSendStatus:) ofObject:self];
00304 }
00305 
00308 - (void)_didSendStatus:(TNStropheStanza)aStanza
00309 {
00310     if ([aStanza type] == @"error")
00311         CPLog.error(@"Unable to send status. Resp is: " + aStanza);
00312 }
00313 
00317 - (void)sendComposing
00318 {
00319     if (_isComposing)
00320         return;
00321 
00322     [self sendStatus:@"composing"];
00323     _isComposing = YES;
00324 }
00325 
00328 - (void)sendComposePaused
00329 {
00330     [self sendStatus:@"paused"];
00331 
00332     _isComposing = NO;
00333 }
00334 
00335 
00336 #pragma mark -
00337 #pragma mark Subscription
00338 
00341 - (void)subscribe
00342 {
00343     [_connection send:[TNStropheStanza presenceTo:_JID withAttributes:{@"type": @"subscribed"} bare:YES]];
00344 }
00345 
00348 - (void)unsubscribe
00349 {
00350     [_connection send:[TNStropheStanza presenceTo:_JID withAttributes:{@"type": @"unsubscribed"} bare:YES]];
00351 }
00352 
00355 - (void)askSubscription
00356 {
00357     [_connection send:[TNStropheStanza presenceTo:_JID withAttributes:{@"type": @"subscribe"} bare:YES]];
00358 }
00359 
00360 - (void)setSubscription:(CPString)aSubscription
00361 {
00362     [self willChangeValueForKey:@"subscription"];
00363     _subscription = aSubscription;
00364     [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactSubscriptionUpdatedNotification object:self];
00365     [self didChangeValueForKey:@"subscription"];
00366 }
00367 
00368 
00369 #pragma mark -
00370 #pragma mark MetaData
00371 
00372 - (CPString)description
00373 {
00374     return _nickname;
00375 }
00376 
00380 - (void)getVCard
00381 {
00382     var uid         = [_connection getUniqueId],
00383         vcardStanza = [TNStropheStanza iqTo:_JID withAttributes:{@"type": @"get", @"id": uid} bare:YES],
00384         params      = [CPDictionary dictionaryWithObjectsAndKeys: uid, @"id"];
00385 
00386     [vcardStanza addChildWithName:@"vCard" andAttributes:{@"xmlns": @"vcard-temp"}];
00387 
00388     _askingVCard = YES;
00389 
00390     [_connection registerSelector:@selector(_didReceiveVCard:) ofObject:self withDict:params];
00391     [_connection send:vcardStanza];
00392 }
00393 
00400 - (BOOL)_didReceiveVCard:(TNStropheStanza)aStanza
00401 {
00402     var aVCard = [aStanza firstChildWithName:@"vCard"];
00403 
00404     _askingVCard = NO;
00405     _avatar = nil;
00406 
00407     if (aVCard)
00408     {
00409         var VCARD = [[TNStropheVCard alloc] initWithXMLNode:aVCard];
00410 
00411         if (!_nickname || (_nickname == [_JID bare]) || (_nickname == [_JID node]))
00412             [self setNickname:[VCARD fullName] || [_JID node]]
00413 
00414         if ([VCARD photo])
00415             [self setAvatar:[VCARD photo]];
00416         else if (_implementedDelegateMethods & TNStropheContactDelegate_avatarForContact_)
00417             [self setAvatar:[_delegate avatarForContact:self]];
00418 
00419         [self willChangeValueForKey:@"name"];
00420         [self setVCard:VCARD];
00421         [self didChangeValueForKey:@"name"];
00422         [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactVCardReceivedNotification object:self];
00423     }
00424 
00425     return NO;
00426 }
00427 
00428 
00429 #pragma mark -
00430 #pragma mark Communicating
00431 
00432 - (void)sendStanza:(TNStropheStanza)aStanza
00433 {
00434     [self sendStanza:aStanza withUserInfo:nil];
00435 }
00436 
00437 - (void)sendStanza:(TNStropheStanza)aStanza withUserInfo:(CPDictionary)userInfo
00438 {
00439     [aStanza setTo:_JID];
00440     [_connection send:aStanza];
00441 
00442     [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactStanzaSentNotification object:self userInfo:userInfo];
00443 }
00444 
00458 - (id)sendStanza:(TNStropheStanza)aStanza andRegisterSelector:(SEL)aSelector ofObject:(id)anObject withSpecificID:(id)anId userInfo:(id)someUserInfo handlerDelegate:(id)aDelegate
00459 {
00460     var params      = [CPDictionary dictionaryWithObjectsAndKeys:anId, @"id"],
00461         userInfo    = [CPDictionary dictionaryWithObjectsAndKeys:aStanza, @"stanza", anId, @"id"],
00462         ret;
00463 
00464     [aStanza setID:anId];
00465 
00466     if (aSelector && someUserInfo && aDelegate)
00467         ret = [_connection registerSelector:aSelector ofObject:anObject withDict:params userInfo:someUserInfo handlerDelegate:aDelegate];
00468     else if (aSelector && !someUserInfo && aDelegate)
00469         ret = [_connection registerSelector:aSelector ofObject:anObject withDict:params handlerDelegate:aDelegate];
00470     else if (aSelector && someUserInfo && !aDelegate)
00471         ret = [_connection registerSelector:aSelector ofObject:anObject withDict:params userInfo:someUserInfo];
00472     else if (aSelector && !someUserInfo && !aDelegate)
00473         ret = [_connection registerSelector:aSelector ofObject:anObject withDict:params];
00474 
00475     [self sendStanza:aStanza withUserInfo:userInfo];
00476 
00477     return ret;
00478 }
00479 
00480 
00489 - (id)sendStanza:(TNStropheStanza)aStanza andRegisterSelector:(SEL)aSelector ofObject:(id)anObject
00490 {
00491     return [self sendStanza:aStanza andRegisterSelector:aSelector ofObject:anObject withSpecificID:[_connection getUniqueId] userInfo:nil handlerDelegate:nil];
00492 }
00493 
00503 - (id)sendStanza:(TNStropheStanza)aStanza andRegisterSelector:(SEL)aSelector ofObject:(id)anObject withSpecificID:(int)anId
00504 {
00505     return [self sendStanza:aStanza andRegisterSelector:aSelector ofObject:anObject withSpecificID:anId userInfo:nil handlerDelegate:nil];
00506 }
00507 
00515 - (id)sendStanza:(TNStropheStanza)aStanza andRegisterSelector:(SEL)aSelector ofObject:(id)anObject userInfo:(id)someUserInfo
00516 {
00517     return [self sendStanza:aStanza andRegisterSelector:aSelector ofObject:anObject withSpecificID:[_connection getUniqueId] userInfo:someUserInfo handlerDelegate:nil];
00518 }
00519 
00528 - (id)sendStanza:(TNStropheStanza)aStanza andRegisterSelector:(SEL)aSelector ofObject:(id)anObject handlerDelegate:(id)aDelegate
00529 {
00530     return [self sendStanza:aStanza andRegisterSelector:aSelector ofObject:anObject withSpecificID:[_connection getUniqueId] userInfo:nil handlerDelegate:aDelegate];
00531 }
00532 
00536 - (void)getMessages
00537 {
00538     var params = [CPDictionary dictionaryWithObjectsAndKeys:@"message", @"name",
00539                                                             [_JID bare], @"from",
00540                                                             {matchBare: true}, @"options"];
00541 
00542     [_connection registerSelector:@selector(_didReceiveMessage:) ofObject:self withDict:params];
00543 }
00544 
00550 - (BOOL)_didReceiveMessage:(id)aStanza
00551 {
00552     var center      = [CPNotificationCenter defaultCenter],
00553         userInfo    = [CPDictionary dictionaryWithObjectsAndKeys:aStanza, @"stanza", [CPDate date], @"date"];
00554 
00555     if ([aStanza containsChildrenWithName:@"composing"])
00556         [center postNotificationName:TNStropheContactMessageComposingNotification object:self userInfo:userInfo];
00557 
00558     if ([aStanza containsChildrenWithName:@"paused"])
00559         [center postNotificationName:TNStropheContactMessagePausedNotification object:self userInfo:userInfo];
00560 
00561     if ([aStanza containsChildrenWithName:@"active"])
00562         [center postNotificationName:TNStropheContactMessageActiveNotification object:self userInfo:userInfo];
00563 
00564     if ([aStanza containsChildrenWithName:@"inactive"])
00565         [center postNotificationName:TNStropheContactMessageInactiveNotification object:self userInfo:userInfo];
00566 
00567     if ([aStanza containsChildrenWithName:@"gone"])
00568         [center postNotificationName:TNStropheContactMessageGoneNotification object:self userInfo:userInfo];
00569 
00570     if ([aStanza containsChildrenWithName:@"body"])
00571     {
00572         _statusIcon = TNStropheContactImageNewMessage;
00573         [_messagesQueue addObject:aStanza];
00574 
00575         _numberOfEvents++;
00576         [center postNotificationName:TNStropheContactMessageReceivedNotification object:self userInfo:userInfo];
00577     }
00578 
00579     return YES;
00580 }
00581 
00585 - (void)sendMessage:(CPString)aMessage
00586 {
00587     [self sendMessage:aMessage withType:@"chat"];
00588 }
00589 
00594 - (void)sendMessage:(CPString)aMessage withType:(CPString)aType
00595 {
00596     var messageStanza = [TNStropheStanza messageWithAttributes:{@"type":aType}];
00597 
00598     [messageStanza addChildWithName:@"body"];
00599     [messageStanza addTextNode:aMessage];
00600 
00601     [self sendStanza:messageStanza andRegisterSelector:@selector(_didSendMessage:) ofObject:self];
00602 }
00603 
00606 - (void)_didSendMessage:(TNStropheStanza)aStanza
00607 {
00608     if ([aStanza type] == @"error")
00609         CPLog.error(@"Unable to send message. Resp is: " + aStanza);
00610 }
00611 
00617 - (TNStropheStanza)popMessagesQueue
00618 {
00619     if ([_messagesQueue count] == 0)
00620         return;
00621 
00622     var message = [_messagesQueue objectAtIndex:0];
00623 
00624     _numberOfEvents--;
00625     if (_numberOfEvents === 0)
00626         _statusIcon = _statusReminder;
00627 
00628     [_messagesQueue removeObjectAtIndex:0];
00629 
00630     [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactMessageTreatedNotification object:self];
00631 
00632     return message;
00633 }
00634 
00637 - (void)freeMessagesQueue
00638 {
00639     _numberOfEvents = 0;
00640     [self setStatusIcon:_statusReminder];
00641 
00642     [_messagesQueue removeAllObjects];
00643 
00644     [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactMessageTreatedNotification object:self];
00645 }
00646 
00647 
00648 #pragma mark -
00649 #pragma mark Delegates
00650 
00654 - (void)imageDidLoad:(CPImage)anImage
00655 {
00656     [anImage setDelegate:nil];
00657     [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactVCardReceivedNotification object:self];
00658 }
00659 
00660 @end
00661 
00662 @implementation TNStropheContact (CPCoding)
00663 
00664 - (id)initWithCoder:(CPCoder)aCoder
00665 {
00666     if (self = [super init])
00667     {
00668         _JID            = [aCoder decodeObjectForKey:@"_JID"];
00669         _nodeName       = [aCoder decodeObjectForKey:@"_nodeName"];
00670         _groups         = [aCoder decodeObjectForKey:@"_groups"];
00671         _nickname       = [aCoder decodeObjectForKey:@"_nickname"];
00672         _XMPPStatus     = [aCoder decodeObjectForKey:@"_XMPPStatus"];
00673         _resources      = [aCoder decodeObjectForKey:@"_resources"];
00674         _XMPPShow       = [aCoder decodeObjectForKey:@"_XMPPShow"];
00675         _statusIcon     = [aCoder decodeObjectForKey:@"_statusIcon"];
00676         _type           = [aCoder decodeObjectForKey:@"_type"];
00677         _vCard          = [aCoder decodeObjectForKey:@"_vCard"];
00678         _numberOfEvents = [aCoder decodeObjectForKey:@"_numberOfEvents"];
00679     }
00680 
00681     return self;
00682 }
00683 
00684 - (void)encodeWithCoder:(CPCoder)aCoder
00685 {
00686     [aCoder encodeObject:_JID forKey:@"_JID"];
00687     [aCoder encodeObject:_nodeName forKey:@"_nodeName"];
00688     [aCoder encodeObject:_groups forKey:@"_groups"];
00689     [aCoder encodeObject:_nickname forKey:@"_nickname"];
00690     [aCoder encodeObject:_XMPPStatus forKey:@"_XMPPStatus"];
00691     [aCoder encodeObject:_XMPPShow forKey:@"_XMPPShow"];
00692     [aCoder encodeObject:_type forKey:@"_type"];
00693     [aCoder encodeObject:_statusIcon forKey:@"_statusIcon"];
00694     [aCoder encodeObject:_messagesQueue forKey:@"_messagesQueue"];
00695     [aCoder encodeObject:_numberOfEvents forKey:@"_numberOfEvents"];
00696 
00697     if (_resources)
00698         [aCoder encodeObject:_resources forKey:@"_resources"];
00699 
00700     if (_vCard)
00701         [aCoder encodeObject:_vCard forKey:@"_vCard"];
00702 }
00703 
00704 @end
00705 
00706 @implementation TNStropheContact (CPSynthesizedAccessors)
00707 
00711 - (CPArray)groups
00712 {
00713     return _groups;
00714 }
00715 
00719 - (void)setGroups:(CPArray)aValue
00720 {
00721     _groups = aValue;
00722 }
00723 
00727 - (CPArray)messagesQueue
00728 {
00729     return _messagesQueue;
00730 }
00731 
00735 - (void)setMessagesQueue:(CPArray)aValue
00736 {
00737     _messagesQueue = aValue;
00738 }
00739 
00743 - (CPArray)resources
00744 {
00745     return _resources;
00746 }
00747 
00751 - (void)setResources:(CPArray)aValue
00752 {
00753     _resources = aValue;
00754 }
00755 
00759 - (CPImage)avatar
00760 {
00761     return _avatar;
00762 }
00763 
00767 - (void)setAvatar:(CPImage)aValue
00768 {
00769     _avatar = aValue;
00770 }
00771 
00775 - (CPImage)statusIcon
00776 {
00777     return _statusIcon;
00778 }
00779 
00783 - (void)setStatusIcon:(CPImage)aValue
00784 {
00785     _statusIcon = aValue;
00786 }
00787 
00791 - (CPNumber)numberOfEvents
00792 {
00793     return _numberOfEvents;
00794 }
00795 
00799 - (void)setNumberOfEvents:(CPNumber)aValue
00800 {
00801     _numberOfEvents = aValue;
00802 }
00803 
00807 - (CPString)nickname
00808 {
00809     return _nickname;
00810 }
00811 
00815 - (void)setNickname:(CPString)aValue
00816 {
00817     _nickname = aValue;
00818 }
00819 
00823 - (CPString)nodeName
00824 {
00825     return _nodeName;
00826 }
00827 
00831 - (void)setNodeName:(CPString)aValue
00832 {
00833     _nodeName = aValue;
00834 }
00835 
00839 - (CPString)subscription
00840 {
00841     return _subscription;
00842 }
00843 
00847 - (void)setSubscription:(CPString)aValue
00848 {
00849     _subscription = aValue;
00850 }
00851 
00855 - (CPString)type
00856 {
00857     return _type;
00858 }
00859 
00863 - (void)setType:(CPString)aValue
00864 {
00865     _type = aValue;
00866 }
00867 
00871 - (CPString)XMPPShow
00872 {
00873     return _XMPPShow;
00874 }
00875 
00879 - (void)setXMPPShow:(CPString)aValue
00880 {
00881     _XMPPShow = aValue;
00882 }
00883 
00887 - (CPString)XMPPStatus
00888 {
00889     return _XMPPStatus;
00890 }
00891 
00895 - (void)setXMPPStatus:(CPString)aValue
00896 {
00897     _XMPPStatus = aValue;
00898 }
00899 
00903 - (id)delegate
00904 {
00905     return _delegate;
00906 }
00907 
00911 - (TNStropheConnection)connection
00912 {
00913     return _connection;
00914 }
00915 
00919 - (void)setConnection:(TNStropheConnection)aValue
00920 {
00921     _connection = aValue;
00922 }
00923 
00927 - (TNStropheJID)JID
00928 {
00929     return _JID;
00930 }
00931 
00935 - (void)setJID:(TNStropheJID)aValue
00936 {
00937     _JID = aValue;
00938 }
00939 
00943 - (TNStropheVCard)vCard
00944 {
00945     return _vCard;
00946 }
00947 
00951 - (void)setVCard:(TNStropheVCard)aValue
00952 {
00953     _vCard = aValue;
00954 }
00955 
00956 @end
 All Classes Namespaces Files Functions Variables