Changeset 2161

Show
Ignore:
Timestamp:
12/28/04 13:06:07 (4 years ago)
Author:
timothy
Message:

Bringing the branch up to r2160. THis should be the last commit here, as I am about to merge the branch back into the trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/overhaul/JVChatTranscript.m

    r2132 r2161  
    676676 
    677677// Allows some simple code to work when not built with WebKit/Safari 1.3 
    678 #ifndef _WEB_SCRIPT_OBJECT_H_ 
     678#ifndef WebKitVersion146 
    679679#define WebMenuItemTagGoBack 9 
    680680#define WebMenuItemTagGoForward 10 
     
    810810- (void) webView:(WebView *) sender didFinishLoadForFrame:(WebFrame *) frame { 
    811811// Test for WebKit/Safari 1.3 
    812 #ifdef _WEB_SCRIPT_OBJECT_H_ 
     812#ifdef WebKitVersion146 
    813813        if( [display respondsToSelector:@selector( setDrawsBackground: )] ) { 
    814814                DOMCSSStyleDeclaration *style = [sender computedStyleForElement:[(DOMHTMLDocument *)[[sender mainFrame] DOMDocument] body] pseudoElement:nil]; 
     
    954954 
    955955- (void) _prependMessages:(NSString *) messages { 
     956#ifdef WebKitVersion146 
    956957        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    957 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    958958                NSMutableString *result = [messages mutableCopy]; 
    959959                [result replaceOccurrencesOfString:@"  " withString:@"  " options:NSLiteralSearch range:NSMakeRange( 0, [result length] )]; 
     
    979979                // scroll down if we need to 
    980980                if( [scrollNeeded boolValue] ) [body setValue:[body valueForKey:@"offsetHeight"] forKey:@"scrollTop"]; 
     981        } else 
    981982#endif 
    982         } else { 
     983        { // old JavaScript method 
    983984                NSMutableString *result = [messages mutableCopy]; 
    984985                [result escapeCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\\\"'"]]; 
  • branches/overhaul/JVDirectChat.m

    r2141 r2161  
    102102- (void) addEventMessageToLogAndDisplay:(NSString *) message withName:(NSString *) name andAttributes:(NSDictionary *) attributes entityEncodeAttributes:(BOOL) encode; 
    103103- (void) addMessageToLogAndDisplay:(NSData *) message fromUser:(MVChatUser *) user asAction:(BOOL) action; 
     104- (int) visibleMessageCount; 
    104105- (int) locationOfMessage:(unsigned int) identifier; 
    105106- (int) locationOfElementByIndex:(unsigned int) index; 
     
    119120- (void) _saveSelfIcon; 
    120121- (void) _saveBuddyIcon:(JVBuddy *) buddy; 
     122- (void) _setCurrentMessage:(JVMutableChatMessage *) message; 
    121123@end 
    122124 
     
    499501 
    500502- (void) handleDraggedFile:(NSString *) path { 
    501         [[self target] sendFile:path passively:NO]; 
     503        BOOL passive = [[NSUserDefaults standardUserDefaults] boolForKey:@"JVSendFilesPassively"]; 
     504        [[self target] sendFile:path passively:passive]; 
    502505} 
    503506 
     
    798801                                        [[self connection] sendRawMessage:[command stringByAppendingFormat:@" %@", [arguments string]]]; 
    799802                        } else { 
    800                                 if( [[subMsg string] hasPrefix:@"//"] ) { 
    801                                         [subMsg deleteCharactersInRange:NSMakeRange(0,1)]; 
    802                                 } 
     803                                if( [[subMsg string] hasPrefix:@"//"] ) [subMsg deleteCharactersInRange:NSMakeRange( 0, 1 )]; 
    803804                                if( [[NSUserDefaults standardUserDefaults] boolForKey:@"MVChatNaturalActions"] && ! action ) { 
    804805                                        extern NSArray *JVAutoActionVerbs; 
     
    816817                                } 
    817818 
    818                                 [_currentMessage autorelease]; // set the message to an object property for plugins, if needed... 
    819                                 _currentMessage = [[JVMutableChatMessage alloc] initWithText:subMsg sender:[[self connection] nickname] andTranscript:self]; 
    820                                 [_currentMessage setAction:action]; 
    821  
    822                                 id classDescription = [NSClassDescription classDescriptionForClass:[self class]]; 
    823                                 id msgSpecifier = [[[NSPropertySpecifier alloc] initWithContainerClassDescription:classDescription containerSpecifier:[self objectSpecifier] key:@"currentMessage"] autorelease]; 
    824                                 [_currentMessage setObjectSpecifier:msgSpecifier]; 
    825  
    826                                 [self sendMessage:_currentMessage]; 
     819                                JVMutableChatMessage *cmessage = [[JVMutableChatMessage alloc] initWithText:subMsg sender:[[self connection] nickname] andTranscript:self]; 
     820                                [cmessage setAction:action]; 
     821 
     822                                [self sendMessage:cmessage]; 
    827823 
    828824                                if( [[subMsg string] length] ) 
    829                                         [self echoSentMessageToDisplay:[_currentMessage body] asAction:[_currentMessage isAction]]; 
    830  
    831                                 [_currentMessage release]; 
    832                                 _currentMessage = nil; 
     825                                        [self echoSentMessageToDisplay:[cmessage body] asAction:[cmessage isAction]]; 
     826 
     827                                [cmessage release]; 
    833828                        } 
    834829                } 
     
    849844        [invocation setArgument:&message atIndex:2]; 
    850845 
     846        [self _setCurrentMessage:message]; 
    851847        [[MVChatPluginManager defaultManager] makePluginsPerformInvocation:invocation stoppingOnFirstSuccessfulReturn:NO]; 
     848        [self _setCurrentMessage:nil]; 
    852849 
    853850        if( [[message body] length] ) 
     
    12961293        } 
    12971294 
    1298         [_currentMessage autorelease]; // set the message to an object property for plugins, if needed... 
    1299         _currentMessage = [[JVMutableChatMessage alloc] initWithText:messageString sender:[user nickname] andTranscript:self]; 
    1300         [_currentMessage setAction:action]; 
    1301  
    1302         id classDescription = [NSClassDescription classDescriptionForClass:[self class]]; 
    1303         id msgSpecifier = [[[NSPropertySpecifier alloc] initWithContainerClassDescription:classDescription containerSpecifier:[self objectSpecifier] key:@"currentMessage"] autorelease]; 
    1304         [_currentMessage setObjectSpecifier:msgSpecifier]; 
     1295        JVMutableChatMessage *cmessage = [[JVMutableChatMessage alloc] initWithText:messageString sender:user andTranscript:self]; 
     1296        [cmessage setAction:action]; 
     1297 
     1298        [self _setCurrentMessage:cmessage]; 
    13051299 
    13061300        if( ! [user isLocalUser] ) 
    1307                 [_currentMessage setIgnoreStatus:[[JVChatController defaultManager] shouldIgnoreUser:user withMessage:messageString inView:self]]; 
    1308  
    1309         if( ! [user isLocalUser] && [_currentMessage ignoreStatus] == JVNotIgnored ) 
     1301                [cmessage setIgnoreStatus:[[JVChatController defaultManager] shouldIgnoreUser:user withMessage:messageString inView:self]]; 
     1302 
     1303        if( ! [user isLocalUser] && [cmessage ignoreStatus] == JVNotIgnored ) 
    13101304                _newMessageCount++; 
    13111305 
     
    13461340                                else [classes addObject:@"highlight"]; 
    13471341                                [messageString addAttribute:@"CSSClasses" value:classes range:foundRange]; 
    1348                                 [_currentMessage setHighlighted:YES]; 
     1342                                [cmessage setHighlighted:YES]; 
    13491343                        } 
    13501344                } 
    13511345        } 
    13521346 
    1353         [self processIncomingMessage:_currentMessage]; 
    1354  
    1355 //      user = [[_currentMessage sender] description]; // if plugins changed the sending user for some reason, allow it 
    1356  
    1357         if( ! [messageString length] && [_currentMessage ignoreStatus] == JVNotIgnored ) {  // plugins decided to excluded this message, decrease the new message counts 
     1347        [self processIncomingMessage:cmessage]; 
     1348 
     1349//      user = [[cmessage sender] description]; // if plugins changed the sending user for some reason, allow it 
     1350 
     1351        if( ! [messageString length] && [cmessage ignoreStatus] == JVNotIgnored ) {  // plugins decided to excluded this message, decrease the new message counts 
    13581352                _newMessageCount--; 
    13591353                return; 
     
    13621356        [self _breakLongLinesInString:messageString]; 
    13631357 
    1364         if( [_currentMessage isHighlighted] && [_currentMessage ignoreStatus] == JVNotIgnored ) { 
     1358        if( [cmessage isHighlighted] && [cmessage ignoreStatus] == JVNotIgnored ) { 
    13651359                _newHighlightMessageCount++; 
    13661360                NSMutableDictionary *context = [NSMutableDictionary dictionary]; 
     
    13741368        } 
    13751369 
    1376         if( [_currentMessage ignoreStatus] != JVNotIgnored ) { 
     1370        if( [cmessage ignoreStatus] != JVNotIgnored ) { 
    13771371                NSMutableDictionary *context = [NSMutableDictionary dictionary]; 
    1378                 [context setObject:( ( [_currentMessage ignoreStatus] == JVUserIgnored ) ? NSLocalizedString( @"User Ignored", "user ignored bubble title" ) : NSLocalizedString( @"Message Ignored", "message ignored bubble title" ) ) forKey:@"title"]; 
     1372                [context setObject:( ( [cmessage ignoreStatus] == JVUserIgnored ) ? NSLocalizedString( @"User Ignored", "user ignored bubble title" ) : NSLocalizedString( @"Message Ignored", "message ignored bubble title" ) ) forKey:@"title"]; 
    13791373                if( [self isMemberOfClass:[JVChatRoom class]] ) [context setObject:[NSString stringWithFormat:@"%@'s message was ignored in %@.", user, [self title]] forKey:@"description"]; 
    13801374                else [context setObject:[NSString stringWithFormat:@"%@'s message was ignored.", user] forKey:@"description"]; 
    13811375                [context setObject:[NSImage imageNamed:@"activity"] forKey:@"image"]; 
    1382                 [[JVNotificationController defaultManager] performNotification:( ( [_currentMessage ignoreStatus] == JVUserIgnored ) ? @"JVUserIgnored" : @"JVMessageIgnored" ) withContextInfo:context]; 
     1376                [[JVNotificationController defaultManager] performNotification:( ( [cmessage ignoreStatus] == JVUserIgnored ) ? @"JVUserIgnored" : @"JVMessageIgnored" ) withContextInfo:context]; 
    13831377        } 
    13841378 
     
    14581452 
    14591453        child = xmlDocCopyNode( xmlDocGetRootElement( msgDoc ), doc, 1 ); 
    1460         xmlSetProp( child, "received", [[[_currentMessage date] description] UTF8String] ); 
    1461         if( [_currentMessage isAction] ) xmlSetProp( child, "action", "yes" ); 
    1462         if( [_currentMessage isHighlighted] ) xmlSetProp( child, "highlight", "yes" ); 
    1463         if( [_currentMessage ignoreStatus] == JVMessageIgnored ) xmlSetProp( child, "ignored", "yes" ); 
    1464         else if( [_currentMessage ignoreStatus] == JVUserIgnored ) xmlSetProp( root, "ignored", "yes" ); 
     1454        xmlSetProp( child, "received", [[[cmessage date] description] UTF8String] ); 
     1455        if( [cmessage isAction] ) xmlSetProp( child, "action", "yes" ); 
     1456        if( [cmessage isHighlighted] ) xmlSetProp( child, "highlight", "yes" ); 
     1457        if( [cmessage ignoreStatus] == JVMessageIgnored ) xmlSetProp( child, "ignored", "yes" ); 
     1458        else if( [cmessage ignoreStatus] == JVUserIgnored ) xmlSetProp( root, "ignored", "yes" ); 
    14651459        xmlAddChild( root, child ); 
    14661460 
     
    14941488                [self appendMessage:transformedMessage subsequent:subsequent]; 
    14951489 
    1496                 if( [_currentMessage isHighlighted] ) { 
     1490                if( [cmessage isHighlighted] ) { 
    14971491                        NSScroller *scroller = [[[[[display mainFrame] frameView] documentView] enclosingScrollView] verticalScroller]; 
    14981492                        if( [scroller isKindOfClass:[JVMarkedScroller class]] ) { 
     
    15061500                _firstMessage = NO; // not the first message anymore 
    15071501                _requiresFullMessage = NO; // next message will not require a new envelope if it is consecutive 
    1508         } else if( [_currentMessage ignoreStatus] == JVNotIgnored ) { 
     1502        } else if( [cmessage ignoreStatus] == JVNotIgnored ) { 
    15091503                // the style decided to excluded this message, decrease the new message counts 
    1510                 if( [_currentMessage isHighlighted] ) _newHighlightMessageCount--; 
     1504                if( [cmessage isHighlighted] ) _newHighlightMessageCount--; 
    15111505                _newMessageCount--;              
    15121506        } 
     
    15141508        xmlFreeDoc( doc ); 
    15151509 
    1516         [_currentMessage release]; // not needed anymore 
    1517         _currentMessage = nil
     1510        [self _setCurrentMessage:nil]; 
     1511        [cmessage release]
    15181512 
    15191513        [_windowController reloadListItem:self andChildren:NO]; 
     
    15211515 
    15221516- (int) locationOfMessage:(unsigned int) identifier { 
     1517#ifdef WebKitVersion146 
    15231518        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1524 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    15251519                DOMElement *element = [[[display mainFrame] DOMDocument] getElementById:[NSString stringWithFormat:@"%d", identifier]]; 
    15261520                return [[element valueForKey:@"offsetTop"] intValue]; 
     1521        } else 
    15271522#endif 
    1528         } else { // old JavaScript method 
    1529                 return [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfMessage( \"%d\" );", identifier]] intValue]; 
    1530         } 
     1523        // old JavaScript method 
     1524        return [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfMessage( \"%d\" );", identifier]] intValue]; 
    15311525} 
    15321526 
    15331527- (int) locationOfElementByIndex:(unsigned int) index { 
     1528#ifdef WebKitVersion146 
    15341529        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1535 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    15361530                DOMHTMLElement *body = [(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body]; 
    15371531                if( index < [[body children] length] ) return [[[[body children] item:index] valueForKey:@"offsetTop"] intValue]; 
    15381532                else return 0; 
     1533        } else 
    15391534#endif 
    1540         } else { // old JavaScript method 
    1541                 return [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfElementByIndex( %d );", index]] intValue]; 
    1542         } 
     1535        // old JavaScript method 
     1536        return [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfElementByIndex( %d );", index]] intValue]; 
     1537
     1538 
     1539- (int) visibleMessageCount { 
     1540#ifdef WebKitVersion146 
     1541        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
     1542                return [[[(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body] children] length]; 
     1543        } else 
     1544#endif 
     1545        // old JavaScript method 
     1546        return [[display stringByEvaluatingJavaScriptFromString:@"scrollBackMessageCount();"] intValue]; 
    15431547} 
    15441548 
    15451549- (void) scrollToBottom { 
     1550#ifdef WebKitVersion146 
    15461551        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1547 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    15481552                DOMHTMLElement *body = [(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body]; 
    15491553                [body setValue:[body valueForKey:@"offsetHeight"] forKey:@"scrollTop"]; 
     1554        } else 
    15501555#endif 
    1551         } else { 
    1552                 [display stringByEvaluatingJavaScriptFromString:@"scrollToBottom();"]; 
    1553         } 
     1556        // old JavaScript method 
     1557        [display stringByEvaluatingJavaScriptFromString:@"scrollToBottom();"]; 
    15541558} 
    15551559 
    15561560- (void) appendMessage:(NSString *) html subsequent:(BOOL) subsequent { 
    1557         unsigned int messageCount = 0
     1561        unsigned int messageCount = [self visibleMessageCount]
    15581562        unsigned int scrollbackLimit = [[NSUserDefaults standardUserDefaults] integerForKey:@"JVChatScrollbackLimit"]; 
    15591563        NSScroller *scroller = [[[[[display mainFrame] frameView] documentView] enclosingScrollView] verticalScroller]; 
    15601564 
    1561         if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1562 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    1563                 messageCount = [[[(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body] children] length]; 
    1564 #endif 
    1565         } else messageCount = [[display stringByEvaluatingJavaScriptFromString:@"scrollBackMessageCount();"] intValue]; 
    1566  
    1567         if( ( messageCount + 1 ) > scrollbackLimit ) { 
     1565        if( ! subsequent && ( messageCount + 1 ) > scrollbackLimit ) { 
    15681566                int loc = [self locationOfElementByIndex:( ( messageCount + 1 ) - scrollbackLimit )]; 
    15691567                if( loc > 0 && [scroller isKindOfClass:[JVMarkedScroller class]] ) 
     
    15711569        } 
    15721570 
     1571#ifdef WebKitVersion146 
    15731572        if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1574 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    15751573                DOMHTMLElement *element = (DOMHTMLElement *)[[[display mainFrame] DOMDocument] createElement:@"span"]; 
    15761574                DOMHTMLElement *replaceElement = (DOMHTMLElement *)[[[display mainFrame] DOMDocument] getElementById:@"consecutiveInsert"]; 
     
    16131611                // scroll down if we need to 
    16141612                if( [scrollNeeded boolValue] ) [self scrollToBottom]; 
    1615 #endif 
    1616         } else { // old JavaScript method 
     1613        } else 
     1614#endif   
     1615        { // old JavaScript method 
    16171616                NSMutableString *transformedMessage = [html mutableCopy]; 
    16181617                [transformedMessage escapeCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\\\"'"]]; 
     
    18601859                [self addEventMessageToDisplay:[NSString stringWithFormat:NSLocalizedString( @"You have set yourself away with \"%@\".", "self away status set message" ), msgString] withName:@"awaySet" andAttributes:[NSDictionary dictionaryWithObjectsAndKeys:messageString, @"away-message", nil]]; 
    18611860 
    1862                 unsigned int messageCount = 0; 
    1863                 unsigned long loc = 0; 
    1864  
    1865                 if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1866 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    1867                         messageCount = [[[(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body] children] length]; 
    1868                         loc = [self locationOfElementByIndex:( messageCount - 1 )]; 
    1869 #endif 
    1870                 } else { 
    1871                         messageCount = [[display stringByEvaluatingJavaScriptFromString:@"scrollBackMessageCount();"] intValue]; 
    1872                         loc = [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfElementByIndex( %d );", ( messageCount - 1 )]] intValue]; 
    1873                 } 
     1861                unsigned int messageCount = [self visibleMessageCount]; 
     1862                unsigned long loc = [self locationOfElementByIndex:( messageCount - 1 )]; 
    18741863 
    18751864                NSScroller *scroller = [[[[[display mainFrame] frameView] documentView] enclosingScrollView] verticalScroller]; 
     
    18781867                [self addEventMessageToDisplay:NSLocalizedString( @"You have returned from away.", "self away status removed message" ) withName:@"awayRemoved" andAttributes:nil]; 
    18791868 
    1880                 unsigned int messageCount = 0; 
    1881                 unsigned long loc = 0; 
    1882  
    1883                 if( [[display mainFrame] respondsToSelector:@selector( DOMDocument )] ) { 
    1884 #ifdef _WEB_SCRIPT_OBJECT_H_ 
    1885                         messageCount = [[[(DOMHTMLDocument *)[[display mainFrame] DOMDocument] body] children] length]; 
    1886                         loc = [self locationOfElementByIndex:( messageCount - 1 )]; 
    1887 #endif 
    1888                 } else { 
    1889                         messageCount = [[display stringByEvaluatingJavaScriptFromString:@"scrollBackMessageCount();"] intValue]; 
    1890                         loc = [[display stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"locationOfElementByIndex( %d );", ( messageCount - 1 )]] intValue]; 
    1891                 } 
     1869                unsigned int messageCount = [self visibleMessageCount]; 
     1870                unsigned long loc = [self locationOfElementByIndex:( messageCount - 1 )]; 
    18921871 
    18931872                NSScroller *scroller = [[[[[display mainFrame] frameView] documentView] enclosingScrollView] verticalScroller]; 
     
    21002079        } 
    21012080} 
     2081 
     2082- (void) _setCurrentMessage:(JVMutableChatMessage *) message { 
     2083        [_currentMessage setObjectSpecifier:nil]; 
     2084        [_currentMessage autorelease]; 
     2085        _currentMessage = [message retain]; 
     2086 
     2087        id classDescription = [NSClassDescription classDescriptionForClass:[self class]]; 
     2088        id msgSpecifier = [[[NSPropertySpecifier alloc] initWithContainerClassDescription:classDescription containerSpecifier:[self objectSpecifier] key:@"currentMessage"] autorelease]; 
     2089        [_currentMessage setObjectSpecifier:msgSpecifier]; 
     2090} 
    21022091@end 
    21032092 
     
    21222111        BOOL localEcho = ( [[command evaluatedArguments] objectForKey:@"echo"] ? [[[command evaluatedArguments] objectForKey:@"echo"] boolValue] : YES ); 
    21232112 
    2124         [_currentMessage autorelease]; // set the message to an object property for plugins, if needed... 
    2125         _currentMessage = [[JVMutableChatMessage alloc] initWithText:attributeMsg sender:[[self connection] nickname] andTranscript:self]; 
    2126         [_currentMessage setAction:action]; 
    2127  
    2128         id classDescription = [NSClassDescription classDescriptionForClass:[self class]]; 
    2129         id msgSpecifier = [[[NSPropertySpecifier alloc] initWithContainerClassDescription:classDescription containerSpecifier:[self objectSpecifier] key:@"currentMessage"] autorelease]; 
    2130         [_currentMessage setObjectSpecifier:msgSpecifier]; 
    2131  
    2132         [self sendMessage:_currentMessage]; 
    2133  
    2134         if( localEcho ) [self echoSentMessageToDisplay:[_currentMessage body] asAction:[_currentMessage isAction]]; 
    2135  
    2136         [_currentMessage release]; 
    2137         _currentMessage = nil; 
     2113        JVMutableChatMessage *cmessage = [[JVMutableChatMessage alloc] initWithText:attributeMsg sender:[[self connection] nickname] andTranscript:self]; 
     2114        [cmessage setAction:action]; 
     2115 
     2116        [self sendMessage:cmessage]; 
     2117 
     2118        if( localEcho ) [self echoSentMessageToDisplay:[cmessage body] asAction:[cmessage isAction]]; 
     2119 
     2120        [cmessage release]; 
    21382121} 
    21392122 
  • branches/overhaul/MVIRCChatConnection.m

    r2113 r2161  
    11#import <unistd.h> 
     2#import <pthread.h> 
    23 
    34#define HAVE_IPV6 1 
     
    190191        MVIRCChatConnection *self = [MVIRCChatConnection _connectionForServer:server]; 
    191192 
    192         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    193         [self performSelectorOnMainThread:@selector( _didDisconnect ) withObject:nil waitUntilDone:YES]; 
    194         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     193        if( ! pthread_main_np() ) { // if not main thread 
     194                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     195                [self performSelectorOnMainThread:@selector( _didDisconnect ) withObject:nil waitUntilDone:YES]; 
     196                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     197        } else [self performSelector:@selector( _didDisconnect )]; 
    195198} 
    196199 
     
    199202        if( ! self ) return; 
    200203 
    201         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    202         [self performSelectorOnMainThread:@selector( _didNotConnect ) withObject:nil waitUntilDone:YES]; 
    203         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     204        server_ref( server ); 
     205 
     206        if( ! pthread_main_np() ) { // if not main thread 
     207                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     208                [self performSelectorOnMainThread:@selector( _didNotConnect ) withObject:nil waitUntilDone:YES]; 
     209                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     210        } else [self performSelector:@selector( _didNotConnect )]; 
    204211} 
    205212 
  • branches/overhaul/MVIRCFileTransfer.m

    r2026 r2161  
     1#import <pthread.h> 
     2 
    13#define HAVE_IPV6 1 
    24#define MODULE_NAME "MVIRCFileTransfer" 
     
    3638        if( ! self ) return; 
    3739 
    38         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    39         [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
    40         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     40        if( ! pthread_main_np() ) { // if not main thread 
     41                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     42                [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
     43                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     44        } else [self performSelector:@selector( _destroying )]; 
    4145 
    4246        if( dcc -> size != dcc -> transfd ) { 
     
    5559        if( ! self ) return; 
    5660 
    57         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    58         [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
    59         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     61        if( ! pthread_main_np() ) { // if not main thread 
     62                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     63                [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
     64                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     65        } else [self performSelector:@selector( _destroying )]; 
    6066 
    6167        NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:@"The file transfer connection could not be made.", NSLocalizedDescriptionKey, nil]; 
     
    6874        if( ! self ) return; 
    6975 
    70         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    71         [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
    72         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     76        if( ! pthread_main_np() ) { // if not main thread 
     77                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     78                [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
     79                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     80        } else [self performSelector:@selector( _destroying )]; 
    7381 
    7482        NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:@"The file %@ could not be created, please make sure you have write permissions in the %@ folder.", NSLocalizedDescriptionKey, nil]; 
     
    8189        if( ! self ) return; 
    8290 
    83         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    84         [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
    85         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
    86  
     91        if( ! pthread_main_np() ) { // if not main thread 
     92                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     93                [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
     94                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     95        } else [self performSelector:@selector( _destroying )]; 
     96         
    8797        NSError *ferror = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]; 
    8898        NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:@"The file %@ could not be opened, please make sure you have read permissions for this file.", NSLocalizedDescriptionKey, ferror, @"NSUnderlyingErrorKey", nil]; 
     
    95105        if( ! self ) return; 
    96106 
    97         [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
    98         [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
    99         [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     107        if( ! pthread_main_np() ) { // if not main thread 
     108                [MVIRCChatConnectionThreadLock unlock]; // prevents a deadlock, since waitUntilDone is required. threads synced 
     109                [self performSelectorOnMainThread:@selector( _destroying ) withObject:nil waitUntilDone:YES]; 
     110                [MVIRCChatConnectionThreadLock lock]; // lock back up like nothing happened 
     111        } else [self performSelector:@selector( _destroying )]; 
    100112 
    101113        NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:@"The file %@ is already being offerend to %@.", NSLocalizedDescriptionKey, nil]; 
     
    106118#pragma mark - 
    107119 
     120static BOOL fileTransferSignalsRegistered = NO; 
     121 
    108122@implementation MVFileTransfer (MVIRCFileTransferPrivate) 
    109123+ (id) _transferForDCCFileRecord:(FILE_DCC_REC *) record { 
     
    122136+ (void) initialize { 
    123137        [super initialize]; 
    124         static BOOL tooLate = NO; 
    125         if( ! tooLate ) { 
     138        if( ! fileTransferSignalsRegistered ) { 
    126139                [MVIRCChatConnectionThreadLock lock]; 
    127140                signal_add_last( "dcc connected", (SIGNAL_FUNC) MVFileTransferConnected ); 
     
    132145                signal_add_last( "dcc error send exists", (SIGNAL_FUNC) MVFileTransferErrorSendExists ); 
    133146                [MVIRCChatConnectionThreadLock unlock]; 
    134                 tooLate = YES; 
     147                fileTransferSignalsRegistered = YES; 
    135148        } 
    136149} 
     
    329342        static BOOL tooLate = NO; 
    330343        if( ! tooLate ) { 
     344                [MVIRCChatConnectionThreadLock lock]; 
     345                signal_add_last( "dcc get receive", (SIGNAL_FUNC) MVIRCDownloadFileTransferSpecifyPath ); 
     346                [MVIRCChatConnectionThreadLock unlock]; 
     347                tooLate = YES; 
     348        } 
     349 
     350        if( ! fileTransferSignalsRegistered ) { 
    331351                [MVIRCChatConnectionThreadLock lock]; 
    332352                signal_add_last( "dcc connected", (SIGNAL_FUNC) MVFileTransferConnected ); 
     
    336356                signal_add_last( "dcc error file open", (SIGNAL_FUNC) MVFileTransferErrorFileOpen ); 
    337357                signal_add_last( "dcc error send exists", (SIGNAL_FUNC) MVFileTransferErrorSendExists ); 
    338                 signal_add_last( "dcc get receive", (SIGNAL_FUNC) MVIRCDownloadFileTransferSpecifyPath ); 
    339358                [MVIRCChatConnectionThreadLock unlock]; 
    340                 tooLate = YES; 
     359                fileTransferSignalsRegistered = YES; 
    341360        } 
    342361} 
  • branches/overhaul/Plug-Ins/Standard Commands/JVStandardCommands.m

    r2020 r2161  
    5555                if( ! [command caseInsensitiveCompare:@"me"] || ! [command caseInsensitiveCompare:@"action"] || ! [command caseInsensitiveCompare:@"say"] ) { 
    5656                        if( [arguments length] ) { 
    57                                 BOOL action = ( ! [command caseInsensitiveCompare:@"me"] || ! [command caseInsensitiveCompare:@"action"] ); 
    58                                 [chat echoSentMessageToDisplay:arguments asAction:action]; 
    59                                 if( isChatRoom ) [[room target] sendMessage:arguments asAction:action]; 
    60                                 else [[chat target] sendMessage:arguments withEncoding:[chat encoding] asAction:action]; 
    61                         } 
    62                         return YES; 
    63                 } else if( [[command substringToIndex:1] isEqualToString:@"/"] ) { 
    64                         NSMutableAttributedString *line = [[[NSMutableAttributedString alloc] init] autorelease]; 
    65                         if( [command length] > 1 ) [line replaceCharactersInRange:NSMakeRange( 0, 0 ) withString:command]; 
    66                         if( [arguments length] ) { 
    67                                 [line replaceCharactersInRange:NSMakeRange( [line length], 0 ) withString:@" "]; 
    68                                 [line appendAttributedString:arguments]; 
    69                         } 
    70                         if( [line length] ) { 
    71                                 [chat echoSentMessageToDisplay:line asAction:NO]; 
    72                                 if( isChatRoom ) [[room target] sendMessage:line asAction:NO]; 
    73                                 else [[chat target] sendMessage:line withEncoding:[chat encoding] asAction:NO]; 
     57                                if( ! [command caseInsensitiveCompare:@"me"] || ! [command caseInsensitiveCompare:@"action"] ) { 
     58                                        // This is so plugins can process /me actions as well 
     59                                        // We're avoiding /say for now, as that really should just output exactly what 
     60                                        // the input was so we should still bypass plugins for /say 
     61                                        JVMutableChatMessage *message = [[[NSClassFromString( @"JVMutableChatMessage" ) alloc] initWithText:arguments sender:[[chat connection] nickname] andTranscript:chat] autorelease]; 
     62                                        [message setAction:YES]; 
     63                                        [chat sendMessage:message]; 
     64                                        [chat echoSentMessageToDisplay:[message body] asAction:YES]; 
     65                                } else { 
     66                                        [chat echoSentMessageToDisplay:arguments asAction:NO]; 
     67                                        if( isChatRoom ) [[room target] sendMessage:arguments asAction:NO]; 
     68                                        else [[chat target] sendMessage:arguments withEncoding:[chat encoding] asAction:NO]; 
     69                                } 
    7470                        } 
    7571                        return YES; 
     
    592588        } 
    593589 
    594         if( offset < [argsArray count]
     590        if( offset < [argsArray count] && [(NSString *)[argsArray objectAtIndex:offset] length]
    595591                rooms = [argsArray subarrayWithRange:NSMakeRange( offset, [argsArray count] - offset )]; 
    596592 
  • branches/overhaul/Resources/Changes.rtf

    r1954 r2161  
    1414 
    1515\f2\b0\fs20 \cf0 \'b7 
     16\f3  Can't join channels that require a key with the GUI. A workaround is to use this command "/join #room password" for the room.\ 
     17 
     18\f2 \'b7 
    1619\f3  SOCKS and HTTP proxies don't function still.\ 
    1720\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     
    2124\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    2225 
    23 \fs20 \cf0 Build 2C11  
    24 \f3\b0 (October, 2004) \'d1 
    25 \f1\b\fs28 \ 
    26 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    27  
    28 \f2\b0\fs20 \cf0 \'b7 
    29 \f3  Rewrite of most of the legacy code.\ 
    30  
    31 \f2 \'b7 
    32 \f3  Support for the Quieted mode for servers that support it, SILC also supports it.\ 
    33  
    34 \f2 \'b7 
    35 \f3  Joining chat rooms with a password is now supported.\ 
    36  
    37 \f2 \'b7 
    38 \f3  Kicks that you perform on another user can have colors and text formatting, and will use the room's encoding.\ 
     26\fs20 \cf0 Build 2C12  
     27\f3\b0 (November, 2004) \'d1 
     28\f1\b\fs28 \ 
     29\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     30 
     31\f2\b0\fs20 \cf0 \'b7 
     32\f3\fs24   
     33\fs20 Fixed a crash that occurred sometimes when changing away status and when members parted a room with a malformed part reason.\ 
     34 
     35\f2 \'b7 
     36\f3\fs24   
     37\fs20 Fixed a few reported exception errors.\ 
     38 
     39\f2 \'b7 
     40\f3  Added the German (Deutsch) localization by Alexander Kempgen.\ 
     41 
     42\f2 \'b7 
     43\f3  Fixed the appearance of the Direct Chat panel where it meets the tab bar. There is now a divider line like Chat Rooms.\ 
     44 
     45\f2 \'b7 
     46\f3  Enabled the Send File context menu for private chat panels.\ 
     47 
     48\f2 \'b7 
     49\f3\fs24   
     50\fs20 Dragging files to private chat tabs will transfer the files to that user.\ 
     51\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     52 
     53\f1\b \cf0 \ 
     54Build 2C11  
     55\f3\b0 (November 9, 2004) \'d1 
     56\f1\b\fs28 \ 
     57\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     58 
     59\f2\b0\fs20 \cf0 \'b7 
     60\f3  All DCC file transfer crashes fixed, thank you for submiting your crash reports!\ 
     61 
     62\f2 \'b7 
     63\f3  Plugins and script plugins can now add contextual menu items to any GUI element in Colloquy that has an existing contextual menu.\ 
     64 
     65\f2 \'b7 
     66\f3  Updated iTunes script that has the option to show a progress bar, current and duration time and save the preferences. To see all the preference keys, type:  
     67\f4\fs18 \cf4 \CocoaLigature0 /itunes prefs  
     68\f3\fs20 \cf0 \CocoaLigature1 To toggle a preference, type:  
     69\f4\fs18 \cf4 \CocoaLigature0 /itunes prefs <key> [on|off] 
     70\f3\fs20 \cf0 \CocoaLigature1 \ 
     71 
     72\f2 \'b7 
     73\f3  Added a multi-search script that lets you search any of 11 search engines from Yahoo!, Google, ADC, VersionTracker, PHP, Google Image Search and more. For a list of all the commands type:  
     74\f4\fs18 \cf4 \CocoaLigature0 /search help 
     75\f3\fs20 \cf0 \CocoaLigature1 \ 
    3976\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    4077 
    4178\f1\b \cf0 \ 
    4279Build 2C10  
    43 \f3\b0 (September, 2004) \'d1 
    44 \f1\b\fs28 \ 
    45 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    46  
    47 \f2\b0\fs20 \cf0 \'b7 
     80\f3\b0 (October 21, 2004) \'d1 
     81\f1\b\fs28 \ 
     82\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     83 
     84\f2\b0\fs20 \cf0 \'b7 
     85\f3  Some DCC file transfer crashes fixed.\ 
     86 
     87\f2 \'b7 
    4888\f3  The SILC protocol is now supported right along side existing IRC connections. For more information about SILC visit http://silcnet.org.\ 
    4989 
     
    75115\f1\b \cf0 \ 
    76116Build 2C9  
    77 \f3\b0 (August, 2004) \'d1 
     117\f3\b0 (August & September, 2004) \'d1 
    78118\f1\b\fs28 \ 
    79119\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
     
    861901\f2 \'b7 
    862902\f3  Some perferences will not carry over from version 1.\ 
    863 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    864  
    865 \f2 \cf0  \'b7 
     903 
     904\f2  \'b7 
    866905\f3  No longer crashes when you don't have an outside internet connection and/or the host-name can't be resolved.\ 
    867906  
     
    924963\f2 \'b7 
    925964\f3  Windows that are miniaturized into the Dock will not keep popping out when either "Show hidden \'c9 on \'c9 activity" preferences are on.\ 
    926 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    927  
    928 \f2 \cf0  \'b7 
     965 
     966\f2  \'b7 
    929967\f3  All windows remember their position on screen better, and chat windows remember the member drawer size and state.\ 
    930968 
     
    957995\f5\i /itunes 
    958996\f3\i0  in a room to test the basic iTunes plugin.\ 
    959 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    960  
    961 \f2 \cf0  \'b7 
     997 
     998\f2  \'b7 
    962999\f3  Added the French localization.\ 
    9631000  
     
    10101047\f2 \'b7 
    10111048\f3  NickServ password authorization enabled with password prompts and saving passwords in your keychain.\ 
    1012 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    1013  
    1014 \f2 \cf0  \'b7 
     1049 
     1050\f2  \'b7 
    10151051\f3  Connections are stored different now, old bookmarks will not load and may show up as blank lines in the connection manager.\ 
    10161052  
     
    11111147\f2 \'b7 
    11121148\f3  IRC URLs are now handled from the system and internally in chat dialog (was only rooms before, now allows new server connections). Here is an example URL that will connect to 'javelin.cc' as user 'test' on port '6669' and will join the room 'colloquy' when connected: \ul irc://test@javelin.cc:6669/#colloquy\ulnone . Note that only the scheme and host part of the URL need to be present. Valid room paths a begin with '#', '&' or '+'; if the path of the URL is not a valid room then a new message to that user is made. Mozilla's Chatzilla handles IRC URLs in this manner also.\ 
    1113 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    1114  
    1115 \f2 \cf0  \'b7 
     1149 
     1150\f2  \'b7 
    11161151\f3  Nickname changes were not being reported due to a Firetalk API change \'d1 now fixed.\ 
    11171152  
     
    11441179\f3\b0 (Wednesday November 13, 2002) \'d1 
    11451180\f1\b\fs28 \ 
    1146 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 
    1147  
    1148 \f3\b0\fs20 \cf0   
     1181 
     1182\f3\b0\fs20   
    11491183\f2 \'b7 
    11501184\f3  Enabled the Software Update check.\ 
  • branches/overhaul/Resources/Info.plist

    r1953 r2161  
    5858                        </array> 
    5959                        <key>CFBundleTypeName</key> 
    60                         <string>Chat transcript</string> 
     60                        <string>Chat Transcript</string> 
    6161                        <key>CFBundleTypeOSTypes</key> 
    6262                        <array> 
     
    6565                        <key>CFBundleTypeRole</key> 
    6666                        <string>Viewer</string> 
     67                </dict> 
     68        </array> 
     69        <key>UTExportedTypeDeclarations</key> 
     70        <array> 
     71                <dict> 
     72                        <key>UTTypeIdentifier</key> 
     73                        <string>cc.javelin.colloquy.colloquystyle</string> 
     74                        <key>UTTypeReferenceURL</key> 
     75                        <string>http://www.colloquy.info/</string> 
     76                        <key>UTTypeDescription</key> 
     77                        <string>Colloquy View Style</string> 
     78                        <key>UTTypeIconName</key> 
     79                        <string>Generic.icns</string> 
     80                        <key>UTTypeConformsTo</key> 
     81                        <array> 
     82                                <string>public.bundle</string> 
     83                        </array> 
     84                        <key>UTTypeTagSpecification</key> 
     85                        <dict> 
     86                                <key>com.apple.ostype</key> 
     87                                <string>coSt</string> 
     88                                <key>public.filename-extension</key> 
     89                                <array> 
     90                                        <string>colloquyStyle</string> 
     91                                        <string>colloquystyle</string> 
     92                                </array> 
     93                                <key>public.mime-type</key> 
     94                                <string>application/data</string> 
     95                        </dict> 
     96                </dict> 
     97                <dict> 
     98                        <key>UTTypeIdentifier</key> 
     99                        <string>cc.javelin.colloquy.colloquyemoticons</string> 
     100                        <key>UTTypeReferenceURL</key> 
     101                        <string>http://www.colloquy.info/</string> 
     102                        <key>UTTypeDescription</key> 
     103                        <string>Colloquy Emoticon Set</string> 
     104                        <key>UTTypeIconName</key> 
     105                        <string>Generic.icns</string> 
     106                        <key>UTTypeConformsTo</key>