Changeset 1478
- Timestamp:
- 01/26/07 11:48:24
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account.c (modified) (9 diffs)
- trunk/libtinymail-camel/tny-camel-account.h (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-store-account.c (modified) (2 diffs)
- trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c (modified) (4 diffs)
- trunk/libtinymail-gpe/tny-gpe-account-store.c (modified) (4 diffs)
- trunk/libtinymail-maemo/tny-maemo-account-store.c (modified) (4 diffs)
- trunk/libtinymail-olpc/tny-olpc-account-store.c (modified) (4 diffs)
- trunk/libtinymail/tny-account.c (modified) (2 diffs)
- trunk/libtinymail/tny-account.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1477 r1478 1 2007-01-26 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * Added the tny_account_set/get_mech API 4 5 * This was a major API change 6 1 7 2007-01-26 Sergio Villar Senin <svillar@igalia.com> 2 8 trunk/libtinymail-camel/tny-camel-account-priv.h
r1383 r1478 31 31 CamelService *service; 32 32 CamelException *ex; 33 gchar *url_string, *id, *user, *host, *proto ;33 gchar *url_string, *id, *user, *host, *proto, *mech; 34 34 TnyGetPassFunc get_pass_func; 35 35 TnyForgetPassFunc forget_pass_func; trunk/libtinymail-camel/tny-camel-account.c
r1470 r1478 74 74 * The "always" means that normal SSL is used whereas "when-possible" means 75 75 * that TLS is tried (the STARTTLS capability of IMAP servers). 76 * 76 77 **/ 77 78 void … … 305 306 306 307 static void 307 tny_camel_account_set_ proto (TnyAccount *self, const gchar *proto)308 { 309 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_ proto_func (self, proto);310 } 311 312 static void 313 tny_camel_account_set_ proto_default (TnyAccount *self, const gchar *proto)308 tny_camel_account_set_mech (TnyAccount *self, const gchar *mech) 309 { 310 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_mech_func (self, mech); 311 } 312 313 static void 314 tny_camel_account_set_mech_default (TnyAccount *self, const gchar *mech) 314 315 { 315 316 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); … … 317 318 g_static_rec_mutex_lock (priv->service_lock); 318 319 319 if (G_UNLIKELY (priv-> proto))320 g_free (priv-> proto);321 322 priv-> proto = g_strdup (proto);320 if (G_UNLIKELY (priv->mech)) 321 g_free (priv->mech); 322 323 priv->mech = g_strdup (mech); 323 324 324 325 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->reconnect_func (TNY_CAMEL_ACCOUNT (self)); … … 330 331 331 332 static void 333 tny_camel_account_set_proto (TnyAccount *self, const gchar *proto) 334 { 335 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->set_proto_func (self, proto); 336 } 337 338 static void 339 tny_camel_account_set_proto_default (TnyAccount *self, const gchar *proto) 340 { 341 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 342 343 g_static_rec_mutex_lock (priv->service_lock); 344 345 if (G_UNLIKELY (priv->proto)) 346 g_free (priv->proto); 347 348 priv->proto = g_strdup (proto); 349 350 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->reconnect_func (TNY_CAMEL_ACCOUNT (self)); 351 352 g_static_rec_mutex_unlock (priv->service_lock); 353 354 return; 355 } 356 357 static void 332 358 tny_camel_account_set_user (TnyAccount *self, const gchar *user) 333 359 { … … 441 467 442 468 retval = (const gchar*)priv->id; 469 470 return retval; 471 } 472 473 static const gchar* 474 tny_camel_account_get_mech (TnyAccount *self) 475 { 476 return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_mech_func (self); 477 } 478 479 static const gchar* 480 tny_camel_account_get_mech_default (TnyAccount *self) 481 { 482 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 483 const gchar *retval; 484 485 retval = (const gchar*)priv->mech; 443 486 444 487 return retval; … … 575 618 priv->host = NULL; 576 619 priv->proto = NULL; 620 priv->mech = g_strdup ("PLAIN"); 577 621 priv->forget_pass_func_set = FALSE; 578 622 priv->pass_func_set = FALSE; … … 697 741 g_free (priv->host); 698 742 743 if (G_LIKELY (priv->mech)) 744 g_free (priv->mech); 745 699 746 if (G_LIKELY (priv->proto)) 700 747 g_free (priv->proto); … … 724 771 klass->get_proto_func = tny_camel_account_get_proto; 725 772 klass->set_proto_func = tny_camel_account_set_proto; 773 klass->get_mech_func = tny_camel_account_get_mech; 774 klass->set_mech_func = tny_camel_account_set_mech; 726 775 klass->get_user_func = tny_camel_account_get_user; 727 776 klass->set_user_func = tny_camel_account_set_user; … … 755 804 class->get_proto_func = tny_camel_account_get_proto_default; 756 805 class->set_proto_func = tny_camel_account_set_proto_default; 806 class->get_mech_func = tny_camel_account_get_mech_default; 807 class->set_mech_func = tny_camel_account_set_mech_default; 757 808 class->get_user_func = tny_camel_account_get_user_default; 758 809 class->set_user_func = tny_camel_account_set_user_default; trunk/libtinymail-camel/tny-camel-account.h
r1368 r1478 59 59 void (*set_id_func) (TnyAccount *self, const gchar *id); 60 60 void (*set_name_func) (TnyAccount *self, const gchar *name); 61 void (*set_mech_func) (TnyAccount *self, const gchar *name); 61 62 void (*set_proto_func) (TnyAccount *self, const gchar *proto); 62 63 void (*set_user_func) (TnyAccount *self, const gchar *user); … … 69 70 const gchar* (*get_id_func) (TnyAccount *self); 70 71 const gchar* (*get_name_func) (TnyAccount *self); 72 const gchar* (*get_mech_func) (TnyAccount *self); 71 73 const gchar* (*get_proto_func) (TnyAccount *self); 72 74 const gchar* (*get_user_func) (TnyAccount *self); trunk/libtinymail-camel/tny-camel-store-account.c
r1418 r1478 80 80 GList *options = apriv->options; 81 81 gchar *proto = g_strdup_printf ("%s://", apriv->proto); 82 82 83 83 url = camel_url_new (proto, apriv->ex); 84 84 g_free (proto); … … 87 87 camel_url_set_user (url, apriv->user); 88 88 camel_url_set_host (url, apriv->host); 89 camel_url_set_authmech (url, apriv->mech); 89 90 90 91 while (options) trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c
r1417 r1478 358 358 for (i=0; i < count; i++) 359 359 { 360 gchar *proto, *type, *key, *name ;360 gchar *proto, *type, *key, *name, *mech; 361 361 TnyAccount *account = NULL; 362 362 GSList *options; … … 389 389 (const gchar*) key, NULL); 390 390 g_free (key); 391 391 392 key = g_strdup_printf ("/apps/tinymail/accounts/%d/mech", i); 393 mech = gconf_client_get_string (priv->client, 394 (const gchar*) key, NULL); 395 g_free (key); 396 392 397 if (type && G_LIKELY (!g_ascii_strncasecmp (type, "transport", 9))) 393 398 { … … 418 423 (const gchar*) key, NULL); 419 424 g_free (key); 420 tny_account_set_name (TNY_ACCOUNT (account), name); 421 g_free (name); 422 425 426 427 if (name) 428 { 429 tny_account_set_name (TNY_ACCOUNT (account), name); 430 g_free (name); 431 } 432 433 if (mech) 434 tny_account_set_mech (TNY_ACCOUNT (account), mech); 423 435 424 436 key = g_strdup_printf ("/apps/tinymail/accounts/%d/options", i); … … 496 508 } 497 509 510 if (mech) 511 g_free (mech); 512 498 513 if (proto) 499 514 g_free (proto); trunk/libtinymail-gpe/tny-gpe-account-store.c
r1398 r1478 238 238 for (i=0; i < count; i++) 239 239 { 240 gchar *proto, *type, *key, *name ;240 gchar *proto, *type, *key, *name, *mech; 241 241 TnyAccount *account = NULL; 242 242 GSList *options; … … 266 266 key = g_strdup_printf ("/apps/tinymail/accounts/%d/proto", i); 267 267 proto = gconf_client_get_string (priv->client, 268 (const gchar*) key, NULL); 269 g_free (key); 270 271 key = g_strdup_printf ("/apps/tinymail/accounts/%d/mech", i); 272 mech = gconf_client_get_string (priv->client, 268 273 (const gchar*) key, NULL); 269 274 g_free (key); … … 298 303 (const gchar*) key, NULL); 299 304 g_free (key); 300 tny_account_set_name (TNY_ACCOUNT (account), name); 301 g_free (name); 305 306 if (name) 307 { 308 tny_account_set_name (TNY_ACCOUNT (account), name); 309 g_free (name); 310 } 311 312 if (mech) 313 tny_account_set_mech (TNY_ACCOUNT (account), mech); 302 314 303 315 … … 378 390 if (proto) 379 391 g_free (proto); 392 393 if (mech) 394 g_free (mech); 395 380 396 } 381 397 trunk/libtinymail-maemo/tny-maemo-account-store.c
r1398 r1478 239 239 for (i=0; i < count; i++) 240 240 { 241 gchar *proto, *type, *key, *name ;241 gchar *proto, *type, *key, *name, *mech; 242 242 TnyAccount *account = NULL; 243 243 GSList *options; … … 267 267 key = g_strdup_printf ("/apps/tinymail/accounts/%d/proto", i); 268 268 proto = gconf_client_get_string (priv->client, 269 (const gchar*) key, NULL); 270 g_free (key); 271 272 key = g_strdup_printf ("/apps/tinymail/accounts/%d/mech", i); 273 mech = gconf_client_get_string (priv->client, 269 274 (const gchar*) key, NULL); 270 275 g_free (key); … … 300 305 g_free (key); 301 306 tny_account_set_name (TNY_ACCOUNT (account), name); 302 g_free (name); 303 307 if (name) 308 { 309 tny_account_set_name (TNY_ACCOUNT (account), name); 310 g_free (name); 311 } 312 313 if (mech) 314 tny_account_set_mech (TNY_ACCOUNT (account), mech); 304 315 305 316 key = g_strdup_printf ("/apps/tinymail/accounts/%d/options", i); … … 380 391 g_free (proto); 381 392 393 if (mech) 394 g_free (mech); 395 396 382 397 } 383 398 trunk/libtinymail-olpc/tny-olpc-account-store.c
r1398 r1478 202 202 { 203 203 GKeyFile *keyfile; 204 gchar *proto, *type, *key, *name ;204 gchar *proto, *type, *key, *name, *mech; 205 205 TnyAccount *account = NULL; 206 206 gchar *fullfilen = g_build_filename (g_get_home_dir(), … … 222 222 type = g_key_file_get_value (keyfile, "tinymail", "type", NULL); 223 223 proto = g_key_file_get_value (keyfile, "tinymail", "proto", NULL); 224 mech = g_key_file_get_value (keyfile, "tinymail", "mech", NULL); 224 225 225 226 if (type && G_LIKELY (!g_ascii_strncasecmp (type, "transport", 9))) … … 251 252 252 253 name = g_key_file_get_value (keyfile, "tinymail", "name", NULL); 253 tny_account_set_name (TNY_ACCOUNT (account), name); 254 g_free (name); 254 255 if (name) 256 { 257 tny_account_set_name (TNY_ACCOUNT (account), name); 258 g_free (name); 259 } 260 261 if (mech) 262 tny_account_set_mech (TNY_ACCOUNT (account), mech); 255 263 256 264 options = g_key_file_get_string_list (keyfile, "tinymail", "options", &options_len, NULL); … … 308 316 if (proto) 309 317 g_free (proto); 318 if (mech) 319 g_free (mech); 310 320 311 321 g_key_file_free (keyfile); trunk/libtinymail/tny-account.c
r1290 r1478 110 110 111 111 TNY_ACCOUNT_GET_IFACE (self)->set_name_func (self, name); 112 return; 113 } 114 115 /** 116 * tny_account_set_mech: 117 * @self: a #TnyAccount object 118 * @mech: the authentication mechanism 119 * 120 * Set the account's authentication mechanism 121 * 122 **/ 123 void 124 tny_account_set_mech (TnyAccount *self, const gchar *mech) 125 { 126 #ifdef DEBUG 127 if (!TNY_ACCOUNT_GET_IFACE (self)->set_mech_func) 128 g_critical ("You must implement tny_account_set_mech\n"); 129 #endif 130 131 TNY_ACCOUNT_GET_IFACE (self)->set_mech_func (self, mech); 112 132 return; 113 133 } … … 456 476 } 457 477 478 479 /** 480 * tny_account_get_mech: 481 * @self: a #TnyAccount object 482 * 483 * Get the authentication mechanism for this account. Default is "PLAIN". 484 * 485 * Return value: the authentication mechanism as a read-only string 486 * 487 **/ 488 const gchar* 489 tny_account_get_mech (TnyAccount *self) 490 { 491 #ifdef DEBUG 492 if (!TNY_ACCOUNT_GET_IFACE (self)->get_mech_func) 493 g_critical ("You must implement tny_account_get_mech\n"); 494 #endif 495 496 return TNY_ACCOUNT_GET_IFACE (self)->get_mech_func (self); 497 } 498 499 458 500 /** 459 501 * tny_account_get_hostname: trunk/libtinymail/tny-account.h
r1138 r1478 53 53 void (*set_id_func) (TnyAccount *self, const gchar *id); 54 54 void (*set_name_func) (TnyAccount *self, const gchar *name); 55 void (*set_mech_func) (TnyAccount *self, const gchar *name); 55 56 void (*set_proto_func) (TnyAccount *self, const gchar *proto); 56 57 void (*set_user_func) (TnyAccount *self, const gchar *user); … … 63 64 const gchar* (*get_id_func) (TnyAccount *self); 64 65 const gchar* (*get_name_func) (TnyAccount *self); 66 const gchar* (*get_mech_func) (TnyAccount *self); 65 67 const gchar* (*get_proto_func) (TnyAccount *self); 66 68 const gchar* (*get_user_func) (TnyAccount *self); … … 76 78 void tny_account_set_id (TnyAccount *self, const gchar *id); 77 79 void tny_account_set_name (TnyAccount *self, const gchar *name); 80 void tny_account_set_mech (TnyAccount *self, const gchar *name); 78 81 void tny_account_set_proto (TnyAccount *self, const gchar *proto); 79 82 void tny_account_set_user (TnyAccount *self, const gchar *user); … … 84 87 const gchar* tny_account_get_id (TnyAccount *self); 85 88 const gchar* tny_account_get_name (TnyAccount *self); 89 const gchar* tny_account_get_mech (TnyAccount *self); 86 90 const gchar* tny_account_get_proto (TnyAccount *self); 87 91 const gchar* tny_account_get_user (TnyAccount *self);
