Mercurial > pidgin.yaz
comparison plugins/irc.c @ 1881:a02584b98823
[gaim-migrate @ 1891]
C:)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 23 May 2001 07:59:05 +0000 |
parents | c0a69f90d662 |
children | b71494004378 |
comparison
equal
deleted
inserted
replaced
1880:b8245bcce7e6 | 1881:a02584b98823 |
---|---|
47 #define IRC_BUF_LEN 4096 | 47 #define IRC_BUF_LEN 4096 |
48 | 48 |
49 | 49 |
50 #define USEROPT_SERV 0 | 50 #define USEROPT_SERV 0 |
51 #define USEROPT_PORT 1 | 51 #define USEROPT_PORT 1 |
52 #define USEROPT_PROXYSERV 2 | |
53 #define USEROPT_PROXYPORT 3 | |
54 #define USEROPT_PROXYTYPE 4 | |
55 #define USEROPT_USER 5 | |
56 #define USEROPT_PASS 6 | |
57 | |
58 | 52 |
59 static int chat_id = 0; | 53 static int chat_id = 0; |
60 | 54 |
61 struct irc_channel { | 55 struct irc_channel { |
62 int id; | 56 int id; |
1857 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); | 1851 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
1858 set_login_progress(gc, 2, buf); | 1852 set_login_progress(gc, 2, buf); |
1859 | 1853 |
1860 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], | 1854 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], |
1861 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667, | 1855 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667, |
1862 user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), | |
1863 atoi(user->proto_opt[USEROPT_PROXYTYPE]), | |
1864 user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], | |
1865 irc_login_callback, gc); | 1856 irc_login_callback, gc); |
1866 if (!user->gc || (idata->fd < 0)) { | 1857 if (!user->gc || (idata->fd < 0)) { |
1867 hide_login_progress(gc, "Unable to create socket"); | 1858 hide_login_progress(gc, "Unable to create socket"); |
1868 signoff(gc); | 1859 signoff(gc); |
1869 return; | 1860 return; |
1880 g_snprintf(user->proto_opt[USEROPT_SERV], | 1871 g_snprintf(user->proto_opt[USEROPT_SERV], |
1881 sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry)); | 1872 sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry)); |
1882 } else if (entrynum == USEROPT_PORT) { | 1873 } else if (entrynum == USEROPT_PORT) { |
1883 g_snprintf(user->proto_opt[USEROPT_PORT], | 1874 g_snprintf(user->proto_opt[USEROPT_PORT], |
1884 sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); | 1875 sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); |
1885 } else if (entrynum == USEROPT_PROXYSERV) { | 1876 } |
1886 g_snprintf(user->proto_opt[USEROPT_PROXYSERV], | |
1887 sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); | |
1888 } else if (entrynum == USEROPT_PROXYPORT) { | |
1889 g_snprintf(user->proto_opt[USEROPT_PROXYPORT], | |
1890 sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); | |
1891 } else if (entrynum == USEROPT_USER) { | |
1892 g_snprintf(user->proto_opt[USEROPT_USER], | |
1893 sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry)); | |
1894 } else if (entrynum == USEROPT_PASS) { | |
1895 g_snprintf(user->proto_opt[USEROPT_PASS], | |
1896 sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry)); | |
1897 } | |
1898 } | |
1899 | |
1900 static void irc_print_optionrad(GtkRadioButton * entry, struct aim_user *user) | |
1901 { | |
1902 int entrynum; | |
1903 | |
1904 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
1905 | |
1906 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE], | |
1907 sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum); | |
1908 } | 1877 } |
1909 | 1878 |
1910 static void irc_user_opts(GtkWidget * book, struct aim_user *user) | 1879 static void irc_user_opts(GtkWidget * book, struct aim_user *user) |
1911 { | 1880 { |
1912 /* so here, we create the new notebook page */ | 1881 /* so here, we create the new notebook page */ |
1913 GtkWidget *vbox; | 1882 GtkWidget *vbox; |
1914 GtkWidget *hbox; | 1883 GtkWidget *hbox; |
1915 GtkWidget *label; | 1884 GtkWidget *label; |
1916 GtkWidget *entry; | 1885 GtkWidget *entry; |
1917 GtkWidget *first, *opt; | |
1918 | 1886 |
1919 vbox = gtk_vbox_new(FALSE, 5); | 1887 vbox = gtk_vbox_new(FALSE, 5); |
1920 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 1888 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1921 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("IRC Options")); | 1889 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("IRC Options")); |
1922 gtk_widget_show(vbox); | 1890 gtk_widget_show(vbox); |
1955 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); | 1923 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); |
1956 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); | 1924 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); |
1957 } else | 1925 } else |
1958 gtk_entry_set_text(GTK_ENTRY(entry), "6667"); | 1926 gtk_entry_set_text(GTK_ENTRY(entry), "6667"); |
1959 | 1927 |
1960 gtk_widget_show(entry); | |
1961 | |
1962 hbox = gtk_hbox_new(TRUE, 0); | |
1963 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1964 gtk_widget_show(hbox); | |
1965 | |
1966 first = gtk_radio_button_new_with_label(NULL, "No proxy"); | |
1967 gtk_box_pack_start(GTK_BOX(hbox), first, FALSE, FALSE, 0); | |
1968 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); | |
1969 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); | |
1970 gtk_widget_show(first); | |
1971 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) | |
1972 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); | |
1973 | |
1974 opt = | |
1975 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); | |
1976 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1977 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); | |
1978 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); | |
1979 gtk_widget_show(opt); | |
1980 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) | |
1981 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
1982 | |
1983 hbox = gtk_hbox_new(TRUE, 0); | |
1984 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1985 gtk_widget_show(hbox); | |
1986 | |
1987 opt = | |
1988 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); | |
1989 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1990 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); | |
1991 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); | |
1992 gtk_widget_show(opt); | |
1993 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) | |
1994 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
1995 | |
1996 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); | |
1997 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1998 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); | |
1999 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); | |
2000 gtk_widget_show(opt); | |
2001 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) | |
2002 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
2003 | |
2004 hbox = gtk_hbox_new(FALSE, 0); | |
2005 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2006 gtk_widget_show(hbox); | |
2007 | |
2008 label = gtk_label_new("Proxy Host:"); | |
2009 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2010 gtk_widget_show(label); | |
2011 | |
2012 entry = gtk_entry_new(); | |
2013 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
2014 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYSERV); | |
2015 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); | |
2016 if (user->proto_opt[USEROPT_PROXYSERV][0]) { | |
2017 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); | |
2018 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); | |
2019 } | |
2020 gtk_widget_show(entry); | |
2021 | |
2022 hbox = gtk_hbox_new(FALSE, 0); | |
2023 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2024 gtk_widget_show(hbox); | |
2025 | |
2026 label = gtk_label_new("Proxy Port:"); | |
2027 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2028 gtk_widget_show(label); | |
2029 | |
2030 entry = gtk_entry_new(); | |
2031 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
2032 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYPORT); | |
2033 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); | |
2034 if (user->proto_opt[USEROPT_PROXYPORT][0]) { | |
2035 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); | |
2036 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); | |
2037 } | |
2038 gtk_widget_show(entry); | |
2039 | |
2040 hbox = gtk_hbox_new(FALSE, 0); | |
2041 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2042 gtk_widget_show(hbox); | |
2043 | |
2044 label = gtk_label_new("Proxy User:"); | |
2045 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2046 gtk_widget_show(label); | |
2047 | |
2048 entry = gtk_entry_new(); | |
2049 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
2050 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER); | |
2051 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); | |
2052 if (user->proto_opt[USEROPT_USER][0]) { | |
2053 debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]); | |
2054 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]); | |
2055 } | |
2056 gtk_widget_show(entry); | |
2057 | |
2058 hbox = gtk_hbox_new(FALSE, 5); | |
2059 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
2060 gtk_widget_show(hbox); | |
2061 | |
2062 label = gtk_label_new("Proxy Password:"); | |
2063 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
2064 gtk_widget_show(label); | |
2065 | |
2066 entry = gtk_entry_new(); | |
2067 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
2068 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
2069 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS); | |
2070 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); | |
2071 if (user->proto_opt[USEROPT_PASS][0]) { | |
2072 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]); | |
2073 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]); | |
2074 } | |
2075 gtk_widget_show(entry); | 1928 gtk_widget_show(entry); |
2076 } | 1929 } |
2077 | 1930 |
2078 static char **irc_list_icon(int uc) | 1931 static char **irc_list_icon(int uc) |
2079 { | 1932 { |