Mercurial > pidgin
annotate src/account.h @ 5615:6500a6c8d679
[gaim-migrate @ 6022]
Checkboxes update!
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 31 May 2003 18:35:22 +0000 |
| parents | 86456ec3ca25 |
| children | eb685809108b |
| 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. */ | |
| 44 | |
| 45 GaimConnection *gc; /**< The connection handle. */ | |
| 46 | |
| 47 GHashTable *settings; /**< Protocol-specific settings. */ | |
| 48 | |
| 49 struct gaim_proxy_info *gpi; /**< Proxy information. */ | |
| 50 | |
| 51 GSList *permit; /**< Permit list. */ | |
| 52 GSList *deny; /**< Deny list. */ | |
| 53 int perm_deny; /**< The permit/deny setting. */ | |
| 54 }; | |
| 55 | |
| 56 /** | |
| 57 * Creates a new account. | |
| 58 * | |
| 59 * @param username The username. | |
| 60 * @param protocol The protocol. | |
| 61 */ | |
| 62 GaimAccount *gaim_account_new(const char *username, GaimProtocol protocol); | |
| 63 | |
| 64 /** | |
| 65 * Destroys an account. | |
| 66 * | |
| 67 * @param account The account to destroy. | |
| 68 */ | |
| 69 void gaim_account_destroy(GaimAccount *account); | |
| 70 | |
| 71 /** | |
| 72 * Connects to an account. | |
| 73 * | |
| 74 * @param account The account to connect to. | |
| 75 * | |
| 76 * @return The gaim connection. | |
| 77 */ | |
| 78 GaimConnection *gaim_account_connect(GaimAccount *account); | |
| 79 | |
| 80 /** | |
| 81 * Disconnects from an account. | |
| 82 * | |
| 83 * @param account The account to disconnect from. | |
| 84 * | |
| 85 * @return The gaim connection. | |
| 86 */ | |
| 87 void gaim_account_disconnect(GaimAccount *account); | |
| 88 | |
| 89 /** | |
| 90 * Sets the account's username. | |
| 91 * | |
| 92 * @param account The account. | |
| 93 * @param username The username. | |
| 94 */ | |
| 95 void gaim_account_set_username(GaimAccount *account, const char *username); | |
| 96 | |
| 97 /** | |
| 98 * Sets the account's password. | |
| 99 * | |
| 100 * @param account The account. | |
| 101 * @param password The password. | |
| 102 */ | |
| 103 void gaim_account_set_password(GaimAccount *account, const char *password); | |
| 104 | |
| 105 /** | |
| 106 * Sets the account's alias. | |
| 107 * | |
| 108 * @param account The account. | |
| 109 * @param alias The alias. | |
| 110 */ | |
| 111 void gaim_account_set_alias(GaimAccount *account, const char *alias); | |
| 112 | |
| 113 /** | |
| 114 * Sets the account's user information | |
| 115 * | |
| 116 * @param account The account. | |
| 117 * @param info The user information. | |
| 118 */ | |
| 119 void gaim_account_set_user_info(GaimAccount *account, const char *user_info); | |
| 120 | |
| 121 /** | |
| 122 * Sets the account's buddy icon. | |
| 123 * | |
| 124 * @param account The account. | |
| 125 * @param icon The buddy icon file. | |
| 126 */ | |
| 127 void gaim_account_set_buddy_icon(GaimAccount *account, const char *icon); | |
| 128 | |
| 129 /** | |
| 130 * Sets the account's protocol. | |
| 131 * | |
| 132 * @param account The account. | |
| 133 * @param protocol The protocol. | |
| 134 */ | |
| 135 void gaim_account_set_protocol(GaimAccount *account, GaimProtocol protocol); | |
| 136 | |
| 137 /** | |
| 138 * Sets the account's connection. | |
| 139 * | |
| 140 * @param account The account. | |
| 141 * @param gc The connection. | |
| 142 */ | |
| 143 void gaim_account_set_connection(GaimAccount *account, GaimConnection *gc); | |
| 144 | |
| 145 /** | |
| 146 * Sets whether or not this account should save its password. | |
| 147 * | |
| 148 * @param account The account. | |
| 149 * @param value @c TRUE if it should remember the password. | |
| 150 */ | |
| 151 void gaim_account_set_remember_password(GaimAccount *account, gboolean value); | |
| 152 | |
| 153 /** | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
154 * Sets whether or not this account should check for mail. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
155 * |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
156 * @param account The account. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
157 * @param value @c TRUE if it should check for mail. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
158 */ |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
159 void gaim_account_set_check_mail(GaimAccount *account, gboolean value); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
160 |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
161 /** |
| 5563 | 162 * Sets a protocol-specific integer setting for an account. |
| 163 * | |
| 164 * @param account The account. | |
| 165 * @param name The name of the setting. | |
| 166 * @param value The setting's value. | |
| 167 */ | |
| 168 void gaim_account_set_int(GaimAccount *account, const char *name, int value); | |
| 169 | |
| 170 /** | |
| 171 * Sets a protocol-specific string setting for an account. | |
| 172 * | |
| 173 * @param account The account. | |
| 174 * @param name The name of the setting. | |
| 175 * @param value The setting's value. | |
| 176 */ | |
| 177 void gaim_account_set_string(GaimAccount *account, const char *name, | |
| 178 const char *string); | |
| 179 | |
| 180 /** | |
| 181 * Sets a protocol-specific boolean setting for an account. | |
| 182 * | |
| 183 * @param account The account. | |
| 184 * @param name The name of the setting. | |
| 185 * @param value The setting's value. | |
| 186 */ | |
| 187 void gaim_account_set_bool(GaimAccount *account, const char *name, | |
| 188 gboolean value); | |
| 189 | |
| 190 | |
| 191 /** | |
| 192 * Returns whether or not the account is connected. | |
| 193 * | |
| 194 * @param account The account. | |
| 195 * | |
| 196 * @return @c TRUE if connected, or @c FALSE otherwise. | |
| 197 */ | |
| 198 gboolean gaim_account_is_connected(const GaimAccount *account); | |
| 199 | |
| 200 /** | |
| 201 * Returns the account's username. | |
| 202 * | |
| 203 * @param account The account. | |
| 204 * | |
| 205 * @return The username. | |
| 206 */ | |
| 207 const char *gaim_account_get_username(const GaimAccount *account); | |
| 208 | |
| 209 /** | |
| 210 * Returns the account's password. | |
| 211 * | |
| 212 * @param account The account. | |
| 213 * | |
| 214 * @return The password. | |
| 215 */ | |
| 216 const char *gaim_account_get_password(const GaimAccount *account); | |
| 217 | |
| 218 /** | |
| 219 * Returns the account's alias. | |
| 220 * | |
| 221 * @param account The account. | |
| 222 * | |
| 223 * @return The alias. | |
| 224 */ | |
| 225 const char *gaim_account_get_alias(const GaimAccount *account); | |
| 226 | |
| 227 /** | |
| 228 * Returns the account's user information. | |
| 229 * | |
| 230 * @param account The account. | |
| 231 * | |
| 232 * @return The user information. | |
| 233 */ | |
| 234 const char *gaim_account_get_user_info(const GaimAccount *account); | |
| 235 | |
| 236 /** | |
| 237 * Returns the account's buddy icon filename. | |
| 238 * | |
| 239 * @param account The account. | |
| 240 * | |
| 241 * @return The buddy icon filename. | |
| 242 */ | |
| 243 const char *gaim_account_get_buddy_icon(const GaimAccount *account); | |
| 244 | |
| 245 /** | |
| 246 * Returns the account's protocol. | |
| 247 * | |
| 248 * @param account The account. | |
| 249 * | |
| 250 * @return The protocol. | |
| 251 */ | |
| 252 GaimProtocol gaim_account_get_protocol(const GaimAccount *account); | |
| 253 | |
| 254 /** | |
| 255 * Returns the account's connection. | |
| 256 * | |
| 257 * @param account The account. | |
| 258 * | |
| 259 * @return The connection. | |
| 260 */ | |
| 261 GaimConnection *gaim_account_get_connection(const GaimAccount *account); | |
| 262 | |
| 263 /** | |
| 264 * Returns whether or not this account should save its password. | |
| 265 * | |
| 266 * @param account The account. | |
| 267 * | |
| 268 * @return @c TRUE if it should remember the password. | |
| 269 */ | |
| 270 gboolean gaim_account_get_remember_password(const GaimAccount *account); | |
| 271 | |
| 272 /** | |
|
5565
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
273 * Returns whether or not this account should check for mail. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
274 * |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
275 * @param account The account. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
276 * |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
277 * @return @c TRUE if it should check for mail. |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
278 */ |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
279 gboolean gaim_account_get_check_mail(const GaimAccount *account); |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
280 |
|
c3c4aaf69f65
[gaim-migrate @ 5967]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
281 /** |
| 5563 | 282 * Returns a protocol-specific integer setting for an account. |
| 283 * | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
284 * @param account The account. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
285 * @param name The name of the setting. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
286 * @param default_value The default value. |
| 5563 | 287 * |
| 288 * @return The value. | |
| 289 */ | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
290 int gaim_account_get_int(const GaimAccount *account, const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
291 int default_value); |
| 5563 | 292 |
| 293 /** | |
| 294 * Returns a protocol-specific string setting for an account. | |
| 295 * | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
296 * @param account The account. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
297 * @param name The name of the setting. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
298 * @param default_value The default value. |
| 5563 | 299 * |
| 300 * @return The value. | |
| 301 */ | |
| 302 const char *gaim_account_get_string(const GaimAccount *account, | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
303 const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
304 const char *default_value); |
| 5563 | 305 |
| 306 /** | |
| 307 * Returns a protocol-specific boolean setting for an account. | |
| 308 * | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
309 * @param account The account. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
310 * @param name The name of the setting. |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
311 * @param default_value The default value. |
| 5563 | 312 * |
| 313 * @return The value. | |
| 314 */ | |
|
5564
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
315 gboolean gaim_account_get_bool(const GaimAccount *account, const char *name, |
|
187c740f2a4e
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
316 gboolean default_value); |
| 5563 | 317 |
| 318 /** | |
|
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
319 * Loads the accounts. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
320 */ |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
321 gboolean gaim_accounts_load(); |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
322 |
|
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 * Force an immediate write of accounts. |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
325 */ |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
326 void gaim_accounts_sync(); |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
327 |
|
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5565
diff
changeset
|
328 /** |
|
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
329 * Reorders an account. |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
330 * |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
331 * @param account The account to reorder. |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
332 * @param new_index The new index for the account. |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
333 */ |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
334 void gaim_accounts_reorder(GaimAccount *account, size_t new_index); |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
335 |
|
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5573
diff
changeset
|
336 /** |
| 5563 | 337 * Returns a list of all accounts. |
| 338 * | |
| 339 * @return A list of all accounts. | |
| 340 */ | |
| 341 GList *gaim_accounts_get_all(void); | |
| 342 | |
| 343 #endif /* _GAIM_ACCOUNTS_H_ */ |
