Mercurial > pidgin.yaz
comparison src/account.c @ 6239:8d10cdfe1bb1
[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 <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 20 Jul 2003 03:05:58 +0000 |
parents | 914f2d5da21c |
children | 72bbe310ac77 |
comparison
equal
deleted
inserted
replaced
6238:6173354a64dc | 6239:8d10cdfe1bb1 |
---|---|
35 TAG_NAME, | 35 TAG_NAME, |
36 TAG_PASSWORD, | 36 TAG_PASSWORD, |
37 TAG_ALIAS, | 37 TAG_ALIAS, |
38 TAG_USERINFO, | 38 TAG_USERINFO, |
39 TAG_BUDDYICON, | 39 TAG_BUDDYICON, |
40 TAG_PUBLIC_IP, | |
40 TAG_SETTING, | 41 TAG_SETTING, |
41 TAG_TYPE, | 42 TAG_TYPE, |
42 TAG_HOST, | 43 TAG_HOST, |
43 TAG_PORT | 44 TAG_PORT |
44 | 45 |
331 | 332 |
332 gaim_account_set_ui_bool(account, ui, "auto-login", value); | 333 gaim_account_set_ui_bool(account, ui, "auto-login", value); |
333 } | 334 } |
334 | 335 |
335 void | 336 void |
337 gaim_account_set_public_ip(GaimAccount *account, const char *ip) | |
338 { | |
339 g_return_if_fail(account != NULL); | |
340 | |
341 if (account->ip != NULL) | |
342 g_free(account->ip); | |
343 | |
344 account->ip = (ip == NULL ? NULL : g_strdup(ip)); | |
345 | |
346 schedule_accounts_save(); | |
347 } | |
348 | |
349 void | |
336 gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info) | 350 gaim_account_set_proxy_info(GaimAccount *account, GaimProxyInfo *info) |
337 { | 351 { |
338 g_return_if_fail(account != NULL); | 352 g_return_if_fail(account != NULL); |
339 | 353 |
340 if (account->proxy_info != NULL) | 354 if (account->proxy_info != NULL) |
596 { | 610 { |
597 g_return_val_if_fail(account != NULL, FALSE); | 611 g_return_val_if_fail(account != NULL, FALSE); |
598 g_return_val_if_fail(ui != NULL, FALSE); | 612 g_return_val_if_fail(ui != NULL, FALSE); |
599 | 613 |
600 return gaim_account_get_ui_bool(account, ui, "auto-login", FALSE); | 614 return gaim_account_get_ui_bool(account, ui, "auto-login", FALSE); |
615 } | |
616 | |
617 const char * | |
618 gaim_account_get_public_ip(const GaimAccount *account) | |
619 { | |
620 g_return_val_if_fail(account != NULL, NULL); | |
621 | |
622 return account->ip; | |
601 } | 623 } |
602 | 624 |
603 GaimProxyInfo * | 625 GaimProxyInfo * |
604 gaim_account_get_proxy_info(const GaimAccount *account) | 626 gaim_account_get_proxy_info(const GaimAccount *account) |
605 { | 627 { |
786 data->tag = TAG_ALIAS; | 808 data->tag = TAG_ALIAS; |
787 else if (!strcmp(element_name, "userinfo")) | 809 else if (!strcmp(element_name, "userinfo")) |
788 data->tag = TAG_USERINFO; | 810 data->tag = TAG_USERINFO; |
789 else if (!strcmp(element_name, "buddyicon")) | 811 else if (!strcmp(element_name, "buddyicon")) |
790 data->tag = TAG_BUDDYICON; | 812 data->tag = TAG_BUDDYICON; |
813 else if (!strcmp(element_name, "public-ip")) | |
814 data->tag = TAG_PUBLIC_IP; | |
791 else if (!strcmp(element_name, "proxy")) { | 815 else if (!strcmp(element_name, "proxy")) { |
792 data->in_proxy = TRUE; | 816 data->in_proxy = TRUE; |
793 | 817 |
794 data->proxy_info = gaim_proxy_info_new(); | 818 data->proxy_info = gaim_proxy_info_new(); |
795 } | 819 } |
873 gaim_account_set_user_info(data->account, buffer); | 897 gaim_account_set_user_info(data->account, buffer); |
874 } | 898 } |
875 else if (data->tag == TAG_BUDDYICON) { | 899 else if (data->tag == TAG_BUDDYICON) { |
876 if (*buffer != '\0') | 900 if (*buffer != '\0') |
877 gaim_account_set_buddy_icon(data->account, buffer); | 901 gaim_account_set_buddy_icon(data->account, buffer); |
902 } | |
903 else if (data->tag == TAG_PUBLIC_IP) { | |
904 if (*buffer != '\0') | |
905 gaim_account_set_public_ip(data->account, buffer); | |
878 } | 906 } |
879 else if (data->tag == TAG_TYPE) { | 907 else if (data->tag == TAG_TYPE) { |
880 if (data->in_proxy) { | 908 if (data->in_proxy) { |
881 if (!strcmp(buffer, "global")) | 909 if (!strcmp(buffer, "global")) |
882 gaim_proxy_info_set_type(data->proxy_info, | 910 gaim_proxy_info_set_type(data->proxy_info, |
1078 static void | 1106 static void |
1079 gaim_accounts_write(FILE *fp, GaimAccount *account) | 1107 gaim_accounts_write(FILE *fp, GaimAccount *account) |
1080 { | 1108 { |
1081 GaimProxyInfo *proxy_info; | 1109 GaimProxyInfo *proxy_info; |
1082 GaimProxyType proxy_type; | 1110 GaimProxyType proxy_type; |
1083 const char *password, *alias, *user_info, *buddy_icon; | 1111 const char *password, *alias, *user_info, *buddy_icon, *ip; |
1084 char *esc; | 1112 char *esc; |
1085 | 1113 |
1086 fprintf(fp, " <account>\n"); | 1114 fprintf(fp, " <account>\n"); |
1087 fprintf(fp, " <protocol>%s</protocol>\n", account->protocol_id); | 1115 fprintf(fp, " <protocol>%s</protocol>\n", account->protocol_id); |
1088 esc = g_markup_escape_text(gaim_account_get_username(account), -1); | 1116 esc = g_markup_escape_text(gaim_account_get_username(account), -1); |
1110 | 1138 |
1111 if ((buddy_icon = gaim_account_get_buddy_icon(account)) != NULL) { | 1139 if ((buddy_icon = gaim_account_get_buddy_icon(account)) != NULL) { |
1112 esc = g_markup_escape_text(buddy_icon, -1); | 1140 esc = g_markup_escape_text(buddy_icon, -1); |
1113 fprintf(fp, " <buddyicon>%s</buddyicon>\n", esc); | 1141 fprintf(fp, " <buddyicon>%s</buddyicon>\n", esc); |
1114 g_free(esc); | 1142 g_free(esc); |
1143 } | |
1144 | |
1145 if ((ip = gaim_account_get_public_ip(account)) != NULL) { | |
1146 fprintf(fp, " <public-ip>%s</public-ip>\n", ip); | |
1115 } | 1147 } |
1116 | 1148 |
1117 fprintf(fp, " <settings>\n"); | 1149 fprintf(fp, " <settings>\n"); |
1118 g_hash_table_foreach(account->settings, write_setting, fp); | 1150 g_hash_table_foreach(account->settings, write_setting, fp); |
1119 fprintf(fp, " </settings>\n"); | 1151 fprintf(fp, " </settings>\n"); |