comparison libpurple/protocols/gg/lib/dcc7.c @ 29939:db6735e579f8

Partially fix libgadu build on Win32. Refs #10542. I'm still not sure how to handle all the stuff in resolver.c for DNS resolution. I couldn't quite see how to reconcile our earlier stuff with this new code. Hopefully a more skilled Win32 developer can finish this.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Mon, 22 Feb 2010 00:36:15 +0000
parents 6359fde67f4c
children a42f7d3ad459
comparison
equal deleted inserted replaced
29938:6359fde67f4c 29939:db6735e579f8
26 * \file dcc7.c 26 * \file dcc7.c
27 * 27 *
28 * \brief Obsługa połączeń bezpośrednich od wersji Gadu-Gadu 7.x 28 * \brief Obsługa połączeń bezpośrednich od wersji Gadu-Gadu 7.x
29 */ 29 */
30 30
31 #include "libgadu.h"
32
31 #include <sys/types.h> 33 #include <sys/types.h>
32 #include <sys/stat.h> 34 #include <sys/stat.h>
33 #include <sys/ioctl.h> 35
34 #include <sys/socket.h> 36 #ifndef _WIN32
35 #include <netinet/in.h> 37 # include <sys/ioctl.h>
36 #include <arpa/inet.h> 38 # include <sys/socket.h>
37 #ifdef sun 39 # include <netinet/in.h>
38 # include <sys/filio.h> 40 # include <arpa/inet.h>
41 # ifdef sun
42 # include <sys/filio.h>
43 # endif
39 #endif 44 #endif
45
40 #include <time.h> 46 #include <time.h>
41 47
42 #include <ctype.h> 48 #include <ctype.h>
43 #include <errno.h> 49 #include <errno.h>
44 #include <fcntl.h> 50 #include <fcntl.h>
47 #include <stdio.h> 53 #include <stdio.h>
48 #include <stdlib.h> 54 #include <stdlib.h>
49 #include <unistd.h> 55 #include <unistd.h>
50 56
51 #include "compat.h" 57 #include "compat.h"
52 #include "libgadu.h"
53 58
54 #define gg_debug_dcc(dcc, fmt...) \ 59 #define gg_debug_dcc(dcc, fmt...) \
55 gg_debug_session((dcc) ? (dcc)->sess : NULL, fmt) 60 gg_debug_session((dcc) ? (dcc)->sess : NULL, fmt)
56 61
57 /** 62 /**
940 switch (dcc->state) { 945 switch (dcc->state) {
941 case GG_STATE_LISTENING: 946 case GG_STATE_LISTENING:
942 { 947 {
943 struct sockaddr_in sin; 948 struct sockaddr_in sin;
944 int fd, one = 1; 949 int fd, one = 1;
945 unsigned int sin_len = sizeof(sin); 950 socklen_t sin_len = sizeof(sin);
946 951
947 gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_LISTENING\n"); 952 gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() GG_STATE_LISTENING\n");
948 953
949 if ((fd = accept(dcc->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { 954 if ((fd = accept(dcc->fd, (struct sockaddr*) &sin, &sin_len)) == -1) {
950 gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() accept() failed (%s)\n", strerror(errno)); 955 gg_debug_dcc(dcc, GG_DEBUG_MISC, "// gg_dcc7_watch_fd() accept() failed (%s)\n", strerror(errno));