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 /**
|
11651
|
66 * Set the type for the given saved status.
|
|
67 *
|
|
68 * @param status The saved status.
|
|
69 * @param type The type of saved status.
|
|
70 */
|
|
71 void gaim_savedstatus_set_type(GaimSavedStatus *status,
|
|
72 GaimStatusPrimitive type);
|
|
73
|
|
74 /**
|
10420
|
75 * Set the message for the given saved status.
|
|
76 *
|
|
77 * @param status The saved status.
|
|
78 * @param message The message, or NULL if you want to unset the
|
|
79 * message for this status.
|
|
80 */
|
|
81 void gaim_savedstatus_set_message(GaimSavedStatus *status,
|
|
82 const char *message);
|
|
83
|
|
84 /**
|
10418
|
85 * Delete a saved status. This removes the saved status from the list
|
|
86 * of saved statuses, and writes the revised list to status.xml.
|
|
87 *
|
|
88 * @param title The title of the saved status.
|
|
89 *
|
|
90 * @return TRUE if the status was successfully deleted. FALSE if the
|
|
91 * status could not be deleted because no saved status exists
|
|
92 * with the given title.
|
|
93 */
|
10419
|
94 gboolean gaim_savedstatus_delete(const char *title);
|
10418
|
95
|
|
96 /**
|
|
97 * Returns all saved statuses.
|
|
98 *
|
|
99 * @return A list of saved statuses.
|
|
100 */
|
|
101 const GList *gaim_savedstatuses_get_all(void);
|
|
102
|
|
103 /**
|
|
104 * Finds a saved status with the specified title.
|
|
105 *
|
|
106 * @param title The name of the saved status.
|
|
107 *
|
|
108 * @return The saved status if found, or NULL.
|
|
109 */
|
10419
|
110 GaimSavedStatus *gaim_savedstatus_find(const char *title);
|
10418
|
111
|
|
112 /**
|
11651
|
113 * Determines if a given saved status is "transient."
|
|
114 * A transient saved status is one that was not
|
|
115 * explicitly added by the user. Transient statuses
|
|
116 * are automatically removed if they are not used
|
|
117 * for a period of time.
|
|
118 *
|
|
119 * A transient saved statuses is automatically
|
|
120 * created by the status box when the user sets himself
|
|
121 * to one of the generic primitive statuses. The reason
|
|
122 * we need to save this status information is so we can
|
|
123 * restore it when Gaim restarts.
|
|
124 *
|
|
125 * @param saved_status The saved status.
|
|
126 *
|
|
127 * @return TRUE if the saved status is transient.
|
|
128 */
|
|
129 gboolean gaim_savedstatus_is_transient(const GaimSavedStatus *saved_status);
|
|
130
|
|
131 /**
|
10418
|
132 * Return the name of a given saved status.
|
|
133 *
|
|
134 * @param saved_status The saved status.
|
|
135 *
|
|
136 * @return The title.
|
|
137 */
|
10419
|
138 const char *gaim_savedstatus_get_title(const GaimSavedStatus *saved_status);
|
10418
|
139
|
|
140 /**
|
|
141 * Return the name of a given saved status.
|
|
142 *
|
|
143 * @param saved_status The saved status.
|
|
144 *
|
|
145 * @return The name.
|
|
146 */
|
10419
|
147 GaimStatusPrimitive gaim_savedstatus_get_type(const GaimSavedStatus *saved_status);
|
10418
|
148
|
|
149 /**
|
|
150 * Return the name of a given saved status.
|
|
151 *
|
|
152 * @param saved_status The saved status.
|
|
153 *
|
|
154 * @return The name.
|
|
155 */
|
10419
|
156 const char *gaim_savedstatus_get_message(const GaimSavedStatus *saved_status);
|
10418
|
157
|
|
158 /**
|
11651
|
159 * Determine if a given saved status has "substatuses,"
|
|
160 * or if it is a simple status (the same for all
|
|
161 * accounts).
|
|
162 *
|
|
163 * @param saved_status The saved status.
|
|
164 *
|
|
165 * @return TRUE if the saved_status has substatuses.
|
|
166 * FALSE otherwise.
|
|
167 */
|
|
168 gboolean gaim_savedstatus_has_substatuses(const GaimSavedStatus *saved_status);
|
|
169
|
|
170 /**
|
11724
|
171 * Sets the statuses for all your accounts to those specified
|
|
172 * by the given saved_status. This function calls
|
|
173 * gaim_savedstatus_activate_for_account() for all your accounts.
|
|
174 *
|
|
175 * @param saved_status The status you want to set your accounts to.
|
|
176 */
|
|
177 void gaim_savedstatus_activate(const GaimSavedStatus *saved_status);
|
|
178
|
|
179 /**
|
|
180 * Sets the statuses for a given account to those specified
|
|
181 * by the given saved_status.
|
|
182 *
|
|
183 * @param saved_status The status you want to set your accounts to.
|
|
184 * @param account The account whose statuses you want to change.
|
|
185 */
|
|
186 void gaim_savedstatus_activate_for_account(const GaimSavedStatus *saved_status, GaimAccount *account);
|
|
187
|
|
188 /**
|
10418
|
189 * Get the handle for the status subsystem.
|
|
190 *
|
|
191 * @return the handle to the status subsystem
|
|
192 */
|
|
193 void *gaim_savedstatuses_get_handle();
|
|
194
|
|
195 /**
|
|
196 * Initializes the status subsystem.
|
|
197 */
|
|
198 void gaim_savedstatuses_init(void);
|
|
199
|
|
200 /**
|
|
201 * Uninitializes the status subsystem.
|
|
202 */
|
|
203 void gaim_savedstatuses_uninit(void);
|
|
204
|
|
205 /*@}*/
|
|
206
|
|
207 #endif /* _GAIM_SAVEDSTATUSES_H_ */
|