Changeset 3731

Show
Ignore:
Timestamp:
09/14/07 01:34:58 (8 months ago)
Author:
timothy
Message:

Fixes SILC not showing channel messages. #1064

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core/MVSILCChatConnection.h

    r3722 r3731  
    3030} 
    3131+ (NSArray *) defaultServerPorts; 
     32 
     33- (MVChatRoom *) joinedChatRoomWithChannel:(SilcChannelEntry) channel; 
    3234@end 
    3335 
  • trunk/Chat Core/MVSILCChatConnection.m

    r3722 r3731  
    8282        if( flags & SILC_MESSAGE_FLAG_ACTION ) action = YES; 
    8383 
    84         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     84        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    8585        MVChatUser *user = [self _chatUserWithClientEntry:sender]; 
    8686        NSString *mimeType = @"text/plain"; 
     
    259259                        if( joining_client == conn -> local_entry ) break; 
    260260 
    261                         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     261                        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    262262                        MVChatUser *member = [self _chatUserWithClientEntry:joining_client]; 
    263263 
     
    286286                        if( ! leaving_client || ! channel ) break; 
    287287 
    288                         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     288                        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    289289                        MVChatUser *member = [self _chatUserWithClientEntry:leaving_client]; 
    290290 
     
    305305                                authorUser = [self _chatUserWithClientEntry:(SilcClientEntry)setter_entry]; 
    306306 
    307                         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     307                        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    308308                        NSData *msgData = ( topic ? [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )] : nil ); 
    309309                        [room _setTopic:msgData]; 
     
    330330                                changerUser = [self _chatUserWithClientEntry:(SilcClientEntry)changer_entry]; 
    331331 
    332                         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     332                        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    333333                        MVChatUser *member = [self _chatUserWithClientEntry:target_client]; 
    334334 
     
    397397                        NSData *msgData = ( kick_message ? [[NSData allocWithZone:nil] initWithBytes:kick_message length:strlen( kick_message )] : nil ); 
    398398 
    399                         MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     399                        MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    400400                        MVChatUser *member = [self _chatUserWithClientEntry:kicked]; 
    401401                        MVChatUser *byMember = [self _chatUserWithClientEntry:kicker]; 
     
    629629                /* SilcUInt32 user_limit = */ va_arg( list, SilcUInt32 ); 
    630630 
    631                 MVSILCChatRoom *room = (MVSILCChatRoom *)[self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     631                MVSILCChatRoom *room = (MVSILCChatRoom *)[self joinedChatRoomWithChannel:channel]; 
    632632                if( ! room ) { 
    633633                        room = [[MVSILCChatRoom allocWithZone:nil] initWithChannelEntry:channel andConnection:self]; 
     
    673673        case SILC_COMMAND_LEAVE: { 
    674674                SilcChannelEntry channel = va_arg( list, SilcChannelEntry ); 
    675                 MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
     675                MVChatRoom *room = [self joinedChatRoomWithChannel:channel]; 
    676676                [room _setDateParted:[NSDate date]]; 
    677677                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomPartedNotification object:room userInfo:nil]; 
     
    12711271 
    12721272- (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; 
    12791293} 
    12801294