Adium

Changeset 23857

Show
Ignore:
Timestamp:
06/08/2008 07:26:53 PM (6 months ago)
Author:
zacw
Message:

Move the chat-opening psychic stuff over to the account to deal with the opening, reducing the preference reading, and making it a bit more readable overall. Refs #8112.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Purple Service/adiumPurpleSignals.m

    r23856 r23857  
    1616 
    1717#import "adiumPurpleSignals.h" 
    18 #import "AIDualWindowInterfacePlugin.h" 
    1918#import <AIUtilities/AIObjectAdditions.h> 
    2019#import <AIUtilities/AIAttributedStringAdditions.h> 
    21 #import <Adium/AIPreferenceControllerProtocol.h> 
    2220#import <Adium/AIChatControllerProtocol.h> 
    23 #import <Adium/AIInterfaceControllerProtocol.h> 
    24 #import <Adium/AIContentControllerProtocol.h> 
    2521#import <Adium/AIChat.h> 
    2622#import <Adium/AIListContact.h> 
     
    284280        AIChat *chat = [[[AIObject sharedAdiumInstance] chatController] chatWithContact:contact]; 
    285281 
    286         if ((typingState == AITyping) &&  
    287                 ([[[[AIObject sharedAdiumInstance] preferenceController] preferenceForKey:KEY_PSYCHIC 
    288                                                                                                                                                    group:PREF_GROUP_DUAL_WINDOW_INTERFACE] boolValue]) && 
    289                 (![chat isOpen])) { 
    290                  
    291                 [[[AIObject sharedAdiumInstance] interfaceController] openChat:chat]; 
    292          
    293                 /* 
    294                  * Use the Libpurple "psychic" tagline. If this is found to be confusing, we should switch to your own version. 
    295                  * The upside of using theirs is that clever gimmicky translations already exist. 
    296                  */ 
    297                 AIContentStatus *statusMessage = [AIContentStatus statusInChat:chat 
    298                                                                                                                         withSource:contact 
    299                                                                                                                    destination:account 
    300                                                                                                                                   date:[NSDate date] 
    301                                                                                                                            message:[NSAttributedString stringWithString:[NSString stringWithUTF8String:_("You feel a disturbance in the force...")]] 
    302                                                                                                                           withType:@"psychic"]; 
    303                  
    304                 [[[AIObject sharedAdiumInstance] contentController] receiveContentObject:statusMessage]; 
    305         } 
    306          
    307282        [account typingUpdateForIMChat:chat typing:[NSNumber numberWithInt:typingState]]; 
    308283} 
  • trunk/Plugins/Purple Service/CBPurpleAccount.h

    r23692 r23857  
    4141        BOOL                            deletePurpleAccountAfterDisconnecting; 
    4242        BOOL                            finishedConnectProcess; 
     43        BOOL                            openPsychicChats; 
    4344 
    4445        PurpleConnectionError lastDisconnectionReason; 
  • trunk/Plugins/Purple Service/CBPurpleAccount.m

    r23742 r23857  
    4242#import <Adium/AIStatusControllerProtocol.h> 
    4343#import <Adium/AIPreferenceControllerProtocol.h> 
     44#import <Adium/AIContentStatus.h> 
    4445#import <AIUtilities/AIAttributedStringAdditions.h> 
    4546#import <AIUtilities/AIDictionaryAdditions.h> 
     
    5657#import "AMPurpleTuneTooltip.h" 
    5758#import "adiumPurpleRequest.h" 
     59#import "AIDualWindowInterfacePlugin.h" 
    5860 
    5961#import "ESMSNService.h" //why oh why must the superclass know about MSN specific things!? 
     
    26882690        //Observe preferences changes 
    26892691        [[adium preferenceController] registerPreferenceObserver:self forGroup:PREF_GROUP_ALIASES]; 
     2692        [[adium preferenceController] registerPreferenceObserver:self forGroup:PREF_GROUP_DUAL_WINDOW_INTERFACE]; 
    26902693} 
    26912694 
     
    28622865                } 
    28632866        } 
     2867         
     2868        if ([group isEqualToString:PREF_GROUP_DUAL_WINDOW_INTERFACE]) { 
     2869                openPsychicChats = [[prefDict objectForKey:KEY_PSYCHIC] boolValue]; 
     2870        } 
    28642871} 
    28652872 
     
    29412948    AITypingState currentTypingState = [chat integerValueForProperty:KEY_TYPING]; 
    29422949        AITypingState newTypingState = [typingStateNumber intValue]; 
    2943  
     2950         
    29442951    if (currentTypingState != newTypingState) { 
     2952                if (newTypingState == AITyping && openPsychicChats && ![chat isOpen]) { 
     2953                        [[adium interfaceController] openChat:chat]; 
     2954                         
     2955                        /* 
     2956                         * Use the Libpurple "psychic" tagline. If this is found to be confusing, we should switch to your own version. 
     2957                         * The upside of using theirs is that clever gimmicky translations already exist. 
     2958                         */ 
     2959                        AIContentStatus *statusMessage = [AIContentStatus statusInChat:chat 
     2960                                                                                                                                withSource:[chat listObject] 
     2961                                                                                                                           destination:self 
     2962                                                                                                                                          date:[NSDate date] 
     2963                                                                                                                                   message:[NSAttributedString stringWithString:[NSString stringWithUTF8String:_("You feel a disturbance in the force...")]] 
     2964                                                                                                                                  withType:@"psychic"]; 
     2965                         
     2966                        [[adium contentController] receiveContentObject:statusMessage]; 
     2967                } 
     2968                 
    29452969                [chat setValue:(newTypingState ? typingStateNumber : nil) 
    29462970                                           forProperty:KEY_TYPING