Frameworks/Adium Framework/Source/AIStatusControllerProtocol.h
author Zachary West <zacw@adiumx.com>
Sat Apr 04 03:00:11 2009 +0000 (2009-04-04)
changeset 1505 7381a793a78a
parent 557 7dc4ecb4d8e5
child 3679 f4294bb53b0f
permissions -rw-r--r--
Add an advanced status preference to "only count number of unread mentions for group chats", which causes the chat controller to only count group chats' mentions for the overall unread counts (status item, dock badger). Fixes #11850.

P.S. Keypaths cannot contain spaces, what a worthless error.
     1 /*
     2  *  AIStatusControllerProtocol.h
     3  *  Adium
     4  *
     5  *  Created by Evan Schoenberg on 7/31/06.
     6  *  Copyright 2006 The Adium Team. All rights reserved.
     7  *
     8  */
     9 
    10 #import <Adium/AIControllerProtocol.h>
    11 #import <Adium/AIStatusDefines.h>
    12 
    13 @class AIStatus, AIAccount, AIStatusGroup, AIService;
    14 
    15 //Status State Notifications
    16 #define AIStatusStateArrayChangedNotification	@"AIStatusStateArrayChangedNotification"
    17 #define AIStatusActiveStateChangedNotification	@"AIStatusActiveStateChangedNotification"
    18 
    19 //Idle Notifications
    20 #define AIMachineIsIdleNotification				@"AIMachineIsIdleNotification"
    21 #define AIMachineIsActiveNotification			@"AIMachineIsActiveNotification"
    22 #define AIMachineIdleUpdateNotification			@"AIMachineIdleUpdateNotification"
    23 
    24 //Preferences
    25 #define PREF_GROUP_SAVED_STATUS					@"Saved Status"
    26 #define KEY_SAVED_STATUS						@"Saved Status Array"
    27 
    28 #define KEY_STATUS_NAME							@"Status Name"
    29 #define KEY_STATUS_DESCRIPTION					@"Status Description"
    30 #define	KEY_STATUS_TYPE							@"Status Type"
    31 
    32 #define PREF_GROUP_STATUS_PREFERENCES			@"Status Preferences"
    33 #define KEY_STATUS_CONVERSATION_COUNT			@"Unread Conversations"
    34 #define KEY_STATUS_MENTION_COUNT				@"Unread Mentions"
    35 #define KEY_STATUS_REPORT_IDLE					@"Report Idle"
    36 #define KEY_STATUS_REPORT_IDLE_INTERVAL			@"Report Idle Interval"
    37 #define	KEY_STATUS_AUTO_AWAY					@"Auto Away"
    38 #define KEY_STATUS_AUTO_AWAY_STATUS_STATE_ID	@"Auto Away Status State ID"
    39 #define KEY_STATUS_FUS							@"Fast User Switching Auto Away"
    40 #define KEY_STATUS_FUS_STATUS_STATE_ID			@"Fast User Switching Status State ID"
    41 #define KEY_STATUS_SS							@"ScreenSaver Auto Away"
    42 #define KEY_STATUS_SS_STATUS_STATE_ID			@"ScreenSaver Status State ID"
    43 #define KEY_STATUS_AUTO_AWAY_INTERVAL			@"Auto Away Interval"
    44 
    45 #define KEY_STATUS_SHOW_STATUS_WINDOW				@"Show Status Window"
    46 #define KEY_STATUS_STATUS_WINDOW_ON_TOP				@"Status Window Always On Top"
    47 #define KEY_STATUS_STATUS_WINDOW_HIDE_IN_BACKGROUND	@"Status Window Hide in Background"
    48 
    49 //Built-in names and descriptions, which services should use when they support identical or approximately identical states
    50 #define	STATUS_NAME_AVAILABLE				@"Generic Available"
    51 #define STATUS_NAME_FREE_FOR_CHAT			@"Free for Chat"
    52 #define STATUS_NAME_AVAILABLE_FRIENDS_ONLY	@"Available for Friends Only"
    53 
    54 #define	STATUS_NAME_AWAY					@"Generic Away"
    55 #define STATUS_NAME_EXTENDED_AWAY			@"Extended Away"
    56 #define STATUS_NAME_AWAY_FRIENDS_ONLY		@"Away for Friends Only"
    57 #define STATUS_NAME_DND						@"DND"
    58 #define STATUS_NAME_NOT_AVAILABLE			@"Not Available"
    59 #define STATUS_NAME_OCCUPIED				@"Occupied"
    60 #define STATUS_NAME_BRB						@"BRB"
    61 #define STATUS_NAME_BUSY					@"Busy"
    62 #define STATUS_NAME_PHONE					@"Phone"
    63 #define STATUS_NAME_LUNCH					@"Lunch"
    64 #define STATUS_NAME_NOT_AT_HOME				@"Not At Home"
    65 #define STATUS_NAME_NOT_AT_DESK				@"Not At Desk"
    66 #define STATUS_NAME_NOT_IN_OFFICE			@"Not In Office"
    67 #define STATUS_NAME_VACATION				@"Vacation"
    68 #define STATUS_NAME_STEPPED_OUT				@"Stepped Out"
    69 
    70 #define STATUS_NAME_INVISIBLE				@"Invisible"
    71 
    72 #define STATUS_NAME_OFFLINE					@"Offline"
    73 
    74 //Current version state ID string
    75 #define STATE_SAVED_STATE					@"State"
    76 
    77 @protocol AIStatusController <AIController>
    78 /*!
    79  * @brief Register a status for a service
    80  *
    81  * Implementation note: Each AIStatusType has its own NSMutableDictionary, statusDictsByServiceCodeUniqueID.
    82  * statusDictsByServiceCodeUniqueID is keyed by serviceCodeUniqueID; each object is an NSMutableSet of NSDictionaries.
    83  * Each of these dictionaries has KEY_STATUS_NAME, KEY_STATUS_DESCRIPTION, and KEY_STATUS_TYPE.
    84  *
    85  * @param statusName A name which will be passed back to accounts of this service.  Internal use only.  Use the AIStatusController.h \#defines where appropriate.
    86  * @param description A human-readable localized description which will be shown to the user.  Use the AIStatusController.h \#defines where appropriate.
    87  * @param type An AIStatusType, the general type of this status.
    88  * @param service The AIService for which to register the status
    89  */
    90 - (void)registerStatus:(NSString *)statusName
    91 	   withDescription:(NSString *)description
    92 				ofType:(AIStatusType)type 
    93 			forService:(AIService *)service;
    94 /*!
    95  * @brief Generate and return a menu of status types (Away, Be right back, etc.)
    96  *
    97  * @param service The service for which to return a specific list of types, or nil to return all available types
    98  * @param target The target for the menu items, which will have an action of \@selector(selectStatus:)
    99  *
   100  * @result The menu of statuses, separated by available and away status types
   101  */
   102 - (NSMenu *)menuOfStatusesForService:(AIService *)service withTarget:(id)target;
   103 
   104 @property (readonly, nonatomic) NSSet *flatStatusSet;
   105 @property (readonly, nonatomic) NSArray *sortedFullStateArray;
   106 @property (readonly, nonatomic) AIStatus *offlineStatusState;
   107 @property (readonly, nonatomic) AIStatus *availableStatus;
   108 @property (readonly, nonatomic) AIStatus *awayStatus;
   109 @property (readonly, nonatomic) AIStatus *invisibleStatus;
   110 @property (readonly, nonatomic) AIStatus *offlineStatus;
   111 - (AIStatus *)statusStateWithUniqueStatusID:(NSNumber *)uniqueStatusID;
   112 
   113 - (void)setActiveStatusState:(AIStatus *)state;
   114 - (void)setActiveStatusState:(AIStatus *)state forAccount:(AIAccount *)account;
   115 - (void)setDelayStatusMenuRebuilding:(BOOL)shouldDelay;
   116 - (void)applyState:(AIStatus *)statusState toAccounts:(NSArray *)accountArray;
   117 @property (readonly, nonatomic) AIStatus *activeStatusState;
   118 - (NSSet *)allActiveStatusStates;
   119 - (AIStatusType)activeStatusTypeTreatingInvisibleAsAway:(BOOL)invisibleIsAway;
   120 - (NSSet *)activeUnavailableStatusesAndType:(AIStatusType *)activeUnvailableStatusType 
   121 								   withName:(NSString **)activeUnvailableStatusName
   122 			 allOnlineAccountsAreUnvailable:(BOOL *)allOnlineAccountsAreUnvailable;
   123 - (AIStatus *)defaultInitialStatusState;
   124 
   125 - (NSString *)descriptionForStateOfStatus:(AIStatus *)statusState;
   126 - (NSString *)localizedDescriptionForCoreStatusName:(NSString *)statusName;
   127 - (NSString *)localizedDescriptionForStatusName:(NSString *)statusName statusType:(AIStatusType)statusType;
   128 - (NSString *)defaultStatusNameForType:(AIStatusType)statusType;
   129 
   130 //State Editing
   131 - (void)addStatusState:(AIStatus *)state;
   132 - (void)removeStatusState:(AIStatus *)state;
   133 - (void)statusStateDidSetUniqueStatusID;
   134 
   135 //State menu support
   136 - (void)setDelayActiveStatusUpdates:(BOOL)shouldDelay;
   137 - (BOOL)removeIfNecessaryTemporaryStatusState:(AIStatus *)originalState;
   138 - (AIStatusGroup *)rootStateGroup;
   139 
   140 - (void)savedStatusesChanged;
   141 - (void)statusStateDidSetUniqueStatusID;
   142 @end