Frameworks/Adium Framework/Source/AIStatusControllerProtocol.h
author Frank Dowsett <wixardy@adium.im>
Sun Feb 05 20:13:17 2012 -0500 (2 days ago)
branchPreferencesRedux
changeset 4670 16d2f6ca66d1
parent 1505 7381a793a78a
permissions -rw-r--r--
Update the XMPP logo and change the name from "Jabber" to "XMPP". Fixes #10375
     1 /* 
     2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
     3  * with this source distribution.
     4  * 
     5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
     6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
     7  * or (at your option) any later version.
     8  * 
     9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
    10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
    11  * Public License for more details.
    12  * 
    13  * You should have received a copy of the GNU General Public License along with this program; if not,
    14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    15  */
    16 
    17 #import <Adium/AIControllerProtocol.h>
    18 #import <Adium/AIStatusDefines.h>
    19 
    20 @class AIStatus, AIAccount, AIStatusGroup, AIService;
    21 
    22 //Status State Notifications
    23 #define AIStatusStateArrayChangedNotification	@"AIStatusStateArrayChangedNotification"
    24 #define AIStatusActiveStateChangedNotification	@"AIStatusActiveStateChangedNotification"
    25 
    26 //Idle Notifications
    27 #define AIMachineIsIdleNotification				@"AIMachineIsIdleNotification"
    28 #define AIMachineIsActiveNotification			@"AIMachineIsActiveNotification"
    29 #define AIMachineIdleUpdateNotification			@"AIMachineIdleUpdateNotification"
    30 
    31 //Preferences
    32 #define PREF_GROUP_SAVED_STATUS					@"Saved Status"
    33 #define KEY_SAVED_STATUS						@"Saved Status Array"
    34 
    35 #define KEY_STATUS_NAME							@"Status Name"
    36 #define KEY_STATUS_DESCRIPTION					@"Status Description"
    37 #define	KEY_STATUS_TYPE							@"Status Type"
    38 
    39 #define PREF_GROUP_STATUS_PREFERENCES			@"Status Preferences"
    40 #define KEY_STATUS_CONVERSATION_COUNT			@"Unread Conversations"
    41 #define KEY_STATUS_MENTION_COUNT				@"Unread Mentions"
    42 #define KEY_STATUS_REPORT_IDLE					@"Report Idle"
    43 #define KEY_STATUS_REPORT_IDLE_INTERVAL			@"Report Idle Interval"
    44 #define	KEY_STATUS_AUTO_AWAY					@"Auto Away"
    45 #define KEY_STATUS_AUTO_AWAY_STATUS_STATE_ID	@"Auto Away Status State ID"
    46 #define KEY_STATUS_FUS							@"Fast User Switching Auto Away"
    47 #define KEY_STATUS_FUS_STATUS_STATE_ID			@"Fast User Switching Status State ID"
    48 #define KEY_STATUS_SS							@"ScreenSaver Auto Away"
    49 #define KEY_STATUS_SS_STATUS_STATE_ID			@"ScreenSaver Status State ID"
    50 #define KEY_STATUS_AUTO_AWAY_INTERVAL			@"Auto Away Interval"
    51 
    52 #define KEY_STATUS_SHOW_STATUS_WINDOW				@"Show Status Window"
    53 #define KEY_STATUS_STATUS_WINDOW_ON_TOP				@"Status Window Always On Top"
    54 #define KEY_STATUS_STATUS_WINDOW_HIDE_IN_BACKGROUND	@"Status Window Hide in Background"
    55 
    56 //Built-in names and descriptions, which services should use when they support identical or approximately identical states
    57 #define	STATUS_NAME_AVAILABLE				@"Generic Available"
    58 #define STATUS_NAME_FREE_FOR_CHAT			@"Free for Chat"
    59 #define STATUS_NAME_AVAILABLE_FRIENDS_ONLY	@"Available for Friends Only"
    60 
    61 #define	STATUS_NAME_AWAY					@"Generic Away"
    62 #define STATUS_NAME_EXTENDED_AWAY			@"Extended Away"
    63 #define STATUS_NAME_AWAY_FRIENDS_ONLY		@"Away for Friends Only"
    64 #define STATUS_NAME_DND						@"DND"
    65 #define STATUS_NAME_NOT_AVAILABLE			@"Not Available"
    66 #define STATUS_NAME_OCCUPIED				@"Occupied"
    67 #define STATUS_NAME_BRB						@"BRB"
    68 #define STATUS_NAME_BUSY					@"Busy"
    69 #define STATUS_NAME_PHONE					@"Phone"
    70 #define STATUS_NAME_LUNCH					@"Lunch"
    71 #define STATUS_NAME_NOT_AT_HOME				@"Not At Home"
    72 #define STATUS_NAME_NOT_AT_DESK				@"Not At Desk"
    73 #define STATUS_NAME_NOT_IN_OFFICE			@"Not In Office"
    74 #define STATUS_NAME_VACATION				@"Vacation"
    75 #define STATUS_NAME_STEPPED_OUT				@"Stepped Out"
    76 
    77 #define STATUS_NAME_INVISIBLE				@"Invisible"
    78 
    79 #define STATUS_NAME_OFFLINE					@"Offline"
    80 
    81 //Current version state ID string
    82 #define STATE_SAVED_STATE					@"State"
    83 
    84 @protocol AIStatusController <AIController>
    85 /*!
    86  * @brief Register a status for a service
    87  *
    88  * Implementation note: Each AIStatusType has its own NSMutableDictionary, statusDictsByServiceCodeUniqueID.
    89  * statusDictsByServiceCodeUniqueID is keyed by serviceCodeUniqueID; each object is an NSMutableSet of NSDictionaries.
    90  * Each of these dictionaries has KEY_STATUS_NAME, KEY_STATUS_DESCRIPTION, and KEY_STATUS_TYPE.
    91  *
    92  * @param statusName A name which will be passed back to accounts of this service.  Internal use only.  Use the AIStatusController.h \#defines where appropriate.
    93  * @param description A human-readable localized description which will be shown to the user.  Use the AIStatusController.h \#defines where appropriate.
    94  * @param type An AIStatusType, the general type of this status.
    95  * @param service The AIService for which to register the status
    96  */
    97 - (void)registerStatus:(NSString *)statusName
    98 	   withDescription:(NSString *)description
    99 				ofType:(AIStatusType)type 
   100 			forService:(AIService *)service;
   101 /*!
   102  * @brief Generate and return a menu of status types (Away, Be right back, etc.)
   103  *
   104  * @param service The service for which to return a specific list of types, or nil to return all available types
   105  * @param target The target for the menu items, which will have an action of \@selector(selectStatus:)
   106  *
   107  * @result The menu of statuses, separated by available and away status types
   108  */
   109 - (NSMenu *)menuOfStatusesForService:(AIService *)service withTarget:(id)target;
   110 
   111 @property (readonly, nonatomic) NSSet *flatStatusSet;
   112 @property (readonly, nonatomic) NSArray *sortedFullStateArray;
   113 @property (readonly, nonatomic) AIStatus *offlineStatusState;
   114 @property (readonly, nonatomic) AIStatus *availableStatus;
   115 @property (readonly, nonatomic) AIStatus *awayStatus;
   116 @property (readonly, nonatomic) AIStatus *invisibleStatus;
   117 @property (readonly, nonatomic) AIStatus *offlineStatus;
   118 - (AIStatus *)statusStateWithUniqueStatusID:(NSNumber *)uniqueStatusID;
   119 
   120 - (void)setActiveStatusState:(AIStatus *)state;
   121 - (void)setActiveStatusState:(AIStatus *)state forAccount:(AIAccount *)account;
   122 - (void)setDelayStatusMenuRebuilding:(BOOL)shouldDelay;
   123 - (void)applyState:(AIStatus *)statusState toAccounts:(NSArray *)accountArray;
   124 @property (readonly, nonatomic) AIStatus *activeStatusState;
   125 - (NSSet *)allActiveStatusStates;
   126 - (AIStatusType)activeStatusTypeTreatingInvisibleAsAway:(BOOL)invisibleIsAway;
   127 - (NSSet *)activeUnavailableStatusesAndType:(AIStatusType *)activeUnvailableStatusType 
   128 								   withName:(NSString **)activeUnvailableStatusName
   129 			 allOnlineAccountsAreUnvailable:(BOOL *)allOnlineAccountsAreUnvailable;
   130 - (AIStatus *)defaultInitialStatusState;
   131 
   132 - (NSString *)descriptionForStateOfStatus:(AIStatus *)statusState;
   133 - (NSString *)localizedDescriptionForCoreStatusName:(NSString *)statusName;
   134 - (NSString *)localizedDescriptionForStatusName:(NSString *)statusName statusType:(AIStatusType)statusType;
   135 - (NSString *)defaultStatusNameForType:(AIStatusType)statusType;
   136 
   137 //State Editing
   138 - (void)addStatusState:(AIStatus *)state;
   139 - (void)removeStatusState:(AIStatus *)state;
   140 - (void)statusStateDidSetUniqueStatusID;
   141 
   142 //State menu support
   143 - (void)setDelayActiveStatusUpdates:(BOOL)shouldDelay;
   144 - (BOOL)removeIfNecessaryTemporaryStatusState:(AIStatus *)originalState;
   145 - (AIStatusGroup *)rootStateGroup;
   146 
   147 - (void)savedStatusesChanged;
   148 - (void)statusStateDidSetUniqueStatusID;
   149 @end