10418
|
1 /**
|
|
2 * @file savedstatuses.h Saved Status API
|
|
3 * @ingroup core
|
|
4 *
|
|
5 * gaim
|
|
6 *
|
|
7 * Gaim is the legal property of its developers, whose names are too numerous
|
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
9 * source distribution.
|
|
10 *
|
|
11 * This program is free software; you can redistribute it and/or modify
|
|
12 * it under the terms of the GNU General Public License as published by
|
|
13 * the Free Software Foundation; either version 2 of the License, or
|
|
14 * (at your option) any later version.
|
|
15 *
|
|
16 * This program is distributed in the hope that it will be useful,
|
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 * GNU General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * along with this program; if not, write to the Free Software
|
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 */
|
|
25 #ifndef _GAIM_SAVEDSTATUSES_H_
|
|
26 #define _GAIM_SAVEDSTATUSES_H_
|
|
27
|
|
28 /**
|
|
29 * Saved statuses don't really interact much with the rest of Gaim. It
|
|
30 * could really be a plugin. It's just a list of away states. When
|
|
31 * a user chooses one of the saved states, their Gaim accounts are set
|
|
32 * to the settings of that state.
|
|
33 */
|
|
34
|
11651
|
35 /*
|
|
36 * TODO: Hmm. We should probably just be saving GaimPresences. That's
|
|
37 * something we should look into once the status box gets fleshed
|
|
38 * out more.
|
|
39 */
|
|
40
|
10419
|
41 typedef struct _GaimSavedStatus GaimSavedStatus;
|
|
42 typedef struct _GaimSavedStatusSub GaimSavedStatusSub;
|
10418
|
43
|
10447
|
44 #include "status.h"
|
|
45
|
10418
|
46 /**************************************************************************/
|
|
47 /** @name Saved status subsystem */
|
|
48 /**************************************************************************/
|
|
49 /*@{*/
|
|
50
|
|
51 /**
|
|
52 * Create a new saved status. This will add the saved status to the
|
|
53 * list of saved statuses and writes the revised list to status.xml.
|
|
54 *
|
11651
|
55 * @param title The title of the saved status. This must be
|
|
56 * unique.
|
|
57 * @param type The type of saved status.
|
10418
|
58 *
|
10420
|
59 * @return The newly created saved status, or NULL if the title you
|
|
60 * used was already taken.
|
10418
|
61 */
|
10419
|
62 GaimSavedStatus *gaim_savedstatus_new(const char *title,
|
|
63 GaimStatusPrimitive type);
|
10418
|
64
|
|
65 /**
|
12056
|
66 * Set the title for the given saved status.
|
|
67 *
|
|
68 * @param status The saved status.
|
|
69 * @param title The title of the saved status.
|
|
70 */
|
|
71 void gaim_savedstatus_set_title(GaimSavedStatus *status,
|
|
72 const char *title);
|
|
73
|
|
74 /**
|
11651
|
75 * Set the type for the given saved status.
|
|
76 *
|
|
77 * @param status The saved status.
|
|
78 * @param type The type of saved status.
|
|
79 */
|
|
80 void gaim_savedstatus_set_type(GaimSavedStatus *status,
|
|
81 GaimStatusPrimitive type);
|
|
82
|
|
83 /**
|
10420
|
84 * Set the message for the given saved status.
|
|
85 *
|
|
86 * @param status The saved status.
|
|
87 * @param message The message, or NULL if you want to unset the
|
|
88 * message for this status.
|
|
89 */
|
|
90 void gaim_savedstatus_set_message(GaimSavedStatus *status,
|
|
91 const char *message);
|
|
92
|
|
93 /**
|
12056
|
94 * Set a substatus for an account in a saved status.
|
|
95 *
|
|
96 * @param status The saved status.
|
|
97 * @param account The account.
|
|
98 * @param type The status type for the account in the staved
|
|
99 * status.
|
|
100 * @param message The message for the account in the substatus.
|
|
101 */
|
12080
|
102 void gaim_savedstatus_set_substatus(GaimSavedStatus *status,
|
|
103 const GaimAccount *account,
|
|
104 const GaimStatusType *type,
|
|
105 const char *message);
|
12056
|
106
|
|
107 /**
|
|
108 * Unset a substatus for an account in a saved status. This clears
|
|
109 * the previosly set substatus for the GaimSavedStatus. If this
|
|
110 * saved status is activated then this account will use the default
|
|
111 * status type and message.
|
|
112 *
|
|
113 * @param status The saved status.
|
|
114 * @param account The account.
|
|
115 */
|
12080
|
116 void gaim_savedstatus_unset_substatus(GaimSavedStatus *saved_status,
|
12056
|
117 const GaimAccount *account);
|
|
118
|
|
119 /**
|
10418
|
120 * Delete a saved status. This removes the saved status from the list
|
|
121 * of saved statuses, and writes the revised list to status.xml.
|
|
122 *
|
|
123 * @param title The title of the saved status.
|
|
124 *
|
|
125 * @return TRUE if the status was successfully deleted. FALSE if the
|
|
126 * status could not be deleted because no saved status exists
|
|
127 * with the given title.
|
|
128 */
|
10419
|
129 gboolean gaim_savedstatus_delete(const char *title);
|
10418
|
130
|
|
131 /**
|
|
132 * Returns all saved statuses.
|
|
133 *
|
|
134 * @return A list of saved statuses.
|
|
135 */
|
|
136 const GList *gaim_savedstatuses_get_all(void);
|
|
137
|
|
138 /**
|
|
139 * Finds a saved status with the specified title.
|
|
140 *
|
|
141 * @param title The name of the saved status.
|
|
142 *
|
|
143 * @return The saved status if found, or NULL.
|
|
144 */
|
10419
|
145 GaimSavedStatus *gaim_savedstatus_find(const char *title);
|
10418
|
146
|
|
147 /**
|
11651
|
148 * Determines if a given saved status is "transient."
|
|
149 * A transient saved status is one that was not
|
|
150 * explicitly added by the user. Transient statuses
|
|
151 * are automatically removed if they are not used
|
|
152 * for a period of time.
|
|
153 *
|
|
154 * A transient saved statuses is automatically
|
|
155 * created by the status box when the user sets himself
|
|
156 * to one of the generic primitive statuses. The reason
|
|
157 * we need to save this status information is so we can
|
|
158 * restore it when Gaim restarts.
|
|
159 *
|
|
160 * @param saved_status The saved status.
|
|
161 *
|
|
162 * @return TRUE if the saved status is transient.
|
|
163 */
|
|
164 gboolean gaim_savedstatus_is_transient(const GaimSavedStatus *saved_status);
|
|
165
|
|
166 /**
|
10418
|
167 * Return the name of a given saved status.
|
|
168 *
|
|
169 * @param saved_status The saved status.
|
|
170 *
|
|
171 * @return The title.
|
|
172 */
|
10419
|
173 const char *gaim_savedstatus_get_title(const GaimSavedStatus *saved_status);
|
10418
|
174
|
|
175 /**
|
12056
|
176 * Return the type of a given saved status.
|
10418
|
177 *
|
|
178 * @param saved_status The saved status.
|
|
179 *
|
|
180 * @return The name.
|
|
181 */
|
10419
|
182 GaimStatusPrimitive gaim_savedstatus_get_type(const GaimSavedStatus *saved_status);
|
10418
|
183
|
|
184 /**
|
12056
|
185 * Return the default message of a given saved status.
|
10418
|
186 *
|
|
187 * @param saved_status The saved status.
|
|
188 *
|
|
189 * @return The name.
|
|
190 */
|
10419
|
191 const char *gaim_savedstatus_get_message(const GaimSavedStatus *saved_status);
|
10418
|
192
|
|
193 /**
|
11651
|
194 * Determine if a given saved status has "substatuses,"
|
|
195 * or if it is a simple status (the same for all
|
|
196 * accounts).
|
|
197 *
|
|
198 * @param saved_status The saved status.
|
|
199 *
|
|
200 * @return TRUE if the saved_status has substatuses.
|
|
201 * FALSE otherwise.
|
|
202 */
|
|
203 gboolean gaim_savedstatus_has_substatuses(const GaimSavedStatus *saved_status);
|
|
204
|
|
205 /**
|
12056
|
206 * Get the substatus for an account in a saved status.
|
|
207 *
|
|
208 * @param status The saved status.
|
|
209 * @param account The account.
|
|
210 *
|
|
211 * @return The GaimSavedStatusSub for the account, or NULL if
|
|
212 * the given account does not have a substatus that
|
|
213 * differs from the default status of this GaimSavedStatus.
|
|
214 */
|
12080
|
215 GaimSavedStatusSub *gaim_savedstatus_get_substatus(
|
12056
|
216 const GaimSavedStatus *saved_status,
|
|
217 const GaimAccount *account);
|
|
218
|
|
219 /**
|
|
220 * Get the status type of a given substatus.
|
|
221 *
|
|
222 * @param substatus The substatus.
|
|
223 *
|
|
224 * @return The status type.
|
|
225 */
|
|
226 const GaimStatusType *gaim_savedstatus_substatus_get_type(const GaimSavedStatusSub *substatus);
|
|
227
|
|
228 /**
|
|
229 * Get the message of a given substatus.
|
|
230 *
|
|
231 * @param substatus The substatus.
|
|
232 *
|
|
233 * @return The message of the substatus, or NULL if this substatus does
|
|
234 * not have a message.
|
|
235 */
|
|
236 const char *gaim_savedstatus_substatus_get_message(const GaimSavedStatusSub *substatus);
|
|
237
|
|
238 /**
|
11724
|
239 * Sets the statuses for all your accounts to those specified
|
|
240 * by the given saved_status. This function calls
|
|
241 * gaim_savedstatus_activate_for_account() for all your accounts.
|
|
242 *
|
|
243 * @param saved_status The status you want to set your accounts to.
|
|
244 */
|
|
245 void gaim_savedstatus_activate(const GaimSavedStatus *saved_status);
|
|
246
|
|
247 /**
|
|
248 * Sets the statuses for a given account to those specified
|
|
249 * by the given saved_status.
|
|
250 *
|
|
251 * @param saved_status The status you want to set your accounts to.
|
|
252 * @param account The account whose statuses you want to change.
|
|
253 */
|
|
254 void gaim_savedstatus_activate_for_account(const GaimSavedStatus *saved_status, GaimAccount *account);
|
|
255
|
|
256 /**
|
10418
|
257 * Get the handle for the status subsystem.
|
|
258 *
|
|
259 * @return the handle to the status subsystem
|
|
260 */
|
|
261 void *gaim_savedstatuses_get_handle();
|
|
262
|
|
263 /**
|
|
264 * Initializes the status subsystem.
|
|
265 */
|
|
266 void gaim_savedstatuses_init(void);
|
|
267
|
|
268 /**
|
|
269 * Uninitializes the status subsystem.
|
|
270 */
|
|
271 void gaim_savedstatuses_uninit(void);
|
|
272
|
|
273 /*@}*/
|
|
274
|
|
275 #endif /* _GAIM_SAVEDSTATUSES_H_ */
|