Changeset 3578
- Timestamp:
- 02/04/07 19:53:29 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Plug-Ins/Standard Commands/JVStandardCommands.m
r3574 r3578 260 260 } 261 261 262 if( ! [command caseInsensitiveCompare:@"msg"] || ! [command caseInsensitiveCompare:@" omsg"] || ! [command caseInsensitiveCompare:@"query"] ) {262 if( ! [command caseInsensitiveCompare:@"msg"] || ! [command caseInsensitiveCompare:@"query"] ) { 263 263 return [self handleMessageCommand:command withMessage:arguments forConnection:connection alwaysShow:( isChatRoom || isDirectChat )]; 264 264 } else if( ! [command caseInsensitiveCompare:@"amsg"] || ! [command caseInsensitiveCompare:@"ame"] || ! [command caseInsensitiveCompare:@"broadcast"] || ! [command caseInsensitiveCompare:@"bract"] ) { … … 354 354 return YES; 355 355 } else if( ( ! [command caseInsensitiveCompare:@"notice"] || ! [command caseInsensitiveCompare:@"onotice"] ) && [connection type] == MVChatConnectionIRCType ) { 356 NSString *targetPrefix = nil; 357 NSString *target = nil; 358 NSString *message = nil; 356 359 NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 357 360 NSMutableCharacterSet *prefixes = [[connection chatRoomNamePrefixes] mutableCopy]; 358 361 [prefixes addCharactersInString:@"@"]; 359 362 360 NSString *target = nil;361 NSString *targetPrefix = nil;362 363 NSScanner *scanner = [NSScanner scannerWithString:[arguments string]]; 363 364 if( [scanner scanCharactersFromSet:prefixes intoString:&targetPrefix] || ! isChatRoom ) { … … 369 370 else [scanner scanUpToCharactersFromSet:whitespace intoString:&target]; 370 371 } 371 372 372 [prefixes release]; 373 373 374 374 [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]; 381 376 382 377 if( ! [target length] || ! [message length] ) return YES; … … 385 380 target = [@"@" stringByAppendingString:[connection properNameForChatRoomNamed:target]]; 386 381 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]]; 390 383 391 384 NSCharacterSet *chanSet = [connection chatRoomNamePrefixes]; … … 541 534 542 535 [scanner scanUpToCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:&to]; 543 [scanner scanCharactersFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] intoString:NULL];544 536 545 537 if( ! [to length] ) return NO; 546 538 547 if( [message length] >= [scanner scanLocation] ) {548 [scanner setScanLocation:[scanner scanLocation] ];539 if( [message length] >= [scanner scanLocation] + 1 ) { 540 [scanner setScanLocation:[scanner scanLocation] + 1]; 549 541 msg = [message attributedSubstringFromRange:NSMakeRange( [scanner scanLocation], [message length] - [scanner scanLocation] )]; 550 542 } … … 559 551 560 552 // 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]]]; 568 555 569 556 to = [to substringFromIndex:1];
