comparison src/protocols/msn/msn.c @ 2090:b66aca8e8dce

[gaim-migrate @ 2100] change ../config.h to <config.h> because that's better. change from GdkInput functions to GaimInput for reasons mentioned elsewhere. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 31 Jul 2001 23:23:40 +0000
parents 424a40f12a6c
children 83d8a9b7e89b
comparison
equal deleted inserted replaced
2089:bb1ddaaf0d26 2090:b66aca8e8dce
56 struct msn_buddy { 56 struct msn_buddy {
57 char *user; 57 char *user;
58 char *friend; 58 char *friend;
59 }; 59 };
60 60
61 static void msn_login_callback(gpointer, gint, GdkInputCondition); 61 static void msn_login_callback(gpointer, gint, GaimInputCondition);
62 static void msn_login_xfr_connect(gpointer, gint, GdkInputCondition); 62 static void msn_login_xfr_connect(gpointer, gint, GaimInputCondition);
63 63
64 #define GET_NEXT(tmp) while (*(tmp) && !isspace(*(tmp))) \ 64 #define GET_NEXT(tmp) while (*(tmp) && !isspace(*(tmp))) \
65 (tmp)++; \ 65 (tmp)++; \
66 *(tmp)++ = 0; \ 66 *(tmp)++ = 0; \
67 while (*(tmp) && isspace(*(tmp))) \ 67 while (*(tmp) && isspace(*(tmp))) \
320 { 320 {
321 struct gaim_connection *gc = ms->gc; 321 struct gaim_connection *gc = ms->gc;
322 struct msn_data *md = gc->proto_data; 322 struct msn_data *md = gc->proto_data;
323 323
324 if (ms->inpa) 324 if (ms->inpa)
325 gdk_input_remove(ms->inpa); 325 gaim_input_remove(ms->inpa);
326 close(ms->fd); 326 close(ms->fd);
327 if (ms->sessid) 327 if (ms->sessid)
328 g_free(ms->sessid); 328 g_free(ms->sessid);
329 g_free(ms->auth); 329 g_free(ms->auth);
330 if (ms->user) 330 if (ms->user)
337 md->switches = g_slist_remove(md->switches, ms); 337 md->switches = g_slist_remove(md->switches, ms);
338 338
339 g_free(ms); 339 g_free(ms);
340 } 340 }
341 341
342 static void msn_switchboard_callback(gpointer data, gint source, GdkInputCondition cond) 342 static void msn_switchboard_callback(gpointer data, gint source, GaimInputCondition cond)
343 { 343 {
344 struct msn_switchboard *ms = data; 344 struct msn_switchboard *ms = data;
345 struct gaim_connection *gc = ms->gc; 345 struct gaim_connection *gc = ms->gc;
346 char buf[MSN_BUF_LEN]; 346 char buf[MSN_BUF_LEN];
347 static int id = 0; 347 static int id = 0;
492 } else { 492 } else {
493 debug_printf("Unhandled message!\n"); 493 debug_printf("Unhandled message!\n");
494 } 494 }
495 } 495 }
496 496
497 static void msn_rng_connect(gpointer data, gint source, GdkInputCondition cond) 497 static void msn_rng_connect(gpointer data, gint source, GaimInputCondition cond)
498 { 498 {
499 struct msn_switchboard *ms = data; 499 struct msn_switchboard *ms = data;
500 struct gaim_connection *gc = ms->gc; 500 struct gaim_connection *gc = ms->gc;
501 struct msn_data *md; 501 struct msn_data *md;
502 char buf[MSN_BUF_LEN]; 502 char buf[MSN_BUF_LEN];
521 g_free(ms); 521 g_free(ms);
522 return; 522 return;
523 } 523 }
524 524
525 md->switches = g_slist_append(md->switches, ms); 525 md->switches = g_slist_append(md->switches, ms);
526 ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); 526 ms->inpa = gaim_input_add(ms->fd, GAIM_INPUT_READ, msn_switchboard_callback, ms);
527 } 527 }
528 528
529 static void msn_ss_xfr_connect(gpointer data, gint source, GdkInputCondition cond) 529 static void msn_ss_xfr_connect(gpointer data, gint source, GaimInputCondition cond)
530 { 530 {
531 struct msn_switchboard *ms = data; 531 struct msn_switchboard *ms = data;
532 struct gaim_connection *gc = ms->gc; 532 struct gaim_connection *gc = ms->gc;
533 char buf[MSN_BUF_LEN]; 533 char buf[MSN_BUF_LEN];
534 534
546 g_free(ms->auth); 546 g_free(ms->auth);
547 g_free(ms); 547 g_free(ms);
548 return; 548 return;
549 } 549 }
550 550
551 ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); 551 ms->inpa = gaim_input_add(ms->fd, GAIM_INPUT_READ, msn_switchboard_callback, ms);
552 } 552 }
553 553
554 struct msn_add_permit { 554 struct msn_add_permit {
555 struct gaim_connection *gc; 555 struct gaim_connection *gc;
556 char *user; 556 char *user;
575 g_free(map->user); 575 g_free(map->user);
576 g_free(map->friend); 576 g_free(map->friend);
577 g_free(map); 577 g_free(map);
578 } 578 }
579 579
580 static void msn_callback(gpointer data, gint source, GdkInputCondition cond) 580 static void msn_callback(gpointer data, gint source, GaimInputCondition cond)
581 { 581 {
582 struct gaim_connection *gc = data; 582 struct gaim_connection *gc = data;
583 struct msn_data *md = gc->proto_data; 583 struct msn_data *md = gc->proto_data;
584 char buf[MSN_BUF_LEN]; 584 char buf[MSN_BUF_LEN];
585 int i = 0; 585 int i = 0;
883 883
884 ms->auth = g_strdup(tmp); 884 ms->auth = g_strdup(tmp);
885 ms->fd = proxy_connect(host, port, msn_ss_xfr_connect, ms); 885 ms->fd = proxy_connect(host, port, msn_ss_xfr_connect, ms);
886 } else { 886 } else {
887 close(md->fd); 887 close(md->fd);
888 gdk_input_remove(md->inpa); 888 gaim_input_remove(md->inpa);
889 md->inpa = 0; 889 md->inpa = 0;
890 md->fd = 0; 890 md->fd = 0;
891 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); 891 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc);
892 } 892 }
893 } else if (isdigit(*buf)) { 893 } else if (isdigit(*buf)) {
895 } else { 895 } else {
896 debug_printf("Unhandled message!\n"); 896 debug_printf("Unhandled message!\n");
897 } 897 }
898 } 898 }
899 899
900 static void msn_login_xfr_connect(gpointer data, gint source, GdkInputCondition cond) 900 static void msn_login_xfr_connect(gpointer data, gint source, GaimInputCondition cond)
901 { 901 {
902 struct gaim_connection *gc = data; 902 struct gaim_connection *gc = data;
903 struct msn_data *md; 903 struct msn_data *md;
904 char buf[MSN_BUF_LEN]; 904 char buf[MSN_BUF_LEN];
905 905
922 hide_login_progress(gc, "Unable to talk to Notification Server"); 922 hide_login_progress(gc, "Unable to talk to Notification Server");
923 signoff(gc); 923 signoff(gc);
924 return; 924 return;
925 } 925 }
926 926
927 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); 927 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc);
928 } 928 }
929 929
930 static void msn_login_callback(gpointer data, gint source, GdkInputCondition cond) 930 static void msn_login_callback(gpointer data, gint source, GaimInputCondition cond)
931 { 931 {
932 struct gaim_connection *gc = data; 932 struct gaim_connection *gc = data;
933 struct msn_data *md = gc->proto_data; 933 struct msn_data *md = gc->proto_data;
934 char buf[MSN_BUF_LEN]; 934 char buf[MSN_BUF_LEN];
935 int i = 0; 935 int i = 0;
1002 } 1002 }
1003 1003
1004 account_online(gc); 1004 account_online(gc);
1005 serv_finish_login(gc); 1005 serv_finish_login(gc);
1006 1006
1007 gdk_input_remove(md->inpa); 1007 gaim_input_remove(md->inpa);
1008 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_callback, gc); 1008 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_callback, gc);
1009 } else if (strstr(buf, "MD5")) { 1009 } else if (strstr(buf, "MD5")) {
1010 char *challenge = buf; 1010 char *challenge = buf;
1011 char buf2[MSN_BUF_LEN]; 1011 char buf2[MSN_BUF_LEN];
1012 md5_state_t st; 1012 md5_state_t st;
1013 md5_byte_t di[16]; 1013 md5_byte_t di[16];
1063 port = atoi(x); 1063 port = atoi(x);
1064 } else 1064 } else
1065 port = 1863; 1065 port = 1863;
1066 1066
1067 close(md->fd); 1067 close(md->fd);
1068 gdk_input_remove(md->inpa); 1068 gaim_input_remove(md->inpa);
1069 md->inpa = 0; 1069 md->inpa = 0;
1070 md->fd = 0; 1070 md->fd = 0;
1071 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); 1071 md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc);
1072 } else { 1072 } else {
1073 if (isdigit(*buf)) 1073 if (isdigit(*buf))
1077 signoff(gc); 1077 signoff(gc);
1078 return; 1078 return;
1079 } 1079 }
1080 } 1080 }
1081 1081
1082 static void msn_login_connect(gpointer data, gint source, GdkInputCondition cond) 1082 static void msn_login_connect(gpointer data, gint source, GaimInputCondition cond)
1083 { 1083 {
1084 struct gaim_connection *gc = data; 1084 struct gaim_connection *gc = data;
1085 struct msn_data *md; 1085 struct msn_data *md;
1086 char buf[1024]; 1086 char buf[1024];
1087 1087
1104 hide_login_progress(gc, "Unable to write to server"); 1104 hide_login_progress(gc, "Unable to write to server");
1105 signoff(gc); 1105 signoff(gc);
1106 return; 1106 return;
1107 } 1107 }
1108 1108
1109 md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); 1109 md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc);
1110 set_login_progress(gc, 2, "Synching with server"); 1110 set_login_progress(gc, 2, "Synching with server");
1111 } 1111 }
1112 1112
1113 static void msn_login(struct aim_user *user) 1113 static void msn_login(struct aim_user *user)
1114 { 1114 {
1125 static void msn_close(struct gaim_connection *gc) 1125 static void msn_close(struct gaim_connection *gc)
1126 { 1126 {
1127 struct msn_data *md = gc->proto_data; 1127 struct msn_data *md = gc->proto_data;
1128 close(md->fd); 1128 close(md->fd);
1129 if (md->inpa) 1129 if (md->inpa)
1130 gdk_input_remove(md->inpa); 1130 gaim_input_remove(md->inpa);
1131 while (md->switches) 1131 while (md->switches)
1132 msn_kill_switch(md->switches->data); 1132 msn_kill_switch(md->switches->data);
1133 while (md->fl) { 1133 while (md->fl) {
1134 struct msn_buddy *tmp = md->fl->data; 1134 struct msn_buddy *tmp = md->fl->data;
1135 md->fl = g_slist_remove(md->fl, tmp); 1135 md->fl = g_slist_remove(md->fl, tmp);