# HG changeset patch # User Belgin Știrbu # Date 1650039202 18000 # Node ID f20e9970a54f0efca496de14e5e21bc55b5245b4 # Parent acd1360af5cbcc8db22a6a4b18cd3c53f7889509 Fix IRC file transfers on Windows This might also fix some other things, like getsockname error #10014 Testing Done: Tested on Windows and Linux. Executed some file transfers over IRC and they worked. Bugs closed: PIDGIN-17175 Reviewed at https://reviews.imfreedom.org/r/1382/ diff -r acd1360af5cb -r f20e9970a54f libpurple/network.c --- a/libpurple/network.c Thu Apr 07 22:33:38 2022 -0500 +++ b/libpurple/network.c Fri Apr 15 11:13:22 2022 -0500 @@ -441,6 +441,14 @@ * XXX - Try IPv6 addresses first? */ for (next = res; next != NULL; next = next->ai_next) { +#if _WIN32 + /* + * On Windows, the address family for the transport + * address should always be set to AF_INET. + */ + if(next->ai_family != AF_INET) + continue; +#endif listenfd = socket(next->ai_family, next->ai_socktype, next->ai_protocol); if (listenfd < 0) continue; @@ -598,7 +606,7 @@ unsigned short purple_network_get_port_from_fd(int fd) { - struct sockaddr_in addr; + common_sockaddr_t addr; socklen_t len; g_return_val_if_fail(fd >= 0, 0); @@ -609,7 +617,7 @@ return 0; } - return ntohs(addr.sin_port); + return ntohs(addr.in.sin_port); } #ifdef _WIN32