comparison plugins/irc.c @ 1843:4dbd8533d209

[gaim-migrate @ 1853] http can be authenticated committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 12 May 2001 08:09:54 +0000
parents 1d137dde946f
children 9845deede1e9
comparison
equal deleted inserted replaced
1842:1d137dde946f 1843:4dbd8533d209
49 #define USEROPT_SERV 0 49 #define USEROPT_SERV 0
50 #define USEROPT_PORT 1 50 #define USEROPT_PORT 1
51 #define USEROPT_PROXYSERV 2 51 #define USEROPT_PROXYSERV 2
52 #define USEROPT_PROXYPORT 3 52 #define USEROPT_PROXYPORT 3
53 #define USEROPT_PROXYTYPE 4 53 #define USEROPT_PROXYTYPE 4
54 #define USEROPT_USER 5
55 #define USEROPT_PASS 6
54 56
55 57
56 static int chat_id = 0; 58 static int chat_id = 0;
57 59
58 struct irc_channel { 60 struct irc_channel {
1225 set_login_progress(gc, 2, buf); 1227 set_login_progress(gc, 2, buf);
1226 1228
1227 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], 1229 idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV],
1228 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667, 1230 user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667,
1229 user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), 1231 user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]),
1230 atoi(user->proto_opt[USEROPT_PROXYTYPE]), irc_login_callback, gc); 1232 atoi(user->proto_opt[USEROPT_PROXYTYPE]),
1233 user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS],
1234 irc_login_callback, gc);
1231 if (idata->fd < 0) { 1235 if (idata->fd < 0) {
1232 hide_login_progress(gc, "Unable to create socket"); 1236 hide_login_progress(gc, "Unable to create socket");
1233 signoff(gc); 1237 signoff(gc);
1234 return; 1238 return;
1235 } 1239 }
1251 g_snprintf(user->proto_opt[USEROPT_PROXYSERV], 1255 g_snprintf(user->proto_opt[USEROPT_PROXYSERV],
1252 sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); 1256 sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry));
1253 } else if (entrynum == USEROPT_PROXYPORT) { 1257 } else if (entrynum == USEROPT_PROXYPORT) {
1254 g_snprintf(user->proto_opt[USEROPT_PROXYPORT], 1258 g_snprintf(user->proto_opt[USEROPT_PROXYPORT],
1255 sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); 1259 sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry));
1260 } else if (entrynum == USEROPT_USER) {
1261 g_snprintf(user->proto_opt[USEROPT_USER],
1262 sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry));
1263 } else if (entrynum == USEROPT_PASS) {
1264 g_snprintf(user->proto_opt[USEROPT_PASS],
1265 sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry));
1256 } 1266 }
1257 } 1267 }
1258 1268
1259 static void irc_print_optionrad(GtkRadioButton * entry, struct aim_user *user) 1269 static void irc_print_optionrad(GtkRadioButton * entry, struct aim_user *user)
1260 { 1270 {
1307 gtk_widget_show(label); 1317 gtk_widget_show(label);
1308 1318
1309 entry = gtk_entry_new(); 1319 entry = gtk_entry_new();
1310 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); 1320 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1311 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT); 1321 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT);
1322 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1312 if (user->proto_opt[USEROPT_PORT][0]) { 1323 if (user->proto_opt[USEROPT_PORT][0]) {
1313 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); 1324 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]);
1314 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); 1325 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]);
1315 } else { 1326 } else
1316 gtk_entry_set_text(GTK_ENTRY(entry), "6667"); 1327 gtk_entry_set_text(GTK_ENTRY(entry), "9898");
1317 } 1328
1318 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1319 gtk_widget_show(entry); 1329 gtk_widget_show(entry);
1330
1331 hbox = gtk_hbox_new(TRUE, 0);
1332 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1333 gtk_widget_show(hbox);
1334
1335 first = gtk_radio_button_new_with_label(NULL, "No proxy");
1336 gtk_box_pack_start(GTK_BOX(hbox), first, FALSE, FALSE, 0);
1337 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE);
1338 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user);
1339 gtk_widget_show(first);
1340 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE)
1341 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE);
1342
1343 opt =
1344 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4");
1345 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0);
1346 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4);
1347 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user);
1348 gtk_widget_show(opt);
1349 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4)
1350 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
1351
1352 hbox = gtk_hbox_new(TRUE, 0);
1353 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1354 gtk_widget_show(hbox);
1355
1356 opt =
1357 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5");
1358 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0);
1359 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5);
1360 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user);
1361 gtk_widget_show(opt);
1362 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5)
1363 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
1364
1365 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP");
1366 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0);
1367 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP);
1368 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user);
1369 gtk_widget_show(opt);
1370 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP)
1371 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
1320 1372
1321 hbox = gtk_hbox_new(FALSE, 0); 1373 hbox = gtk_hbox_new(FALSE, 0);
1322 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); 1374 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1323 gtk_widget_show(hbox); 1375 gtk_widget_show(hbox);
1324 1376
1352 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); 1404 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]);
1353 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); 1405 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]);
1354 } 1406 }
1355 gtk_widget_show(entry); 1407 gtk_widget_show(entry);
1356 1408
1357 first = gtk_radio_button_new_with_label(NULL, "No proxy"); 1409 hbox = gtk_hbox_new(FALSE, 0);
1358 gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0); 1410 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1359 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); 1411 gtk_widget_show(hbox);
1360 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); 1412
1361 gtk_widget_show(first); 1413 label = gtk_label_new("HTTP User:");
1362 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) 1414 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1363 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); 1415 gtk_widget_show(label);
1364 1416
1365 opt = 1417 entry = gtk_entry_new();
1366 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); 1418 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1367 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); 1419 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER);
1368 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); 1420 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1369 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); 1421 if (user->proto_opt[USEROPT_USER][0]) {
1370 gtk_widget_show(opt); 1422 debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]);
1371 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) 1423 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]);
1372 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); 1424 }
1373 1425 gtk_widget_show(entry);
1374 opt = 1426
1375 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); 1427 hbox = gtk_hbox_new(FALSE, 5);
1376 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); 1428 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1377 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); 1429 gtk_widget_show(hbox);
1378 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); 1430
1379 gtk_widget_show(opt); 1431 label = gtk_label_new("HTTP Password:");
1380 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) 1432 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
1381 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); 1433 gtk_widget_show(label);
1382 1434
1383 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); 1435 entry = gtk_entry_new();
1384 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); 1436 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
1385 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); 1437 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
1386 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(irc_print_optionrad), user); 1438 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS);
1387 gtk_widget_show(opt); 1439 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user);
1388 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) 1440 if (user->proto_opt[USEROPT_PASS][0]) {
1389 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); 1441 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]);
1442 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]);
1443 }
1444 gtk_widget_show(entry);
1390 } 1445 }
1391 1446
1392 static char **irc_list_icon(int uc) 1447 static char **irc_list_icon(int uc)
1393 { 1448 {
1394 return free_icon_xpm; 1449 return free_icon_xpm;