comparison src/savedstatuses.h @ 12125:3c1bac709234

[gaim-migrate @ 14425] Change /core/savedstatus/current and /core/savedstatus/idleaway to ints (they used to be strings, where the value was the title of a GaimSavedStatus). The value is now equal to the "creation" timestamp of a saved_status. The creation timestamp is used as the unique key. The primary reason for this is to allow for saved statuses to have NULL titles. NULL titles are needed for transient statuses. I also added a "last_used" timestamp. This all paves the way for keeping track of recently used statuses committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Nov 2005 07:23:29 +0000
parents 3b52d94437f3
children 465ddcb3e9e8
comparison
equal deleted inserted replaced
12124:9c123e27e2f6 12125:3c1bac709234
28 /** 28 /**
29 * Saved statuses don't really interact much with the rest of Gaim. It 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 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 31 * a user chooses one of the saved states, their Gaim accounts are set
32 * to the settings of that state. 32 * to the settings of that state.
33 *
34 * In the savedstatus API, there is the concept of a 'transient'
35 * saved status. A transient saved status is one that is not
36 * permanent. Gaim will removed it automatically if it isn't
37 * used for a period of time. Transient saved statuses don't
38 * have titles and they don't show up in the list of saved
39 * statuses. In fact, if a saved status does not have a title
40 * then it is transient. If it does have a title, then it is not
41 * transient.
42 *
43 * What good is a transient status, you ask? They can be used to
44 * keep track of the user's 5 most recently used statuses, for
45 * example. Basically if they just set a message on the fly,
46 * we'll cache it for them in case they want to use it again. If
47 * they don't use it again, we'll just delete it.
33 */ 48 */
34 49
35 /* 50 /*
36 * TODO: Hmm. We should probably just be saving GaimPresences. That's 51 * TODO: Hmm. We should probably just be saving GaimPresences. That's
37 * something we should look into once the status box gets fleshed 52 * something we should look into once the status box gets fleshed
51 /** 66 /**
52 * Create a new saved status. This will add the saved status to the 67 * 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. 68 * list of saved statuses and writes the revised list to status.xml.
54 * 69 *
55 * @param title The title of the saved status. This must be 70 * @param title The title of the saved status. This must be
56 * unique. 71 * unique. Or, if you want to create a transient
72 * saved status, then pass in NULL.
57 * @param type The type of saved status. 73 * @param type The type of saved status.
58 * 74 *
59 * @return The newly created saved status, or NULL if the title you 75 * @return The newly created saved status, or NULL if the title you
60 * used was already taken. 76 * used was already taken.
61 */ 77 */
134 * @return A list of saved statuses. 150 * @return A list of saved statuses.
135 */ 151 */
136 const GList *gaim_savedstatuses_get_all(void); 152 const GList *gaim_savedstatuses_get_all(void);
137 153
138 /** 154 /**
155 * Returns the currently selected saved status.
156 *
157 * @return A pointer to the in-use GaimSavedStatus.
158 */
159 GaimSavedStatus *gaim_savedstatus_get_current();
160
161 /**
162 * Returns the saved status that gets used when your
163 * accounts become idle-away.
164 *
165 * @return A pointer to the idle-away GaimSavedStatus.
166 */
167 GaimSavedStatus *gaim_savedstatus_get_idleaway();
168
169 /**
139 * Finds a saved status with the specified title. 170 * Finds a saved status with the specified title.
140 * 171 *
141 * @param title The name of the saved status. 172 * @param title The name of the saved status.
142 * 173 *
143 * @return The saved status if found, or NULL. 174 * @return The saved status if found, or NULL.
189 * @return The name. 220 * @return The name.
190 */ 221 */
191 const char *gaim_savedstatus_get_message(const GaimSavedStatus *saved_status); 222 const char *gaim_savedstatus_get_message(const GaimSavedStatus *saved_status);
192 223
193 /** 224 /**
225 * Return the time in seconds-since-the-epoch when this
226 * saved status was created. Note: For any status created
227 * by Gaim 1.5.0 or older this value will be invalid and
228 * very small (close to 0). This is because Gaim 1.5.0
229 * and older did not record the timestamp when the status
230 * was created.
231 *
232 * However, this value is guaranteed to be a unique
233 * identifier for the given saved status.
234 *
235 * @param saved_status The saved status.
236 *
237 * @return The timestamp when this saved status was created.
238 */
239 time_t gaim_savedstatus_get_creation_time(const GaimSavedStatus *saved_status);
240
241 /**
194 * Determine if a given saved status has "substatuses," 242 * Determine if a given saved status has "substatuses,"
195 * or if it is a simple status (the same for all 243 * or if it is a simple status (the same for all
196 * accounts). 244 * accounts).
197 * 245 *
198 * @param saved_status The saved status. 246 * @param saved_status The saved status.
240 * by the given saved_status. This function calls 288 * by the given saved_status. This function calls
241 * gaim_savedstatus_activate_for_account() for all your accounts. 289 * gaim_savedstatus_activate_for_account() for all your accounts.
242 * 290 *
243 * @param saved_status The status you want to set your accounts to. 291 * @param saved_status The status you want to set your accounts to.
244 */ 292 */
245 void gaim_savedstatus_activate(const GaimSavedStatus *saved_status); 293 void gaim_savedstatus_activate(GaimSavedStatus *saved_status);
246 294
247 /** 295 /**
248 * Sets the statuses for a given account to those specified 296 * Sets the statuses for a given account to those specified
249 * by the given saved_status. 297 * by the given saved_status.
250 * 298 *