Changeset 3592

Show
Ignore:
Timestamp:
03/01/07 11:03:48 (2 years ago)
Author:
jmmv
Message:

Handle the error message that tells the user that his nickname is not in the
server's database. At the moment, just ignore it.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core/MVICBChatConnection.m

    r3591 r3592  
    5050#import "NSNotificationAdditions.h" 
    5151 
     52#pragma mark Prototypes for auxiliary functions 
     53 
     54static BOOL hasSubstring( NSString *str, NSString *substr, NSRange *r ); 
     55 
     56#pragma mark Bodies for auxiliary functions 
     57 
     58/* 
     59 * Takes a string and a substring within it and returns a boolean 
     60 * indicating whether the latter was found inside the former. 
     61 * If found, the given range is updated accordingly. 
     62 * 
     63 * The whole point of this function is to ease the usage of NSString's 
     64 * rangeOfString in conditions. 
     65 */ 
     66static BOOL hasSubstring( NSString *str, NSString *substr, NSRange *r ) { 
     67        *r = [str rangeOfString:substr]; 
     68        return r->location != NSNotFound; 
     69} 
     70 
     71#pragma mark - 
     72 
    5273@interface MVICBChatConnection (MVICBChatConnectionPrivate) 
    5374- (void) _connect; 
     
    823844 
    824845        NSString *message = [fields objectAtIndex:0]; 
     846        NSRange r; 
    825847 
    826848        if( [message compare:@"Open messages not permitted in quiet groups."] == 0 ) { 
     
    846868                } 
    847869        } else if( [message compare:@"You aren't the moderator."] == 0 ) { 
     870                // XXX 
     871        } else if( hasSubstring( message, @" is not in the database.", &r ) ) { 
    848872                // XXX 
    849873        } else