Mercurial > pidgin
annotate src/account.h @ 5643:eb685809108b
[gaim-migrate @ 6057]
When a prpl couldn't load, the account's prpl ID got set to -1 and the
account config file had to be manually editted. Now that's fixed, and it
stores the ID on load and writes it on save.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 01 Jun 2003 21:36:40 +0000 |
parents | 86456ec3ca25 |
children | 46d7ad0dfa26 |
rev | line source |
---|---|
5563 | 1 /** |
2 * @file account.h Account API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #ifndef _GAIM_ACCOUNTS_H_ | |
24 #define _GAIM_ACCOUNTS_H_ | |
25 | |
26 typedef struct _GaimAccount GaimAccount; | |
27 | |
28 #include "connection.h" | |
29 #include "prpl.h" | |
30 | |
31 struct _GaimAccount | |
32 { | |
33 char *username; /**< The username. */ | |
34 char *alias; /**< The current alias. */ | |
35 char *password; /**< The account password. */ | |
36 char *user_info; /**< User information. */ | |
37 | |
38 char *buddy_icon; /**< The buddy icon. */ | |
39 | |
40 gboolean remember_pass; /**< Remember the password. */ | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
41 gboolean check_mail; /**< Check for mail. */ |
5563 | 42 |
43 GaimProtocol protocol; /**< The account protocol. */ | |
5643
eb685809108b
[gaim-migrate @ 6057]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
44 char *protocol_id; /**< The ID of the protocol. */ |
5563 | 45 |
46 GaimConnection *gc; /**< The connection handle. */ | |
47 | |
48 GHashTable *settings; /**< Protocol-specific settings. */ | |
49 | |
50 struct gaim_proxy_info *gpi; /**< Proxy information. */ | |
51 | |
52 GSList *permit; /**< Permit list. */ | |
53 GSList *deny; /**< Deny list. */ | |
54 int perm_deny; /**< The permit/deny setting. */ | |
55 }; | |
56 | |
57 /** | |
58 * Creates a new account. | |
59 * | |
60 * @param username The username. | |
61 * @param protocol The protocol. | |
62 */ | |
63 GaimAccount *gaim_account_new(const char *username, GaimProtocol protocol); | |
64 | |
65 /** | |
66 * Destroys an account. | |
67 * | |
68 * @param account The account to destroy. | |
69 */ | |
70 void gaim_account_destroy(GaimAccount *account); | |
71 | |
72 /** | |
73 * Connects to an account. | |
74 * | |
75 * @param account The account to connect to. | |
76 * | |
77 * @return The gaim connection. | |
78 */ | |
79 GaimConnection *gaim_account_connect(GaimAccount *account); | |
80 | |
81 /** | |
82 * Disconnects from an account. | |
83 * | |
84 * @param account The account to disconnect from. | |
85 * | |
86 * @return The gaim connection. | |
87 */ | |
88 void gaim_account_disconnect(GaimAccount *account); | |
89 | |
90 /** | |
91 * Sets the account's username. | |
92 * | |
93 * @param account The account. | |
94 * @param username The username. | |
95 */ | |
96 void gaim_account_set_username(GaimAccount *account, const char *username); | |
97 | |
98 /** | |
99 * Sets the account's password. | |
100 * | |
101 * @param account The account. | |
102 * @param password The password. | |
103 */ | |
104 void gaim_account_set_password(GaimAccount *account, const char *password); | |
105 | |
106 /** | |
107 * Sets the account's alias. | |
108 * | |
109 * @param account The account. | |
110 * @param alias The alias. | |
111 */ | |
112 void gaim_account_set_alias(GaimAccount *account, const char *alias); | |
113 | |
114 /** | |
115 * Sets the account's user information | |
116 * | |
117 * @param account The account. | |
118 * @param info The user information. | |
119 */ | |
120 void gaim_account_set_user_info(GaimAccount *account, const char *user_info); | |
121 | |
122 /** | |
123 * Sets the account's buddy icon. | |
124 * | |
125 * @param account The account. | |
126 * @param icon The buddy icon file. | |
127 */ | |
128 void gaim_account_set_buddy_icon(GaimAccount *account, const char *icon); | |
129 | |
130 /** | |
131 * Sets the account's protocol. | |
132 * | |
133 * @param account The account. | |
134 * @param protocol The protocol. | |
135 */ | |
136 void gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol); | |
137 | |
138 /** | |
139 * Sets the account's connection. | |
140 * | |
141 * @param account The account. | |
142 * @param gc The connection. | |
143 */ | |
144 void gaim_account_set_connection(GaimAccount *account, GaimConnection *gc); | |
145 | |
146 /** | |
147 * Sets whether or not this account should save its password. | |
148 * | |
149 * @param account The account. | |
150 * @param value @c TRUE if it should remember the password. | |
151 */ | |
152 void gaim_account_set_remember_password(GaimAccount *account, gboolean value); | |
153 | |
154 /** | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
155 * Sets whether or not this account should check for mail. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
156 * |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
157 * @param account The account. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
158 * @param value @c TRUE if it should check for mail. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
159 */ |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
160 void gaim_account_set_check_mail(GaimAccount *account, gboolean value); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
161 |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
162 /** |
5563 | 163 * Sets a protocol-specific integer setting for an account. |
164 * | |
165 * @param account The account. | |
166 * @param name The name of the setting. | |
167 * @param value The setting's value. | |
168 */ | |
169 void gaim_account_set_int(GaimAccount *account, const char *name, int value); | |
170 | |
171 /** | |
172 * Sets a protocol-specific string setting for an account. | |
173 * | |
174 * @param account The account. | |
175 * @param name The name of the setting. | |
176 * @param value The setting's value. | |
177 */ | |
178 void gaim_account_set_string(GaimAccount *account, const char *name, | |
179 const char *string); | |
180 | |
181 /** | |
182 * Sets a protocol-specific boolean setting for an account. | |
183 * | |
184 * @param account The account. | |
185 * @param name The name of the setting. | |
186 * @param value The setting's value. | |
187 */ | |
188 void gaim_account_set_bool(GaimAccount *account, const char *name, | |
189 gboolean value); | |
190 | |
191 | |
192 /** | |
193 * Returns whether or not the account is connected. | |
194 * | |
195 * @param account The account. | |
196 * | |
197 * @return @c TRUE if connected, or @c FALSE otherwise. | |
198 */ | |
199 gboolean gaim_account_is_connected(const GaimAccount *account); | |
200 | |
201 /** | |
202 * Returns the account's username. | |
203 * | |
204 * @param account The account. | |
205 * | |
206 * @return The username. | |
207 */ | |
208 const char *gaim_account_get_username(const GaimAccount *account); | |
209 | |
210 /** | |
211 * Returns the account's password. | |
212 * | |
213 * @param account The account. | |
214 * | |
215 * @return The password. | |
216 */ | |
217 const char *gaim_account_get_password(const GaimAccount *account); | |
218 | |
219 /** | |
220 * Returns the account's alias. | |
221 * | |
222 * @param account The account. | |
223 * | |
224 * @return The alias. | |
225 */ | |
226 const char *gaim_account_get_alias(const GaimAccount *account); | |
227 | |
228 /** | |
229 * Returns the account's user information. | |
230 * | |
231 * @param account The account. | |
232 * | |
233 * @return The user information. | |
234 */ | |
235 const char *gaim_account_get_user_info(const GaimAccount *account); | |
236 | |
237 /** | |
238 * Returns the account's buddy icon filename. | |
239 * | |
240 * @param account The account. | |
241 * | |
242 * @return The buddy icon filename. | |
243 */ | |
244 const char *gaim_account_get_buddy_icon(const GaimAccount *account); | |
245 | |
246 /** | |
247 * Returns the account's protocol. | |
248 * | |
249 * @param account The account. | |
250 * | |
251 * @return The protocol. | |
252 */ | |
253 GaimProtocol gaim_account_get_protocol(const GaimAccount *account); | |
254 | |
255 /** | |
256 * Returns the account's connection. | |
257 * | |
258 * @param account The account. | |
259 * | |
260 * @return The connection. | |
261 */ | |
262 GaimConnection *gaim_account_get_connection(const GaimAccount *account); | |
263 | |
264 /** | |
265 * Returns whether or not this account should save its password. | |
266 * | |
267 * @param account The account. | |
268 * | |
269 * @return @c TRUE if it should remember the password. | |
270 */ | |
271 gboolean gaim_account_get_remember_password(const GaimAccount *account); | |
272 | |
273 /** | |
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
274 * Returns whether or not this account should check for mail. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
275 * |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
276 * @param account The account. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
277 * |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
278 * @return @c TRUE if it should check for mail. |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
279 */ |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
280 gboolean gaim_account_get_check_mail(const GaimAccount *account); |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
281 |
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
282 /** |
5563 | 283 * Returns a protocol-specific integer setting for an account. |
284 * | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
285 * @param account The account. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
286 * @param name The name of the setting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
287 * @param default_value The default value. |
5563 | 288 * |
289 * @return The value. | |
290 */ | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
291 int gaim_account_get_int(const GaimAccount *account, const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
292 int default_value); |
5563 | 293 |
294 /** | |
295 * Returns a protocol-specific string setting for an account. | |
296 * | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
297 * @param account The account. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
298 * @param name The name of the setting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
299 * @param default_value The default value. |
5563 | 300 * |
301 * @return The value. | |
302 */ | |
303 const char *gaim_account_get_string(const GaimAccount *account, | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
304 const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
305 const char *default_value); |
5563 | 306 |
307 /** | |
308 * Returns a protocol-specific boolean setting for an account. | |
309 * | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
310 * @param account The account. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
311 * @param name The name of the setting. |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
312 * @param default_value The default value. |
5563 | 313 * |
314 * @return The value. | |
315 */ | |
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
316 gboolean gaim_account_get_bool(const GaimAccount *account, const char *name, |
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
317 gboolean default_value); |
5563 | 318 |
319 /** | |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
320 * Loads the accounts. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
321 */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
322 gboolean gaim_accounts_load(); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
323 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
324 /** |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
325 * Force an immediate write of accounts. |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
326 */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
327 void gaim_accounts_sync(); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
328 |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
329 /** |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
330 * Reorders an account. |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
331 * |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
332 * @param account The account to reorder. |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
333 * @param new_index The new index for the account. |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
334 */ |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
335 void gaim_accounts_reorder(GaimAccount *account, size_t new_index); |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
336 |
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
337 /** |
5563 | 338 * Returns a list of all accounts. |
339 * | |
340 * @return A list of all accounts. | |
341 */ | |
342 GList *gaim_accounts_get_all(void); | |
343 | |
344 #endif /* _GAIM_ACCOUNTS_H_ */ |