Mercurial > pidgin.yaz
comparison plugins/msn/msn.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 | 466fc4ada7cb |
children | 1c977d995da9 |
comparison
equal
deleted
inserted
replaced
1880:b8245bcce7e6 | 1881:a02584b98823 |
---|---|
63 | 63 |
64 #define MSN_SIGNON_GOT_XFR 0x0001 | 64 #define MSN_SIGNON_GOT_XFR 0x0001 |
65 #define MSN_SIGNON_SENT_USR 0x0002 | 65 #define MSN_SIGNON_SENT_USR 0x0002 |
66 | 66 |
67 #define USEROPT_HOTMAIL 0 | 67 #define USEROPT_HOTMAIL 0 |
68 /* eventually, everything should probably use the same proxy setup, so we'll borrow this from TOC/IRC */ | |
69 #define USEROPT_PROXYSERV 2 | |
70 #define USEROPT_PROXYPORT 3 | |
71 #define USEROPT_PROXYTYPE 4 | |
72 #define USEROPT_USER 5 | |
73 #define USEROPT_PASS 6 | |
74 | 68 |
75 struct mod_usr_opt { | 69 struct mod_usr_opt { |
76 struct aim_user *user; | 70 struct aim_user *user; |
77 int opt; | 71 int opt; |
78 }; | 72 }; |
561 /* Set up our struct with user and input watcher */ | 555 /* Set up our struct with user and input watcher */ |
562 mc->user = g_strdup(res[5]); | 556 mc->user = g_strdup(res[5]); |
563 mc->secret = g_strdup(res[4]); | 557 mc->secret = g_strdup(res[4]); |
564 mc->session = g_strdup(res[1]); | 558 mc->session = g_strdup(res[1]); |
565 | 559 |
566 mc->fd = proxy_connect(address[0], atoi(address[1]), | 560 mc->fd = proxy_connect(address[0], atoi(address[1]), msn_answer_callback, mc); |
567 gc->user->proto_opt[USEROPT_PROXYSERV], | |
568 atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), | |
569 atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), | |
570 gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], | |
571 msn_answer_callback, mc); | |
572 g_strfreev(address); | 561 g_strfreev(address); |
573 g_strfreev(res); | 562 g_strfreev(res); |
574 if (!user->gc || (mc->fd < 0)) { | 563 if (!user->gc || (mc->fd < 0)) { |
575 /* Looks like we had an error connecting. */ | 564 /* Looks like we had an error connecting. */ |
576 g_free(mc->session); | 565 g_free(mc->session); |
609 debug_printf("Connecting to: %s:%s\n", res[0], res[1]); | 598 debug_printf("Connecting to: %s:%s\n", res[0], res[1]); |
610 | 599 |
611 if (mc->inpa) | 600 if (mc->inpa) |
612 gdk_input_remove(mc->inpa); | 601 gdk_input_remove(mc->inpa); |
613 | 602 |
614 mc->fd = proxy_connect(res[0], atoi(res[1]), | 603 mc->fd = proxy_connect(res[0], atoi(res[1]), msn_xfr_callback, mc); |
615 gc->user->proto_opt[USEROPT_PROXYSERV], | |
616 atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), | |
617 atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), | |
618 gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], | |
619 msn_xfr_callback, mc); | |
620 g_strfreev(res); | 604 g_strfreev(res); |
621 | 605 |
622 return; | 606 return; |
623 } else if (!strncmp("LST ", buf, 4)) { | 607 } else if (!strncmp("LST ", buf, 4)) { |
624 char **res; | 608 char **res; |
805 | 789 |
806 gdk_input_remove(gc->inpa); | 790 gdk_input_remove(gc->inpa); |
807 gc->inpa = 0; | 791 gc->inpa = 0; |
808 | 792 |
809 /* Now we have the host and port */ | 793 /* Now we have the host and port */ |
810 md->fd = proxy_connect(res[0], atoi(res[1]), | 794 md->fd = proxy_connect(res[0], atoi(res[1]), msn_login_callback, gc); |
811 gc->user->proto_opt[USEROPT_PROXYSERV], | |
812 atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), | |
813 atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), | |
814 gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], | |
815 msn_login_callback, gc); | |
816 if (!user->gc || (md->fd < 0)) { | 795 if (!user->gc || (md->fd < 0)) { |
817 g_strfreev(res); | 796 g_strfreev(res); |
818 hide_login_progress(gc, "Error connecting to server"); | 797 hide_login_progress(gc, "Error connecting to server"); |
819 signoff(gc); | 798 signoff(gc); |
820 return; | 799 return; |
912 return; | 891 return; |
913 | 892 |
914 md->status = 0; | 893 md->status = 0; |
915 | 894 |
916 sprintf(gc->username, "%s", msn_normalize(gc->username)); | 895 sprintf(gc->username, "%s", msn_normalize(gc->username)); |
917 md->fd = proxy_connect("messenger.hotmail.com", 1863, | 896 md->fd = proxy_connect("messenger.hotmail.com", 1863, msn_login_callback, gc); |
918 user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), | |
919 atoi(user->proto_opt[USEROPT_PROXYTYPE]), | |
920 user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], | |
921 msn_login_callback, gc); | |
922 if (!user->gc || (md->fd < 0)) { | 897 if (!user->gc || (md->fd < 0)) { |
923 hide_login_progress(gc, "Error connecting to server"); | 898 hide_login_progress(gc, "Error connecting to server"); |
924 signoff(gc); | 899 signoff(gc); |
925 return; | 900 return; |
926 } | 901 } |
1217 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); | 1192 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
1218 gtk_widget_show(button); | 1193 gtk_widget_show(button); |
1219 return button; | 1194 return button; |
1220 } | 1195 } |
1221 | 1196 |
1222 static void msn_print_option(GtkEntry *entry, struct aim_user *user) | |
1223 { | |
1224 int entrynum; | |
1225 | |
1226 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
1227 | |
1228 if (entrynum == USEROPT_PROXYSERV) { | |
1229 g_snprintf(user->proto_opt[USEROPT_PROXYSERV], | |
1230 sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); | |
1231 } else if (entrynum == USEROPT_PROXYPORT) { | |
1232 g_snprintf(user->proto_opt[USEROPT_PROXYPORT], | |
1233 sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); | |
1234 } else if (entrynum == USEROPT_USER) { | |
1235 g_snprintf(user->proto_opt[USEROPT_USER], | |
1236 sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry)); | |
1237 } else if (entrynum == USEROPT_PASS) { | |
1238 g_snprintf(user->proto_opt[USEROPT_PASS], | |
1239 sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry)); | |
1240 } | |
1241 } | |
1242 | |
1243 static void msn_print_optionrad(GtkRadioButton* entry, struct aim_user *user) | |
1244 { | |
1245 int entrynum; | |
1246 | |
1247 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); | |
1248 | |
1249 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE], | |
1250 sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum); | |
1251 } | |
1252 | |
1253 static void msn_user_opts(GtkWidget* book, struct aim_user *user) | 1197 static void msn_user_opts(GtkWidget* book, struct aim_user *user) |
1254 { | 1198 { |
1255 /* so here, we create the new notebook page */ | 1199 /* so here, we create the new notebook page */ |
1256 GtkWidget *vbox; | 1200 GtkWidget *vbox; |
1257 GtkWidget *hbox; | |
1258 GtkWidget *label; | |
1259 GtkWidget *entry; | |
1260 GtkWidget *first, *opt; | |
1261 | 1201 |
1262 vbox = gtk_vbox_new(FALSE, 5); | 1202 vbox = gtk_vbox_new(FALSE, 5); |
1263 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | 1203 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1264 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("MSN Options")); | 1204 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("MSN Options")); |
1265 gtk_widget_show(vbox); | 1205 gtk_widget_show(vbox); |
1266 | 1206 |
1267 msn_protoopt_button("Notify me of new HotMail",user,USEROPT_HOTMAIL,vbox); | 1207 msn_protoopt_button("Notify me of new HotMail",user,USEROPT_HOTMAIL,vbox); |
1268 | |
1269 hbox = gtk_hbox_new(TRUE, 0); | |
1270 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1271 gtk_widget_show(hbox); | |
1272 | |
1273 first = gtk_radio_button_new_with_label(NULL, "No proxy"); | |
1274 gtk_box_pack_start(GTK_BOX(hbox), first, FALSE, FALSE, 0); | |
1275 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); | |
1276 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(msn_print_optionrad), user); | |
1277 gtk_widget_show(first); | |
1278 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) | |
1279 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); | |
1280 | |
1281 opt = | |
1282 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); | |
1283 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1284 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); | |
1285 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(msn_print_optionrad), user); | |
1286 gtk_widget_show(opt); | |
1287 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) | |
1288 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
1289 | |
1290 hbox = gtk_hbox_new(TRUE, 0); | |
1291 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1292 gtk_widget_show(hbox); | |
1293 | |
1294 opt = | |
1295 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); | |
1296 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1297 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); | |
1298 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(msn_print_optionrad), user); | |
1299 gtk_widget_show(opt); | |
1300 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) | |
1301 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
1302 | |
1303 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); | |
1304 gtk_box_pack_start(GTK_BOX(hbox), opt, FALSE, FALSE, 0); | |
1305 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); | |
1306 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(msn_print_optionrad), user); | |
1307 gtk_widget_show(opt); | |
1308 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) | |
1309 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | |
1310 | |
1311 hbox = gtk_hbox_new(FALSE, 0); | |
1312 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1313 gtk_widget_show(hbox); | |
1314 | |
1315 label = gtk_label_new("Proxy Host:"); | |
1316 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1317 gtk_widget_show(label); | |
1318 | |
1319 entry = gtk_entry_new(); | |
1320 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1321 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYSERV); | |
1322 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); | |
1323 if (user->proto_opt[USEROPT_PROXYSERV][0]) { | |
1324 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); | |
1325 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); | |
1326 } | |
1327 gtk_widget_show(entry); | |
1328 | |
1329 hbox = gtk_hbox_new(FALSE, 0); | |
1330 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1331 gtk_widget_show(hbox); | |
1332 | |
1333 label = gtk_label_new("Proxy Port:"); | |
1334 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1335 gtk_widget_show(label); | |
1336 | |
1337 entry = gtk_entry_new(); | |
1338 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1339 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PROXYPORT); | |
1340 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); | |
1341 if (user->proto_opt[USEROPT_PROXYPORT][0]) { | |
1342 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); | |
1343 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); | |
1344 } | |
1345 gtk_widget_show(entry); | |
1346 | |
1347 hbox = gtk_hbox_new(FALSE, 0); | |
1348 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1349 gtk_widget_show(hbox); | |
1350 | |
1351 label = gtk_label_new("Proxy User:"); | |
1352 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1353 gtk_widget_show(label); | |
1354 | |
1355 entry = gtk_entry_new(); | |
1356 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1357 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER); | |
1358 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); | |
1359 if (user->proto_opt[USEROPT_USER][0]) { | |
1360 debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]); | |
1361 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]); | |
1362 } | |
1363 gtk_widget_show(entry); | |
1364 | |
1365 hbox = gtk_hbox_new(FALSE, 5); | |
1366 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1367 gtk_widget_show(hbox); | |
1368 | |
1369 label = gtk_label_new("Proxy Password:"); | |
1370 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1371 gtk_widget_show(label); | |
1372 | |
1373 entry = gtk_entry_new(); | |
1374 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
1375 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
1376 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS); | |
1377 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); | |
1378 if (user->proto_opt[USEROPT_PASS][0]) { | |
1379 debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]); | |
1380 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]); | |
1381 } | |
1382 gtk_widget_show(entry); | |
1383 } | 1208 } |
1384 | 1209 |
1385 /* | 1210 /* |
1386 Process messages from Hotmail service. right now we just check for new | 1211 Process messages from Hotmail service. right now we just check for new |
1387 mail notifications, if the user has checking enabled. | 1212 mail notifications, if the user has checking enabled. |