Changeset 3589
- Timestamp:
- 02/25/07 18:04:50 (2 years ago)
- Files:
-
- trunk/Additions/NSImageAdditions.m (modified) (1 diff)
- trunk/Chat Core/MVChatConnection.h (modified) (1 diff)
- trunk/Chat Core/MVChatRoom.h (modified) (1 diff)
- trunk/Chat Core/MVChatRoom.m (modified) (1 diff)
- trunk/Chat Core/MVChatUser.h (modified) (1 diff)
- trunk/Chat Core/MVChatUser.m (modified) (1 diff)
- trunk/Chat Core/MVDirectChatConnection.h (modified) (1 diff)
- trunk/Chat Core/MVDirectChatConnection.m (modified) (2 diffs)
- trunk/Chat Core/MVICBChatRoom.h (modified) (1 diff)
- trunk/Chat Core/MVICBChatRoom.m (modified) (1 diff)
- trunk/Chat Core/MVICBChatUser.m (modified) (1 diff)
- trunk/Chat Core/MVIRCChatConnection.h (modified) (1 diff)
- trunk/Chat Core/MVIRCChatConnection.m (modified) (6 diffs)
- trunk/Chat Core/MVIRCChatRoom.m (modified) (1 diff)
- trunk/Chat Core/MVIRCChatUser.m (modified) (1 diff)
- trunk/Chat Core/MVSILCChatRoom.m (modified) (2 diffs)
- trunk/Chat Core/MVSILCChatUser.m (modified) (2 diffs)
- trunk/Controllers/JVChatController.m (modified) (2 diffs)
- trunk/Models/JVChatMessage.h (modified) (3 diffs)
- trunk/Models/JVChatMessage.m (modified) (4 diffs)
- trunk/Panels/JVChatRoomPanel.m (modified) (1 diff)
- trunk/Panels/JVDirectChatPanel.h (modified) (1 diff)
- trunk/Panels/JVDirectChatPanel.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Additions/NSImageAdditions.m
r3418 r3589 86 86 imageRep = object; 87 87 88 if ( ! imageRep ) {88 if( ! imageRep ) { 89 89 imageRep = [NSBitmapImageRep imageRepWithData:[self TIFFRepresentation]]; 90 90 if( imageRep ) [self addRepresentation:imageRep]; trunk/Chat Core/MVChatConnection.h
r3584 r3589 407 407 408 408 @interface NSObject (MVChatPluginConnectionSupport) 409 - (void) processIncomingMessageAsData:(NSMutableData *) message from:(MVChatUser *) sender to:(id) receiver isNotice:(BOOL) notice;410 - (void) processOutgoingMessageAsData:(NSMutableData *) message to:(id) receiver ;409 - (void) processIncomingMessageAsData:(NSMutableData *) message from:(MVChatUser *) sender to:(id) receiver attributes:(NSMutableDictionary *)msgAttributes; 410 - (void) processOutgoingMessageAsData:(NSMutableData *) message to:(id) receiver attributes:(NSDictionary *)msgAttributes; 411 411 412 412 - (BOOL) processSubcodeRequest:(NSString *) command withArguments:(NSData *) arguments fromUser:(MVChatUser *) user; trunk/Chat Core/MVChatRoom.h
r3526 r3589 147 147 - (void) sendMessage:(NSAttributedString *) message asAction:(BOOL) action; 148 148 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action; 149 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes; 149 150 150 151 - (void) sendSubcodeRequest:(NSString *) command withArguments:(id) arguments; trunk/Chat Core/MVChatRoom.m
r3539 r3589 229 229 230 230 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action { 231 // subclass this method, don't call super 231 [self sendMessage:message withEncoding:encoding withAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:action] forKey:@"action"]]; 232 } 233 234 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 235 // subclass this method, don't call super 232 236 [self doesNotRecognizeSelector:_cmd]; 233 237 } trunk/Chat Core/MVChatUser.h
r3526 r3589 181 181 182 182 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action; 183 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes; 183 184 - (MVUploadFileTransfer *) sendFile:(NSString *) path passively:(BOOL) passive; 184 185 trunk/Chat Core/MVChatUser.m
r3530 r3589 422 422 423 423 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action { 424 // subclass this method, don't call super 424 [self sendMessage:message withEncoding:encoding withAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:action] forKey:@"action"]]; 425 } 426 427 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 428 // subclass this method, don't call super 425 429 [self doesNotRecognizeSelector:_cmd]; 426 430 } trunk/Chat Core/MVDirectChatConnection.h
r3545 r3589 58 58 59 59 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action; 60 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *)attributes; 60 61 @end trunk/Chat Core/MVDirectChatConnection.m
r3545 r3589 160 160 161 161 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action { 162 [self sendMessage:message withEncoding:encoding withAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:action] forKey:@"action"]]; 163 } 164 165 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *)attributes { 162 166 NSParameterAssert( message != nil ); 163 167 … … 183 187 NSData *msg = [message chatFormatWithOptions:options]; 184 188 185 if( action) {189 if( [[attributes objectForKey:@"action"] boolValue] ) { 186 190 NSMutableData *newMsg = [[NSMutableData allocWithZone:nil] initWithCapacity:[msg length] + 11]; 187 191 [newMsg appendBytes:"\001ACTION " length:8]; trunk/Chat Core/MVICBChatRoom.h
r3582 r3589 46 46 - (void) setTopic:(NSAttributedString *) newTopic; 47 47 - (void) sendMessage:(NSAttributedString *) message 48 withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action;48 withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes; 49 49 @end trunk/Chat Core/MVICBChatRoom.m
r3582 r3589 61 61 62 62 - (void) sendMessage:(NSAttributedString *) message 63 withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action{63 withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 64 64 if( [_memberUsers count] > 1 ) 65 65 [(MVICBChatConnection *)_connection ctsOpenPacket:[message string]]; trunk/Chat Core/MVICBChatUser.m
r3584 r3589 70 70 - (void) sendMessage:(NSAttributedString *) message 71 71 withEncoding:(NSStringEncoding) encoding 72 asAction:(BOOL) action{72 withAttributes:(NSDictionary *) attributes { 73 73 [(MVICBChatConnection *)_connection ctsCommandPersonal:_nickname withMessage:[message string]]; 74 74 } trunk/Chat Core/MVIRCChatConnection.h
r3584 r3589 46 46 47 47 + (NSData *) _flattenedIRCDataForMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) enc andChatFormat:(MVChatMessageFormat) format; 48 - (void) _sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding toTarget:(id) target asAction:(BOOL) action;48 - (void) _sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding toTarget:(id) target withAttributes:(NSDictionary *) attributes; 49 49 50 50 - (void) _processErrorCode:(int) errorCode withContext:(char *) context; trunk/Chat Core/MVIRCChatConnection.m
r3584 r3589 931 931 } 932 932 933 - (void) _sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding toTarget:(id) target asAction:(BOOL) action{933 - (void) _sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding toTarget:(id) target withAttributes:(NSDictionary *) attributes { 934 934 NSParameterAssert( [target isKindOfClass:[MVChatUser class]] || [target isKindOfClass:[MVChatRoom class]] ); 935 935 936 936 NSMutableData *msg = [[[self class] _flattenedIRCDataForMessage:message withEncoding:msgEncoding andChatFormat:[self outgoingChatFormat]] mutableCopyWithZone:nil]; 937 937 938 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( id ), nil];938 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( id ), @encode( NSDictionary * ), nil]; 939 939 NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 940 [invocation setSelector:@selector( processOutgoingMessageAsData:to: )];940 [invocation setSelector:@selector( processOutgoingMessageAsData:to:attributes: )]; 941 941 [invocation setArgument:&msg atIndex:2]; 942 942 [invocation setArgument:&target atIndex:3]; 943 [invocation setArgument:&attributes atIndex:4]; 943 944 944 945 [[MVChatPluginManager defaultManager] makePluginsPerformInvocation:invocation]; … … 950 951 NSString *targetName = [target isKindOfClass:[MVChatRoom class]] ? [target name] : [target nickname]; 951 952 952 if( action) {953 if( [[attributes objectForKey:@"action"] boolValue] ) { 953 954 NSString *prefix = [[NSString allocWithZone:nil] initWithFormat:@"PRIVMSG %@ :\001ACTION ", targetName]; 954 955 [self sendRawMessageWithComponents:prefix, msg, @"\001", nil]; … … 1463 1464 MVChatUser *sender = [privmsgInfo objectForKey:@"user"]; 1464 1465 NSMutableData *message = [privmsgInfo objectForKey:@"message"]; 1465 BOOL isNotice = NO; 1466 1467 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( MVChatUser * ), @encode( id ), @encode( BOOL ), nil]; 1466 NSMutableDictionary *msgAttributes = [privmsgInfo mutableCopyWithZone:nil]; 1467 [msgAttributes setObject:[NSNumber numberWithBool:NO] forKey:@"notice"]; 1468 1469 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( MVChatUser * ), @encode( id ), @encode( NSMutableDictionary * ), nil]; 1468 1470 NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 1469 [invocation setSelector:@selector( processIncomingMessageAsData:from:to: isNotice: )];1471 [invocation setSelector:@selector( processIncomingMessageAsData:from:to:attributes: )]; 1470 1472 [invocation setArgument:&message atIndex:2]; 1471 1473 [invocation setArgument:&sender atIndex:3]; 1472 1474 [invocation setArgument:&room atIndex:4]; 1473 [invocation setArgument:& isNoticeatIndex:5];1475 [invocation setArgument:&msgAttributes atIndex:5]; 1474 1476 1475 1477 [[MVChatPluginManager defaultManager] makePluginsPerformInvocation:invocation]; … … 1477 1479 1478 1480 if( room ) { 1479 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatRoomGotMessageNotification object:room userInfo: privmsgInfo];1481 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatRoomGotMessageNotification object:room userInfo:msgAttributes]; 1480 1482 } else { 1481 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionGotPrivateMessageNotification object:sender userInfo: privmsgInfo];1483 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionGotPrivateMessageNotification object:sender userInfo:msgAttributes]; 1482 1484 } 1483 1485 } … … 1531 1533 MVChatUser *sender = [noticeInfo objectForKey:@"user"]; 1532 1534 NSMutableData *message = [noticeInfo objectForKey:@"message"]; 1533 BOOL isNotice = YES; 1534 1535 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( MVChatUser * ), @encode( id ), @encode( BOOL ), nil]; 1535 NSMutableDictionary *msgAttributes = [noticeInfo mutableCopyWithZone:nil]; 1536 [msgAttributes setObject:[NSNumber numberWithBool:YES] forKey:@"notice"]; 1537 1538 NSMethodSignature *signature = [NSMethodSignature methodSignatureWithReturnAndArgumentTypes:@encode( void ), @encode( NSMutableData * ), @encode( MVChatUser * ), @encode( id ), @encode( NSMutableDictionary * ), nil]; 1536 1539 NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 1537 [invocation setSelector:@selector( processIncomingMessageAsData:from:to: isNotice: )];1540 [invocation setSelector:@selector( processIncomingMessageAsData:from:to:attributes: )]; 1538 1541 [invocation setArgument:&message atIndex:2]; 1539 1542 [invocation setArgument:&sender atIndex:3]; 1540 1543 [invocation setArgument:&room atIndex:4]; 1541 [invocation setArgument:& isNoticeatIndex:5];1544 [invocation setArgument:&msgAttributes atIndex:5]; 1542 1545 1543 1546 [[MVChatPluginManager defaultManager] makePluginsPerformInvocation:invocation]; … … 1545 1548 1546 1549 if( room ) { 1547 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatRoomGotMessageNotification object:room userInfo: noticeInfo];1550 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatRoomGotMessageNotification object:room userInfo:msgAttributes]; 1548 1551 } else { 1549 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionGotPrivateMessageNotification object:sender userInfo: noticeInfo];1552 [[NSNotificationCenter defaultCenter] postNotificationName:MVChatConnectionGotPrivateMessageNotification object:sender userInfo:msgAttributes]; 1550 1553 1551 1554 if( [[sender nickname] isEqualToString:@"NickServ"] ) { trunk/Chat Core/MVIRCChatRoom.m
r3584 r3589 54 54 #pragma mark - 55 55 56 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding asAction:(BOOL) action{56 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) msgEncoding withAttributes:(NSDictionary *) attributes { 57 57 NSParameterAssert( message != nil ); 58 [[self connection] _sendMessage:message withEncoding:msgEncoding toTarget:self asAction:action];58 [[self connection] _sendMessage:message withEncoding:msgEncoding toTarget:self withAttributes:attributes]; 59 59 } 60 60 trunk/Chat Core/MVIRCChatUser.m
r3584 r3589 42 42 #pragma mark - 43 43 44 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action{44 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 45 45 NSParameterAssert( message != nil ); 46 [[self connection] _sendMessage:message withEncoding:encoding toTarget:self asAction:action];46 [[self connection] _sendMessage:message withEncoding:encoding toTarget:self withAttributes:attributes]; 47 47 } 48 48 trunk/Chat Core/MVSILCChatRoom.m
r3420 r3589 66 66 #pragma mark - 67 67 68 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action{68 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 69 69 NSParameterAssert( message != nil ); 70 70 … … 72 72 SilcMessageFlags flags = SILC_MESSAGE_FLAG_UTF8; 73 73 74 if( action) flags |= SILC_MESSAGE_FLAG_ACTION;74 if( [[attributes objectForKey:@"action"] boolValue] ) flags |= SILC_MESSAGE_FLAG_ACTION; 75 75 76 76 SilcLock( [[self connection] _silcClient] ); trunk/Chat Core/MVSILCChatUser.m
r3512 r3589 105 105 #pragma mark - 106 106 107 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action{107 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding withAttributes:(NSDictionary *) attributes { 108 108 NSParameterAssert( message != nil ); 109 109 … … 111 111 SilcMessageFlags flags = SILC_MESSAGE_FLAG_UTF8; 112 112 113 if( action) flags |= SILC_MESSAGE_FLAG_ACTION;113 if( [[attributes objectForKey:@"action"] boolValue]) flags |= SILC_MESSAGE_FLAG_ACTION; 114 114 115 115 // unpack the identifier here for now trunk/Controllers/JVChatController.m
r3582 r3589 564 564 if( ( [self shouldIgnoreUser:user withMessage:nil inView:nil] == JVNotIgnored ) ) { 565 565 JVDirectChatPanel *controller = [self chatViewControllerForDirectChatConnection:connection ifExists:NO userInitiated:NO]; 566 [controller addMessageToDisplay:message fromUser:user asAction:[[[notification userInfo] objectForKey:@"action"] boolValue] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:JVChatMessageNormalType];566 [controller addMessageToDisplay:message fromUser:user withAttributes:[notification userInfo] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:JVChatMessageNormalType]; 567 567 } 568 568 } … … 632 632 JVDirectChatPanel *controller = [self chatViewControllerForUser:user ifExists:NO userInitiated:NO]; 633 633 JVChatMessageType type = ( [[[notification userInfo] objectForKey:@"notice"] boolValue] ? JVChatMessageNoticeType : JVChatMessageNormalType ); 634 [controller addMessageToDisplay:message fromUser:user asAction:[[[notification userInfo] objectForKey:@"action"] boolValue] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:type];634 [controller addMessageToDisplay:message fromUser:user withAttributes:[notification userInfo] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:type]; 635 635 } 636 636 } trunk/Models/JVChatMessage.h
r3247 r3589 34 34 BOOL _bodyLoaded; 35 35 BOOL _senderLoaded; 36 NSMutableDictionary *_attributes; 36 37 } 37 38 - (/* xmlNode */ void *) node; … … 64 65 - (NSScriptObjectSpecifier *) objectSpecifier; 65 66 - (void) setObjectSpecifier:(NSScriptObjectSpecifier *) objectSpecifier; 67 68 - (NSDictionary *) attributes; 69 - (id) attributeForKey:(id) key; 66 70 @end 67 71 … … 89 93 - (void) setSource:(NSURL *) source; 90 94 - (void) setMessageIdentifier:(NSString *) identifier; 95 96 - (NSMutableDictionary *) attributes; 97 - (void) setAttributes:(NSDictionary *) attributes; 98 - (void) setAttribute:(id) object forKey:(id) key; 91 99 @end trunk/Models/JVChatMessage.m
r3450 r3589 97 97 ret -> _ignoreStatus = [self ignoreStatus]; 98 98 ret -> _type = [self type]; 99 ret -> _attributes = [[self attributes] copyWithZone:zone]; 99 100 } 100 101 … … 108 109 [_source release]; 109 110 [_objectSpecifier release]; 111 [_attributes release]; 110 112 111 113 [_senderIdentifier release]; … … 329 331 #pragma mark - 330 332 333 - (NSDictionary *) attributes { 334 // Add important attributes which are set via normal setters, and therefore don't exist normally in the attributes-dict. 335 if( ! _attributes ) 336 _attributes = [[NSMutableDictionary alloc] init]; 337 [_attributes setObject:[NSNumber numberWithBool:_action] forKey:@"action"]; 338 339 return _attributes; 340 } 341 342 - (id) attributeForKey:(id) key { 343 return [_attributes objectForKey:key]; 344 } 345 346 #pragma mark - 347 331 348 - (NSString *) description { 332 349 return [self bodyAsPlainText]; … … 557 574 } 558 575 576 - (NSMutableDictionary *) attributes { 577 // This depends on the implementation of JVChatMessage using an NSMutableDictionary for its attributes, and actually returning a mutable version of it. 578 return (NSMutableDictionary *)[super attributes]; 579 } 580 581 - (void) setAttributes:(NSDictionary *) attributes { 582 [self _setNode:NULL]; 583 id old = _attributes; 584 _attributes = [attributes mutableCopyWithZone:[self zone]]; 585 [old release]; 586 } 587 588 - (void) setAttribute:(id) object forKey:(id) key { 589 if( ! _attributes ) 590 _attributes = [[NSMutableDictionary alloc] init]; 591 [_attributes setObject:object forKey:key]; 592 } 593 559 594 #pragma mark - 560 595 trunk/Panels/JVChatRoomPanel.m
r3579 r3589 319 319 - (void) handleRoomMessageNotification:(NSNotification *) notification { 320 320 JVChatMessageType type = ( [[[notification userInfo] objectForKey:@"notice"] boolValue] ? JVChatMessageNoticeType : JVChatMessageNormalType ); 321 [self addMessageToDisplay:[[notification userInfo] objectForKey:@"message"] fromUser:[[notification userInfo] objectForKey:@"user"] asAction:[[[notification userInfo] objectForKey:@"action"] boolValue] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:type];321 [self addMessageToDisplay:[[notification userInfo] objectForKey:@"message"] fromUser:[[notification userInfo] objectForKey:@"user"] withAttributes:[notification userInfo] withIdentifier:[[notification userInfo] objectForKey:@"identifier"] andType:type]; 322 322 } 323 323 trunk/Panels/JVDirectChatPanel.h
r3570 r3589 59 59 - (void) addEventMessageToDisplay:(NSString *) message withName:(NSString *) name andAttributes:(NSDictionary *) attributes; 60 60 - (void) addMessageToDisplay:(NSData *) message fromUser:(MVChatUser *) user asAction:(BOOL) action withIdentifier:(NSString *) identifier andType:(JVChatMessageType) type; 61 - (void) addMessageToDisplay:(NSData *) message fromUser:(MVChatUser *) user withAttributes:(NSDictionary *) msgAttributes withIdentifier:(NSString *) identifier andType:(JVChatMessageType) type; 61 62 - (void) processIncomingMessage:(JVMutableChatMessage *) message; 62 63 - (void) echoSentMessageToDisplay:(JVMutableChatMessage *) message; trunk/Panels/JVDirectChatPanel.m
r3570 r3589 741 741 } 742 742 743 - (void) addMessageToDisplay:(NSData *) message fromUser:(MVChatUser *) user asAction:(BOOL) action withIdentifier:(NSString *) identifier andType:(JVChatMessageType) type { 743 - (void) addMessageToDisplay:(NSData *) message fromUser:(MVChatUser *) user asAction:(BOOL) action withIdentifier:(NSString *) identifier andType:(JVChatMessageType) type; 744 { 745 [self addMessageToDisplay:message fromUser:user withAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:action] forKey:@"action"] withIdentifier:identifier andType:type]; 746 } 747 748 - (void) addMessageToDisplay:(NSData *) message fromUser:(MVChatUser *) user withAttributes:(NSDictionary *) msgAttributes withIdentifier:(NSString *) identifier andType:(JVChatMessageType) type { 744 749 if( ! _nibLoaded ) [self view]; 745 750 … … 770 775 JVMutableChatMessage *cmessage = [[JVMutableChatMessage alloc] initWithText:messageString sender:user]; 771 776 [cmessage setMessageIdentifier:identifier]; 772 [cmessage setAction:action]; 777 [cmessage setAttributes:msgAttributes]; 778 [cmessage setAction:[[msgAttributes objectForKey:@"action"] boolValue]]; 773 779 [cmessage setType:type]; 774 780 … … 948 954 NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:[self encoding]], @"StringEncoding", cformat, @"FormatType", nil]; 949 955 NSData *msgData = [[message body] chatFormatWithOptions:options]; // we could save this back to the message object before sending 950 [self addMessageToDisplay:msgData fromUser:[message sender] asAction:[message isAction] withIdentifier:[message messageIdentifier] andType:[message type]];956 [self addMessageToDisplay:msgData fromUser:[message sender] withAttributes:[message attributes] withIdentifier:[message messageIdentifier] andType:[message type]]; 951 957 } 952 958 … … 1089 1095 1090 1096 if( [[message body] length] ) 1091 [[self target] sendMessage:[message body] withEncoding:_encoding asAction:[message isAction]];1097 [[self target] sendMessage:[message body] withEncoding:_encoding withAttributes:[message attributes]]; 1092 1098 } 1093 1099 … … 1149 1155 } else if( ( [event modifierFlags] & NSAlternateKeyMask ) != 0 ) { 1150 1156 ret = NO; 1151 } else if ( ([event modifierFlags] & NSControlKeyMask) != 0 ) {1157 } else if( ([event modifierFlags] & NSControlKeyMask) != 0 ) { 1152 1158 [self send:[NSNumber numberWithBool:YES]]; 1153 1159 ret = YES;
