# HG changeset patch # User Christian Hammond # Date 1058670358 0 # Node ID 8d10cdfe1bb14ef4aca1e7a6844db3c0daba57f1 # Parent 6173354a64dca8f8d9479bfaf5ff8f61bed50be2 [gaim-migrate @ 6733] Added some API stuff for setting an account's public IP, which will be used for file transfer and stuff. I won't be doing much with this until after my vacation. committer: Tailor Script diff -r 6173354a64dc -r 8d10cdfe1bb1 src/account.c --- a/src/account.c Sat Jul 19 20:57:58 2003 +0000 +++ b/src/account.c Sun Jul 20 03:05:58 2003 +0000 @@ -37,6 +37,7 @@ TAG_ALIAS, TAG_USERINFO, TAG_BUDDYICON, + TAG_PUBLIC_IP, TAG_SETTING, TAG_TYPE, TAG_HOST, @@ -333,6 +334,19 @@ } void +gaim_account_set_public_ip(GaimAccount *account, const char *ip) +{ + g_return_if_fail(account != NULL); + + if (account->ip != NULL) + g_free(account->ip); + + account->ip = (ip == NULL ? NULL : g_strdup(ip)); + + schedule_accounts_save(); +} + +void gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info) { g_return_if_fail(account != NULL); @@ -600,6 +614,14 @@ return gaim_account_get_ui_bool(account, ui, "auto-login", FALSE); } +const char * +gaim_account_get_public_ip(const GaimAccount *account) +{ + g_return_val_if_fail(account != NULL, NULL); + + return account->ip; +} + GaimProxyInfo * gaim_account_get_proxy_info(const GaimAccount *account) { @@ -788,6 +810,8 @@ data->tag = TAG_USERINFO; else if (!strcmp(element_name, "buddyicon")) data->tag = TAG_BUDDYICON; + else if (!strcmp(element_name, "public-ip")) + data->tag = TAG_PUBLIC_IP; else if (!strcmp(element_name, "proxy")) { data->in_proxy = TRUE; @@ -876,6 +900,10 @@ if (*buffer != '\0') gaim_account_set_buddy_icon(data->account, buffer); } + else if (data->tag == TAG_PUBLIC_IP) { + if (*buffer != '\0') + gaim_account_set_public_ip(data->account, buffer); + } else if (data->tag == TAG_TYPE) { if (data->in_proxy) { if (!strcmp(buffer, "global")) @@ -1080,7 +1108,7 @@ { GaimProxyInfo *proxy_info; GaimProxyType proxy_type; - const char *password, *alias, *user_info, *buddy_icon; + const char *password, *alias, *user_info, *buddy_icon, *ip; char *esc; fprintf(fp, " \n"); @@ -1114,6 +1142,10 @@ g_free(esc); } + if ((ip = gaim_account_get_public_ip(account)) != NULL) { + fprintf(fp, " %s\n", ip); + } + fprintf(fp, " \n"); g_hash_table_foreach(account->settings, write_setting, fp); fprintf(fp, " \n"); diff -r 6173354a64dc -r 8d10cdfe1bb1 src/account.h --- a/src/account.h Sat Jul 19 20:57:58 2003 +0000 +++ b/src/account.h Sun Jul 20 03:05:58 2003 +0000 @@ -39,27 +39,28 @@ struct _GaimAccount { - char *username; /**< The username. */ - char *alias; /**< The current alias. */ - char *password; /**< The account password. */ - char *user_info; /**< User information. */ + char *username; /**< The username. */ + char *alias; /**< The current alias. */ + char *password; /**< The account password. */ + char *user_info; /**< User information. */ - char *buddy_icon; /**< The buddy icon. */ + char *buddy_icon; /**< The buddy icon. */ - gboolean remember_pass; /**< Remember the password. */ + gboolean remember_pass; /**< Remember the password. */ - char *protocol_id; /**< The ID of the protocol. */ + char *protocol_id; /**< The ID of the protocol. */ - GaimConnection *gc; /**< The connection handle. */ + GaimConnection *gc; /**< The connection handle. */ - GHashTable *settings; /**< Protocol-specific settings. */ - GHashTable *ui_settings; /**< UI-specific settings. */ + GHashTable *settings; /**< Protocol-specific settings. */ + GHashTable *ui_settings; /**< UI-specific settings. */ - GaimProxyInfo *proxy_info; /**< Proxy information. */ + char *ip; /**< The IP address for transfers. */ + GaimProxyInfo *proxy_info; /**< Proxy information. */ - GSList *permit; /**< Permit list. */ - GSList *deny; /**< Deny list. */ - int perm_deny; /**< The permit/deny setting. */ + GSList *permit; /**< Permit list. */ + GSList *deny; /**< Deny list. */ + int perm_deny; /**< The permit/deny setting. */ }; #ifdef __cplusplus @@ -197,6 +198,15 @@ gboolean value); /** + * Sets the public IP address the account will use for such things + * as file transfer. + * + * @param account The account. + * @param ip The IP address. + */ +void gaim_account_set_public_ip(GaimAccount *account, const char *ip); + +/** * Sets the account's proxy information. * * @param account The account. @@ -385,6 +395,15 @@ const char *ui); /** + * Returns the account's public IP address. + * + * @param account The account. + * + * @return The IP address. + */ +const char *gaim_account_get_public_ip(const GaimAccount *account); + +/** * Returns the account's proxy information. * * @param account The account.