Changeset 3578

Show
Ignore:
Timestamp:
02/04/07 19:53:29 (2 years ago)
Author:
timothy
Message:

Revert code that was comited and not finished. #991

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plug-Ins/Standard Commands/JVStandardCommands.m

    r3574 r3578  
    260260        } 
    261261 
    262         if( ! [command caseInsensitiveCompare:@"msg"] || ! [command caseInsensitiveCompare:@"omsg"] || ! [command caseInsensitiveCompare:@"query"] ) { 
     262        if( ! [command caseInsensitiveCompare:@"msg"] || ! [command caseInsensitiveCompare:@"query"] ) { 
    263263                return [self handleMessageCommand:command withMessage:arguments forConnection:connection alwaysShow:( isChatRoom || isDirectChat )]; 
    264264        } else if( ! [command caseInsensitiveCompare:@"amsg"] || ! [command caseInsensitiveCompare:@"ame"] || ! [command caseInsensitiveCompare:@"broadcast"] || ! [command caseInsensitiveCompare:@"bract"] ) { 
     
    354354                return YES; 
    355355        } else if( ( ! [command caseInsensitiveCompare:@"notice"] || ! [command caseInsensitiveCompare:@"onotice"] ) && [connection type] == MVChatConnectionIRCType ) { 
     356        NSString *targetPrefix = nil; 
     357        NSString *target = nil; 
     358        NSString *message = nil; 
    356359        NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 
    357360        NSMutableCharacterSet *prefixes = [[connection chatRoomNamePrefixes] mutableCopy]; 
    358361                [prefixes addCharactersInString:@"@"]; 
    359362 
    360         NSString *target = nil; 
    361         NSString *targetPrefix = nil; 
    362363                NSScanner *scanner = [NSScanner scannerWithString:[arguments string]]; 
    363364                if( [scanner scanCharactersFromSet:prefixes intoString:&targetPrefix] || ! isChatRoom ) { 
     
    369370                        else [scanner scanUpToCharactersFromSet:whitespace intoString:&target]; 
    370371                } 
    371  
    372372                [prefixes release]; 
    373373 
    374374                [scanner scanCharactersFromSet:whitespace intoString:NULL]; 
    375  
    376         NSAttributedString *message = nil; 
    377                 if( [arguments length] >= [scanner scanLocation] ) { 
    378                         [scanner setScanLocation:[scanner scanLocation]]; 
    379                         message = [arguments attributedSubstringFromRange:NSMakeRange( [scanner scanLocation], [arguments length] - [scanner scanLocation] )]; 
    380                 } 
     375                [scanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\n"] intoString:&message]; 
    381376 
    382377                if( ! [target length] || ! [message length] ) return YES; 
     
    385380                        target = [@"@" stringByAppendingString:[connection properNameForChatRoomNamed:target]]; 
    386381 
    387                 NSString *prefix = [[NSString allocWithZone:nil] initWithFormat:@"NOTICE %@ :", target]; 
    388                 [connection sendRawMessageWithComponents:prefix, message, nil]; 
    389                 [prefix release]; 
     382                [connection sendRawMessage:[NSString stringWithFormat:@"NOTICE %@ :%@", target, message]]; 
    390383 
    391384                NSCharacterSet *chanSet = [connection chatRoomNamePrefixes]; 
     
    541534 
    542535        [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&to]; 
    543         [scanner scanCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:NULL]; 
    544536 
    545537        if( ! [to length] ) return NO; 
    546538 
    547         if( [message length] >= [scanner scanLocation] ) { 
    548                 [scanner setScanLocation:[scanner scanLocation]]; 
     539        if( [message length] >= [scanner scanLocation] + 1 ) { 
     540                [scanner setScanLocation:[scanner scanLocation] + 1]; 
    549541                msg = [message attributedSubstringFromRange:NSMakeRange( [scanner scanLocation], [message length] - [scanner scanLocation] )]; 
    550542        } 
     
    559551 
    560552        // this is an IRC specific command for sending to room operators only. 
    561         if( [connection type] == MVChatConnectionIRCType && ( ( [to hasPrefix:@"@"] && [to length] > 1 ) || ! [command caseInsensitiveCompare:@"omsg"] ) ) { 
    562                 if( ! [command caseInsensitiveCompare:@"omsg"] && ! [to hasPrefix:@"@"] ) 
    563                         to = [@"@" stringByAppendingString:[connection properNameForChatRoomNamed:to]]; 
    564  
    565                 NSString *prefix = [[NSString allocWithZone:nil] initWithFormat:@"PRIVMSG %@ :", to]; 
    566                 [connection sendRawMessageWithComponents:prefix, msg, nil]; 
    567                 [prefix release]; 
     553        if( [connection type] == MVChatConnectionIRCType && [to hasPrefix:@"@"] && [to length] > 1 ) { 
     554                [connection sendRawMessage:[NSString stringWithFormat:@"PRIVMSG %@ :%@", to, [msg string]]]; 
    568555 
    569556                to = [to substringFromIndex:1];