comparison src/protocols/gg/gg.c @ 3717:988485669631

[gaim-migrate @ 3850] Warning fixes and WIN32 ifdef removals committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Wed, 16 Oct 2002 19:57:03 +0000
parents 9682c0e022c6
children a5c49e9c6a53
comparison
equal deleted inserted replaced
3716:d7e83b4db191 3717:988485669631
1 /* 1 /*
2 * gaim - Gadu-Gadu Protocol Plugin 2 * gaim - Gadu-Gadu Protocol Plugin
3 * $Id: gg.c 3753 2002-10-11 03:14:01Z robflynn $ 3 * $Id: gg.c 3850 2002-10-16 19:57:03Z hermanator $
4 * 4 *
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
438 struct agg_data *gd = gc->proto_data; 438 struct agg_data *gd = gc->proto_data;
439 struct gg_event *e; 439 struct gg_event *e;
440 440
441 debug_printf("GG login_callback...\n"); 441 debug_printf("GG login_callback...\n");
442 if (!g_slist_find(connections, gc)) { 442 if (!g_slist_find(connections, gc)) {
443 #ifndef _WIN32
444 close(source); 443 close(source);
445 #else
446 closesocket(source);
447 #endif
448 return; 444 return;
449 } 445 }
450 debug_printf("Found GG connection\n"); 446 debug_printf("Found GG connection\n");
451 if (gd->sess->fd != source) { 447 if (gd->sess->fd != source) {
452 gd->sess->fd = source; 448 gd->sess->fd = source;
890 886
891 if (!g_slist_find(connections, gc)) { 887 if (!g_slist_find(connections, gc)) {
892 debug_printf("search_callback: g_slist_find error\n"); 888 debug_printf("search_callback: g_slist_find error\n");
893 gaim_input_remove(hdata->inpa); 889 gaim_input_remove(hdata->inpa);
894 g_free(hdata); 890 g_free(hdata);
895 #ifndef _WIN32
896 close(source); 891 close(source);
897 #else
898 closesocket(source);
899 #endif
900 return; 892 return;
901 } 893 }
902 894
903 webdata = NULL; 895 webdata = NULL;
904 len = 0; 896 len = 0;
905 #ifndef _WIN32 897
906 while (read(source, &read_data, 1) > 0 || errno == EWOULDBLOCK) { 898 while (read(source, &read_data, 1) > 0 || errno == EWOULDBLOCK) {
907 if (errno == EWOULDBLOCK) { 899 if (errno == EWOULDBLOCK) {
908 errno = 0; 900 errno = 0;
909 #else
910 while (recv(source, &read_data, 1, 0) > 0 || WSAEWOULDBLOCK == WSAGetLastError() ) {
911 if (WSAEWOULDBLOCK == WSAGetLastError()) {
912 WSASetLastError(0);
913 #endif
914 continue; 901 continue;
915 } 902 }
916 903
917 if (!read_data) 904 if (!read_data)
918 continue; 905 continue;
924 911
925 webdata = g_realloc(webdata, len + 1); 912 webdata = g_realloc(webdata, len + 1);
926 webdata[len] = 0; 913 webdata[len] = 0;
927 914
928 gaim_input_remove(hdata->inpa); 915 gaim_input_remove(hdata->inpa);
929 #ifndef _WIN32
930 close(source); 916 close(source);
931 #else
932 closesocket(source);
933 #endif
934 917
935 debug_printf("http_results: type %d, webdata [%s]\n", hdata->type, webdata); 918 debug_printf("http_results: type %d, webdata [%s]\n", hdata->type, webdata);
936 919
937 switch (hdata->type) { 920 switch (hdata->type) {
938 case AGG_HTTP_SEARCH: 921 case AGG_HTTP_SEARCH:
971 954
972 if (!g_slist_find(connections, gc)) { 955 if (!g_slist_find(connections, gc)) {
973 debug_printf("http_req_callback: g_slist_find error\n"); 956 debug_printf("http_req_callback: g_slist_find error\n");
974 g_free(request); 957 g_free(request);
975 g_free(hdata); 958 g_free(hdata);
976 #ifndef _WIN32
977 close(source); 959 close(source);
978 #else
979 closesocket(source);
980 #endif
981 return; 960 return;
982 } 961 }
983 962
984 if (source == -1) { 963 if (source == -1) {
985 g_free(request); 964 g_free(request);
997 "Pragma: no-cache\r\n" "\r\n" "%s\r\n", 976 "Pragma: no-cache\r\n" "\r\n" "%s\r\n",
998 hdata->form, hdata->host, strlen(request), request); 977 hdata->form, hdata->host, strlen(request), request);
999 978
1000 g_free(request); 979 g_free(request);
1001 980
1002 #ifndef _WIN32
1003 if (write(source, buf, strlen(buf)) < strlen(buf)) { 981 if (write(source, buf, strlen(buf)) < strlen(buf)) {
1004 #else
1005 if (send(source, buf, strlen(buf), 0) < strlen(buf)) {
1006 #endif
1007 g_free(buf); 982 g_free(buf);
1008 g_free(hdata); 983 g_free(hdata);
1009 #ifndef _WIN32
1010 close(source); 984 close(source);
1011 #else
1012 closesocket(source);
1013 #endif
1014 do_error_dialog(_("Error communicating with Gadu-Gadu server"), 985 do_error_dialog(_("Error communicating with Gadu-Gadu server"),
1015 _("Gaim was unable to complete your request due to a problem " 986 _("Gaim was unable to complete your request due to a problem "
1016 "communicating to the Gadu-Gadu HTTP server. Please try again " 987 "communicating to the Gadu-Gadu HTTP server. Please try again "
1017 "later."), GAIM_ERROR); 988 "later."), GAIM_ERROR);
1018 return; 989 return;