Mercurial > pidgin
diff src/protocols/yahoo/yahoo.c @ 3630:9682c0e022c6
[gaim-migrate @ 3753]
Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 11 Oct 2002 03:14:01 +0000 |
parents | bb966d68f9e3 |
children | 1c39909fb476 |
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c Fri Oct 11 02:10:08 2002 +0000 +++ b/src/protocols/yahoo/yahoo.c Fri Oct 11 03:14:01 2002 +0000 @@ -24,17 +24,21 @@ #include "config.h" #endif - +#ifndef _WIN32 #include <netdb.h> #include <unistd.h> -#include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <sys/socket.h> +#else +#include <winsock.h> +#endif + +#include <errno.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> -#include <sys/socket.h> #include <sys/stat.h> #include <ctype.h> #include "multi.h" @@ -43,8 +47,15 @@ #include "proxy.h" #include "md5.h" +#ifdef _WIN32 +#include "win32dep.h" +#endif + extern char *yahoo_crypt(char *, char *); +/* for win32 compatability */ +G_MODULE_IMPORT GSList *connections; + #include "pixmaps/status-away.xpm" #include "pixmaps/status-here.xpm" #include "pixmaps/status-idle.xpm" @@ -354,8 +365,11 @@ yahoo_packet_write(pkt, data + pos); yahoo_packet_dump(data, len); +#ifndef _WIN32 ret = write(yd->fd, data, len); - +#else + ret = send(yd->fd, data, len, 0); +#endif g_free(data); return ret; @@ -877,9 +891,19 @@ char buf[1024]; int len; +#ifndef _WIN32 len = read(yd->fd, buf, sizeof(buf)); +#else + len = recv(yd->fd, buf, sizeof(buf), 0); +#endif if (len <= 0) { +#ifdef _WIN32 + if(len == SOCKET_ERROR) + debug_printf("Error reading socket: %d\n", WSAGetLastError()); + else if( len == 0 ) + debug_printf("Connection was gracefully closed.\n"); +#endif hide_login_progress_error(gc, "Unable to read"); signoff(gc); return; @@ -941,7 +965,11 @@ struct yahoo_packet *pkt; if (!g_slist_find(connections, gc)) { +#ifndef _WIN32 close(source); +#else + closesocket(source); +#endif return; } @@ -1009,7 +1037,11 @@ g_hash_table_foreach_remove(yd->games, yahoo_destroy_hash, NULL); g_hash_table_destroy(yd->games); if (yd->fd >= 0) +#ifndef _WIN32 close(yd->fd); +#else + closesocket(yd->fd); +#endif if (yd->rxqueue) g_free(yd->rxqueue); yd->rxlen = 0; @@ -1410,7 +1442,7 @@ static struct prpl *my_protocol = NULL; -void yahoo_init(struct prpl *ret) { +G_MODULE_EXPORT void yahoo_init(struct prpl *ret) { struct proto_user_opt *puo; ret->protocol = PROTO_YAHOO; ret->options = OPT_PROTO_MAIL_CHECK; @@ -1448,7 +1480,7 @@ #ifndef STATIC -void *gaim_prpl_init(struct prpl *prpl) +G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) { yahoo_init(prpl); prpl->plug->desc.api_version = PLUGIN_API_VERSION;