Changeset 3731
- Timestamp:
- 09/14/07 01:34:58 (8 months ago)
- Files:
-
- trunk/Chat Core/MVSILCChatConnection.h (modified) (1 diff)
- trunk/Chat Core/MVSILCChatConnection.m (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Chat Core/MVSILCChatConnection.h
r3722 r3731 30 30 } 31 31 + (NSArray *) defaultServerPorts; 32 33 - (MVChatRoom *) joinedChatRoomWithChannel:(SilcChannelEntry) channel; 32 34 @end 33 35 trunk/Chat Core/MVSILCChatConnection.m
r3722 r3731 82 82 if( flags & SILC_MESSAGE_FLAG_ACTION ) action = YES; 83 83 84 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];84 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 85 85 MVChatUser *user = [self _chatUserWithClientEntry:sender]; 86 86 NSString *mimeType = @"text/plain"; … … 259 259 if( joining_client == conn -> local_entry ) break; 260 260 261 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];261 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 262 262 MVChatUser *member = [self _chatUserWithClientEntry:joining_client]; 263 263 … … 286 286 if( ! leaving_client || ! channel ) break; 287 287 288 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];288 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 289 289 MVChatUser *member = [self _chatUserWithClientEntry:leaving_client]; 290 290 … … 305 305 authorUser = [self _chatUserWithClientEntry:(SilcClientEntry)setter_entry]; 306 306 307 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];307 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 308 308 NSData *msgData = ( topic ? [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )] : nil ); 309 309 [room _setTopic:msgData]; … … 330 330 changerUser = [self _chatUserWithClientEntry:(SilcClientEntry)changer_entry]; 331 331 332 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];332 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 333 333 MVChatUser *member = [self _chatUserWithClientEntry:target_client]; 334 334 … … 397 397 NSData *msgData = ( kick_message ? [[NSData allocWithZone:nil] initWithBytes:kick_message length:strlen( kick_message )] : nil ); 398 398 399 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];399 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 400 400 MVChatUser *member = [self _chatUserWithClientEntry:kicked]; 401 401 MVChatUser *byMember = [self _chatUserWithClientEntry:kicker]; … … 629 629 /* SilcUInt32 user_limit = */ va_arg( list, SilcUInt32 ); 630 630 631 MVSILCChatRoom *room = (MVSILCChatRoom *)[self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];631 MVSILCChatRoom *room = (MVSILCChatRoom *)[self joinedChatRoomWithChannel:channel]; 632 632 if( ! room ) { 633 633 room = [[MVSILCChatRoom allocWithZone:nil] initWithChannelEntry:channel andConnection:self]; … … 673 673 case SILC_COMMAND_LEAVE: { 674 674 SilcChannelEntry channel = va_arg( list, SilcChannelEntry ); 675 MVChatRoom *room = [self joinedChatRoomWith Name:[NSString stringWithUTF8String:channel -> channel_name]];675 MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 676 676 [room _setDateParted:[NSDate date]]; 677 677 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomPartedNotification object:room userInfo:nil]; … … 1271 1271 1272 1272 - (MVChatRoom *) joinedChatRoomWithUniqueIdentifier:(id) identifier { 1273 NSParameterAssert( [identifier isKindOfClass:[NSString class]] ); 1274 return [super joinedChatRoomWithUniqueIdentifier:[(NSString *)identifier lowercaseString]]; 1275 } 1276 1277 - (MVChatRoom *) joinedChatRoomWithName:(NSString *) name { 1278 return [super joinedChatRoomWithUniqueIdentifier:[name lowercaseString]]; 1273 NSParameterAssert( [identifier isKindOfClass:[NSData class]] ); 1274 return [super joinedChatRoomWithUniqueIdentifier:identifier]; 1275 } 1276 1277 - (MVChatRoom *) joinedChatRoomWithChannel:(SilcChannelEntry) channel { 1278 if( ! channel ) return nil; 1279 1280 MVChatRoom *room = nil; 1281 unsigned char *identifier = silc_id_id2str( channel -> id, SILC_ID_CHANNEL ); 1282 if( identifier ) { 1283 unsigned length = silc_id_get_len( channel -> id, SILC_ID_CHANNEL ); 1284 NSData *uniqueIdentifier = [[NSData allocWithZone:nil] initWithBytes:identifier length:length]; 1285 room = [self joinedChatRoomWithUniqueIdentifier:uniqueIdentifier]; 1286 [uniqueIdentifier release]; 1287 } 1288 1289 if( ! room && channel -> channel_name ) 1290 room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 1291 1292 return room; 1279 1293 } 1280 1294
