Adium

Changeset 24353

Show
Ignore:
Timestamp:
07/15/2008 03:22:24 AM (6 months ago)
Author:
catfish_man
Message:

Patch from neohaven that fixes #9701. Thanks :)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Nudge and Buzz Handler/AINudgeBuzzHandlerPlugin.h

    r20090 r24353  
    1717#import <Adium/AIPlugin.h> 
    1818#import <Adium/AIContactAlertsControllerProtocol.h> 
     19#import <Adium/AIContentControllerProtocol.h> 
    1920 
    2021#define Chat_NudgeBuzzOccured           @"Chat_NudgeBuzzOccured" 
    2122 
    22 @interface AINudgeBuzzHandlerPlugin : AIPlugin <AIEventHandler> { 
     23@interface AINudgeBuzzHandlerPlugin : AIPlugin <AIEventHandler, AIContentFilter> { 
    2324        NSMenuItem                      *notifyMenuItem; 
    2425        NSMenuItem                      *notifyContextualMenuItem; 
  • trunk/Plugins/Nudge and Buzz Handler/AINudgeBuzzHandlerPlugin.m

    r21148 r24353  
    7575                                                                           name:Chat_NudgeBuzzOccured 
    7676                                                                         object:nil]; 
     77         
     78        // Register with AIContentController to recieve the AIContentFilter calls. 
     79        [[adium contentController] registerContentFilter:self  
     80                                                                                          ofType:AIFilterContent 
     81                                                                                   direction:AIFilterOutgoing]; 
    7782         
    7883        // Create the menu item. 
     
    224229#pragma mark Nudge/Buzz Handling 
    225230 
     231- (NSAttributedString *)filterAttributedString:(NSAttributedString *)inAttributedString context:(id)context 
     232{ 
     233        if ([context isKindOfClass:[AIContentMessage class]]) 
     234        { 
     235                if ([[context destination] isKindOfClass:[AIListObject class]]) 
     236                { 
     237                        if ([[inAttributedString string] rangeOfString:@"/nudge"].location == 0) 
     238                        { 
     239                                [self sendNotification:[context destination]]; 
     240                                return nil; 
     241                        } 
     242                } 
     243        } 
     244                 
     245        return inAttributedString; 
     246} 
     247 
     248- (float) filterPriority 
     249{ 
     250                return DEFAULT_FILTER_PRIORITY; 
     251} 
     252 
    226253- (void)sendNotification:(AIListObject *)object 
    227254{