Mercurial > pidgin
comparison src/gaimrc.c @ 5804:1ba7dbd50d85
[gaim-migrate @ 6234]
import really really ancient prefs, and import auto-login settings, and have
the auto-login checkbox in the account editor work again.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 07 Jun 2003 20:33:39 +0000 |
parents | c6a30e1868ae |
children | 41c8d5e82d12 |
comparison
equal
deleted
inserted
replaced
5803:56042e59499a | 5804:1ba7dbd50d85 |
---|---|
566 p = parse_line(buf, &parse_buffer); | 566 p = parse_line(buf, &parse_buffer); |
567 | 567 |
568 if (strcmp(p->option, "user_opts")) | 568 if (strcmp(p->option, "user_opts")) |
569 return account; | 569 return account; |
570 | 570 |
571 /* TODO: Handle OPT_ACCT_AUTO */ | |
572 | |
573 flags = atoi(p->value[0]); | 571 flags = atoi(p->value[0]); |
572 | |
573 if (flags & OPT_ACCT_AUTO) | |
574 gaim_account_set_auto_login(account, GAIM_GTK_UI, TRUE); | |
574 | 575 |
575 if (flags & OPT_ACCT_MAIL_CHECK) | 576 if (flags & OPT_ACCT_MAIL_CHECK) |
576 gaim_account_set_check_mail(account, TRUE); | 577 gaim_account_set_check_mail(account, TRUE); |
577 | 578 |
578 if (!(flags & OPT_ACCT_REM_PASS)) | 579 if (!(flags & OPT_ACCT_REM_PASS)) |
711 int old; | 712 int old; |
712 guint *val; | 713 guint *val; |
713 int new; | 714 int new; |
714 }; | 715 }; |
715 | 716 |
716 static struct replace gen_replace[] = { | 717 #define OPT_GEN_ENTER_SENDS 0x00000001 |
717 { /* OPT_GEN_ENTER_SENDS */ 0x00000001, &convo_options, OPT_CONVO_ENTER_SENDS }, | 718 #define OPT_GEN_LOG_ALL 0x00000004 |
718 { /* OPT_GEN_POPUP_WINDOWS */ 0x00000020, &im_options, OPT_IM_POPUP }, | 719 #define OPT_GEN_STRIP_HTML 0x00000008 |
719 { /* OPT_GEN_SEND_LINKS */ 0x00000040, &convo_options, OPT_CONVO_SEND_LINKS }, | 720 #define OPT_GEN_POPUP_WINDOWS 0x00000020 |
720 { /* OPT_GEN_DEBUG */ 0x00000100, &misc_options, OPT_MISC_DEBUG }, | 721 #define OPT_GEN_SEND_LINKS 0x00000040 |
721 { /* OPT_GEN_BROWSER_POPUP */ 0x00000800, &misc_options, OPT_MISC_BROWSER_POPUP }, | 722 #define OPT_GEN_DEBUG 0x00000100 |
722 { /* OPT_GEN_CHECK_SPELLING */ 0x00008000, &convo_options, OPT_CONVO_CHECK_SPELLING }, | 723 #define OPT_GEN_BROWSER_POPUP 0x00000800 |
723 { /* OPT_GEN_POPUP_CHAT */ 0x00010000, &chat_options, OPT_CHAT_POPUP }, | 724 #define OPT_GEN_CHECK_SPELLING 0x00008000 |
724 { /* OPT_GEN_BACK_ON_IM */ 0x00020000, &away_options, OPT_AWAY_BACK_ON_IM }, | 725 #define OPT_GEN_POPUP_CHAT 0x00010000 |
725 { /* OPT_GEN_CTL_CHARS */ 0x00080000, &convo_options, OPT_CONVO_CTL_CHARS }, | 726 #define OPT_GEN_BACK_ON_IM 0x00020000 |
726 #if 0 | 727 #define OPT_GEN_CTL_CHARS 0x00080000 |
727 { /* OPT_GEN_TOMBSTONE */ 0x00100000, &away_options, OPT_AWAY_TOMBSTONE }, | 728 #define OPT_GEN_CTL_SMILEYS 0x00200000 |
728 #endif | 729 #define OPT_GEN_AUTO_AWAY 0x00800000 |
729 { /* OPT_GEN_CTL_SMILEYS */ 0x00200000, &convo_options, OPT_CONVO_CTL_SMILEYS }, | 730 #define OPT_GEN_ESC_CAN_CLOSE 0x01000000 |
730 { /* OPT_GEN_AUTO_AWAY */ 0x00800000, &away_options, OPT_AWAY_AUTO }, | 731 #define OPT_GEN_CTL_ENTER 0x02000000 |
731 { /* OPT_GEN_ESC_CAN_CLOSE */ 0x01000000, &convo_options, OPT_CONVO_ESC_CAN_CLOSE }, | 732 #define OPT_GEN_F2_TOGGLES 0x04000000 |
732 { /* OPT_GEN_CTL_ENTER */ 0x02000000, &convo_options, OPT_CONVO_CTL_ENTER }, | 733 #define OPT_GEN_NO_AUTO_RESP 0x08000000 |
733 { /* OPT_GEN_F2_TOGGLES */ 0x04000000, &convo_options, OPT_CONVO_F2_TOGGLES }, | 734 #define OPT_GEN_QUEUE_WHEN_AWAY 0x10000000 |
734 { /* OPT_GEN_NO_AUTO_RESP */ 0x08000000, &away_options, OPT_AWAY_NO_AUTO_RESP }, | 735 |
735 { /* OPT_GEN_QUEUE_WHEN_AWAY */ 0x10000000, &away_options, OPT_AWAY_QUEUE }, | 736 #define OPT_DISP_SHOW_TIME 0x00000001 |
736 { 0,NULL,0 } | 737 #define OPT_DISP_SHOW_GRPNUM 0x00000002 |
737 }; | 738 #define OPT_DISP_SHOW_IDLETIME 0x00000008 |
738 | 739 #define OPT_DISP_SHOW_BUTTON_XPM 0x00000010 |
739 #define OPT_GEN_LOG_ALL 0x00000004 | 740 #define OPT_DISP_IGNORE_COLOUR 0x00000020 |
740 #define OPT_GEN_STRIP_HTML 0x00000008 | 741 #define OPT_DISP_SHOW_LOGON 0x00000040 |
741 | 742 #define OPT_DISP_SHOW_SMILEY 0x00000100 |
742 static struct replace disp_replace[] = { | 743 #define OPT_DISP_CHAT_LOGON 0x00000800 |
743 { /* OPT_DISP_SHOW_TIME */ 0x00000001, &convo_options, OPT_CONVO_SHOW_TIME }, | 744 #define OPT_DISP_NO_BUTTONS 0x00002000 |
744 { /* OPT_DISP_SHOW_GRPNUM */ 0x00000002, &blist_options, OPT_BLIST_SHOW_GRPNUM }, | 745 #define OPT_DISP_CONV_BUTTON_TEXT 0x00004000 |
745 { /* OPT_DISP_SHOW_PIXMAPS */ 0x00000004, &blist_options, OPT_BLIST_SHOW_PIXMAPS }, | 746 #define OPT_DISP_CHAT_BUTTON_TEXT 0x00008000 |
746 { /* OPT_DISP_SHOW_IDLETIME */ 0x00000008, &blist_options, OPT_BLIST_SHOW_IDLETIME }, | 747 #define OPT_DISP_NO_MT_GRP 0x00040000 |
747 { /* OPT_DISP_SHOW_BUTTON_XPM */ 0x00000010, &blist_options, OPT_BLIST_SHOW_BUTTON_XPM }, | 748 #define OPT_DISP_CONV_BUTTON_XPM 0x00080000 |
748 { /* OPT_DISP_IGNORE_COLOUR */ 0x00000020, &convo_options, OPT_CONVO_IGNORE_COLOUR }, | 749 #define OPT_DISP_CHAT_BUTTON_XPM 0x00100000 |
749 { /* OPT_DISP_SHOW_LOGON */ 0x00000040, &im_options, OPT_IM_LOGON }, | 750 #define OPT_DISP_SHOW_WARN 0x00200000 |
750 { /* OPT_DISP_SHOW_SMILEY */ 0x00000100, &convo_options, OPT_CONVO_SHOW_SMILEY }, | 751 #define OPT_DISP_IGNORE_FONTS 0x00400000 |
751 { /* OPT_DISP_COOL_LOOK */ 0x00000400, &misc_options, 0}, | 752 #define OPT_DISP_IGNORE_SIZES 0x00800000 |
752 { /* OPT_DISP_CHAT_LOGON */ 0x00000800, &chat_options, OPT_CHAT_LOGON }, | 753 #define OPT_DISP_ONE_CHAT_WINDOW 0x02000000 |
753 { /* OPT_DISP_NO_BUTTONS */ 0x00002000, &blist_options, OPT_BLIST_NO_BUTTON_TEXT }, | 754 #define OPT_DISP_CONV_SIDE_TAB 0x04000000 |
754 { /* OPT_DISP_CONV_BUTTON_TEXT */ 0x00004000, &im_options, OPT_IM_BUTTON_TEXT }, | 755 #define OPT_DISP_CONV_BR_TAB 0x08000000 |
755 { /* OPT_DISP_CHAT_BUTTON_TEXT */ 0x00008000, &chat_options, OPT_CHAT_BUTTON_TEXT }, | |
756 { /* OPT_DISP_NO_MT_GRP */ 0x00040000, &blist_options, OPT_BLIST_NO_MT_GRP }, | |
757 { /* OPT_DISP_CONV_BUTTON_XPM */ 0x00080000, &im_options, OPT_IM_BUTTON_XPM }, | |
758 { /* OPT_DISP_CHAT_BUTTON_XPM */ 0x00100000, &chat_options, OPT_CHAT_BUTTON_XPM }, | |
759 { /* OPT_DISP_SHOW_WARN */ 0x00200000, &blist_options, OPT_BLIST_SHOW_WARN }, | |
760 { /* OPT_DISP_IGNORE_FONTS */ 0x00400000, &convo_options, OPT_CONVO_IGNORE_FONTS }, | |
761 { /* OPT_DISP_IGNORE_SIZES */ 0x00800000, &convo_options, OPT_CONVO_IGNORE_SIZES }, | |
762 { /* OPT_DISP_ONE_WINDOW */ 0x01000000, &im_options, OPT_IM_ONE_WINDOW }, | |
763 { /* OPT_DISP_ONE_CHAT_WINDOW */ 0x02000000, &chat_options, OPT_CHAT_ONE_WINDOW }, | |
764 { /* OPT_DISP_CONV_SIDE_TAB */ 0x04000000, &im_options, OPT_IM_SIDE_TAB }, | |
765 { /* OPT_DISP_CONV_BR_TAB */ 0x08000000, &im_options, OPT_IM_BR_TAB }, | |
766 { /* OPT_DISP_CHAT_SIDE_TAB */ 0x10000000, &chat_options, OPT_CHAT_SIDE_TAB }, | |
767 { /* OPT_DISP_CHAT_BR_TAB */ 0x20000000, &chat_options, OPT_CHAT_BR_TAB }, | |
768 { 0,NULL,0 } | |
769 }; | |
770 | 756 |
771 static void gaimrc_read_options(FILE *f) | 757 static void gaimrc_read_options(FILE *f) |
772 { | 758 { |
773 char buf[2048]; | 759 char buf[2048]; |
774 struct parse parse_buffer; | 760 struct parse parse_buffer; |
775 struct parse *p; | 761 struct parse *p; |
776 gboolean read_logging = FALSE, read_general = FALSE, read_display = FALSE; | 762 gboolean read_logging = FALSE, read_general = FALSE; |
777 int general_options = 0, display_options = 0; | 763 int general_options = 0, display_options = 0; |
778 int i; | |
779 | 764 |
780 buf[0] = 0; | 765 buf[0] = 0; |
781 | 766 |
782 while (buf[0] != '}') { | 767 while (buf[0] != '}') { |
783 if (buf[0] == '#') | 768 if (buf[0] == '#') |
790 | 775 |
791 /* XXX: what are we going to do about ancient prefs? */ | 776 /* XXX: what are we going to do about ancient prefs? */ |
792 if (!strcmp(p->option, "general_options")) { | 777 if (!strcmp(p->option, "general_options")) { |
793 general_options = atoi(p->value[0]); | 778 general_options = atoi(p->value[0]); |
794 read_general = TRUE; | 779 read_general = TRUE; |
780 gaim_prefs_set_bool("/gaim/gtk/conversations/enter_sends", | |
781 general_options & OPT_GEN_ENTER_SENDS); | |
782 gaim_prefs_set_bool("/gaim/gtk/conversations/im/raise_on_events", | |
783 general_options & OPT_GEN_POPUP_WINDOWS); | |
784 gaim_prefs_set_bool("/core/conversations/send_urls_as_links", | |
785 general_options & OPT_GEN_SEND_LINKS); | |
786 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", | |
787 general_options & OPT_GEN_DEBUG); | |
788 gaim_prefs_set_bool("/gaim/gtk/browsers/new_window", | |
789 general_options & OPT_GEN_BROWSER_POPUP); | |
790 gaim_prefs_set_bool("/gaim/gtk/conversations/spellecheck", | |
791 general_options & OPT_GEN_CHECK_SPELLING); | |
792 gaim_prefs_set_bool("/gaim/gtk/conversations/chat/raise_on_events", | |
793 general_options & OPT_GEN_POPUP_CHAT); | |
794 gaim_prefs_set_bool("/core/conversations/away_back_on_send", | |
795 general_options & OPT_GEN_BACK_ON_IM); | |
796 gaim_prefs_set_bool("/gaim/gtk/conversations/html_shortcuts", | |
797 general_options & OPT_GEN_CTL_CHARS); | |
798 gaim_prefs_set_bool("/gaim/gtk/conversations/smiley_shortcuts", | |
799 general_options & OPT_GEN_CTL_SMILEYS); | |
800 gaim_prefs_set_bool("/core/away/away_when_idle", | |
801 general_options & OPT_GEN_AUTO_AWAY); | |
802 gaim_prefs_set_bool("/gaim/gtk/conversations/escape_closes", | |
803 general_options & OPT_GEN_ESC_CAN_CLOSE); | |
804 gaim_prefs_set_bool("/gaim/gtk/conversations/ctrl_enter_sends", | |
805 general_options & OPT_GEN_CTL_ENTER); | |
806 gaim_prefs_set_bool("/core/away/auto_response/enabled", | |
807 !(general_options & OPT_GEN_NO_AUTO_RESP)); | |
808 gaim_prefs_set_bool("/gaim/gtk/away/queu_messages", | |
809 general_options & OPT_AWAY_QUEUE); | |
795 } else if (!strcmp(p->option, "display_options")) { | 810 } else if (!strcmp(p->option, "display_options")) { |
796 display_options = atoi(p->value[0]); | 811 display_options = atoi(p->value[0]); |
797 read_display = TRUE; | 812 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", |
813 display_options & OPT_DISP_SHOW_TIME); | |
814 gaim_prefs_set_bool("/gaim/gtk/blist/show_group_count", | |
815 display_options & OPT_DISP_SHOW_GRPNUM); | |
816 gaim_prefs_set_bool("/gaim/gtk/blist/show_idle_time", | |
817 display_options & OPT_DISP_SHOW_IDLETIME); | |
818 gaim_prefs_set_int("/gaim/gtk/blist/button_style", | |
819 ((display_options & OPT_DISP_SHOW_BUTTON_XPM) | |
820 ? ((display_options & OPT_DISP_NO_BUTTONS) | |
821 ? GAIM_BUTTON_IMAGE : GAIM_BUTTON_TEXT_IMAGE) | |
822 : ((display_options & OPT_DISP_NO_BUTTONS) | |
823 ? GAIM_BUTTON_NONE : GAIM_BUTTON_TEXT))); | |
824 gaim_prefs_set_bool("/gaim/gtk/conversations/ignore_colors", | |
825 display_options & OPT_DISP_IGNORE_COLOUR); | |
826 gaim_prefs_set_bool("/core/conversations/im/show_login", | |
827 display_options & OPT_DISP_SHOW_LOGON); | |
828 gaim_prefs_set_bool("/gaim/gtk/conversations/show_smileys", | |
829 display_options & OPT_DISP_SHOW_SMILEY); | |
830 gaim_prefs_set_bool("/core/conversations/chat/show_join", | |
831 display_options & OPT_DISP_CHAT_LOGON); | |
832 gaim_prefs_set_bool("/gaim/gtk/conversations/im/button_type", | |
833 ((display_options & OPT_DISP_CONV_BUTTON_XPM) | |
834 ? ((display_options & OPT_DISP_CONV_BUTTON_TEXT) | |
835 ? GAIM_BUTTON_TEXT_IMAGE : GAIM_BUTTON_IMAGE) | |
836 : ((display_options & OPT_DISP_CONV_BUTTON_TEXT) | |
837 ? GAIM_BUTTON_TEXT : GAIM_BUTTON_NONE))); | |
838 gaim_prefs_set_bool("/gaim/gtk/conversations/chat/button_type", | |
839 ((display_options & OPT_DISP_CHAT_BUTTON_XPM) | |
840 ? ((display_options & OPT_DISP_CHAT_BUTTON_TEXT) | |
841 ? GAIM_BUTTON_TEXT_IMAGE : GAIM_BUTTON_IMAGE) | |
842 : ((display_options & OPT_DISP_CHAT_BUTTON_TEXT) | |
843 ? GAIM_BUTTON_TEXT : GAIM_BUTTON_NONE))); | |
844 gaim_prefs_set_bool("/gaim/gtk/blist/show_warning_level", | |
845 display_options & OPT_DISP_SHOW_WARN); | |
846 gaim_prefs_set_bool("/gaim/gtk/conversations/ignore_fonts", | |
847 display_options & OPT_DISP_IGNORE_FONTS); | |
848 gaim_prefs_set_bool("/gaim/gtk/conversations/ignore_font_sizes", | |
849 display_options & OPT_DISP_IGNORE_SIZES); | |
850 gaim_prefs_set_int("/gaim/gtk/conversations/tab_side", | |
851 ((display_options & OPT_DISP_CONV_SIDE_TAB) | |
852 ? ((display_options & OPT_DISP_CONV_BR_TAB) | |
853 ? GTK_POS_RIGHT : GTK_POS_LEFT) | |
854 : ((display_options & OPT_DISP_CONV_BR_TAB) | |
855 ? GTK_POS_BOTTOM : GTK_POS_TOP))); | |
798 } else if (!strcmp(p->option, "misc_options")) { | 856 } else if (!strcmp(p->option, "misc_options")) { |
799 misc_options = atoi(p->value[0]); | 857 misc_options = atoi(p->value[0]); |
800 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", | 858 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", |
801 misc_options & OPT_MISC_DEBUG); | 859 misc_options & OPT_MISC_DEBUG); |
802 gaim_prefs_set_bool("/gaim/gtk/browsers/new_window", | 860 gaim_prefs_set_bool("/gaim/gtk/browsers/new_window", |
1033 gaim_prefs_set_string("/gaim/gtk/idle/reporting_method", | 1091 gaim_prefs_set_string("/gaim/gtk/idle/reporting_method", |
1034 "none"); | 1092 "none"); |
1035 break; | 1093 break; |
1036 } | 1094 } |
1037 } else if (!strcmp(p->option, "web_browser")) { | 1095 } else if (!strcmp(p->option, "web_browser")) { |
1038 /* XXX: someone check and make sure I did these right */ | |
1039 switch(atoi(p->value[0])) { | 1096 switch(atoi(p->value[0])) { |
1040 case BROWSER_NETSCAPE: | 1097 case BROWSER_NETSCAPE: |
1041 gaim_prefs_set_string("/gaim/gtk/browsers/browser", | 1098 gaim_prefs_set_string("/gaim/gtk/browsers/browser", |
1042 "netscape"); | 1099 "netscape"); |
1043 break; | 1100 break; |
1098 } | 1155 } |
1099 | 1156 |
1100 if (read_general) { | 1157 if (read_general) { |
1101 if (!read_logging) { | 1158 if (!read_logging) { |
1102 logging_options = 0; | 1159 logging_options = 0; |
1103 if (general_options & OPT_GEN_LOG_ALL) | 1160 gaim_prefs_set_bool("/gaim/gtk/logging/log_ims", |
1104 logging_options |= OPT_LOG_CONVOS | OPT_LOG_CHATS; | 1161 general_options & OPT_GEN_LOG_ALL); |
1105 if (general_options & OPT_GEN_STRIP_HTML) | 1162 gaim_prefs_set_bool("/gaim/gtk/logging/log_chats", |
1106 logging_options |= OPT_LOG_STRIP_HTML; | 1163 general_options & OPT_GEN_LOG_ALL); |
1107 } | 1164 gaim_prefs_set_bool("/gaim/gtk/logging/strip_html", |
1108 for (i = 0; gen_replace[i].val; i++) | 1165 general_options & OPT_GEN_STRIP_HTML); |
1109 if (general_options & gen_replace[i].old) | 1166 } |
1110 *gen_replace[i].val |= gen_replace[i].new; | 1167 } |
1111 } | |
1112 | |
1113 if (read_display) | |
1114 for (i = 0; disp_replace[i].val; i++) | |
1115 if (display_options & disp_replace[i].old) | |
1116 *disp_replace[i].val |= disp_replace[i].new; | |
1117 | 1168 |
1118 if (misc_options & OPT_MISC_BUDDY_TICKER) { | 1169 if (misc_options & OPT_MISC_BUDDY_TICKER) { |
1119 if (gaim_plugins_enabled()) { | 1170 if (gaim_plugins_enabled()) { |
1120 gchar* buf; | 1171 gchar* buf; |
1121 | 1172 |