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