comparison libpurple/example/nullclient.c @ 29486:3015b7c2bec3

incomplete win32 fixes
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 25 Feb 2010 05:09:02 +0000
parents 68f8adb67470
children a8cc50c2279f
comparison
equal deleted inserted replaced
29485:2071b92780e5 29486:3015b7c2bec3
25 25
26 #include <glib.h> 26 #include <glib.h>
27 27
28 #include <signal.h> 28 #include <signal.h>
29 #include <string.h> 29 #include <string.h>
30 #ifndef _WIN32
30 #include <unistd.h> 31 #include <unistd.h>
32 #else
33 #include "win32/win32dep.h"
34 #endif
31 35
32 #include "defines.h" 36 #include "defines.h"
33 37
34 /** 38 /**
35 * The following eventloop functions are used in both pidgin and purple-text. If your 39 * The following eventloop functions are used in both pidgin and purple-text. If your
78 if (condition & PURPLE_INPUT_READ) 82 if (condition & PURPLE_INPUT_READ)
79 cond |= PURPLE_GLIB_READ_COND; 83 cond |= PURPLE_GLIB_READ_COND;
80 if (condition & PURPLE_INPUT_WRITE) 84 if (condition & PURPLE_INPUT_WRITE)
81 cond |= PURPLE_GLIB_WRITE_COND; 85 cond |= PURPLE_GLIB_WRITE_COND;
82 86
87 #if defined _WIN32 && !defined WINPIDGIN_USE_GLIB_IO_CHANNEL
88 channel = wpurple_g_io_channel_win32_new_socket(fd);
89 #else
83 channel = g_io_channel_unix_new(fd); 90 channel = g_io_channel_unix_new(fd);
91 #endif
84 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, 92 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
85 purple_glib_io_invoke, closure, purple_glib_io_destroy); 93 purple_glib_io_invoke, closure, purple_glib_io_destroy);
86 94
87 g_io_channel_unref(channel); 95 g_io_channel_unref(channel);
88 return closure->result; 96 return closure->result;
251 GMainLoop *loop = g_main_loop_new(NULL, FALSE); 259 GMainLoop *loop = g_main_loop_new(NULL, FALSE);
252 PurpleAccount *account; 260 PurpleAccount *account;
253 PurpleSavedStatus *status; 261 PurpleSavedStatus *status;
254 char *res; 262 char *res;
255 263
264 #ifndef _WIN32
256 /* libpurple's built-in DNS resolution forks processes to perform 265 /* libpurple's built-in DNS resolution forks processes to perform
257 * blocking lookups without blocking the main process. It does not 266 * blocking lookups without blocking the main process. It does not
258 * handle SIGCHLD itself, so if the UI does not you quickly get an army 267 * handle SIGCHLD itself, so if the UI does not you quickly get an army
259 * of zombie subprocesses marching around. 268 * of zombie subprocesses marching around.
260 */ 269 */
261 signal(SIGCHLD, SIG_IGN); 270 signal(SIGCHLD, SIG_IGN);
271 #endif
262 272
263 init_libpurple(); 273 init_libpurple();
264 274
265 printf("libpurple initialized.\n"); 275 printf("libpurple initialized.\n");
266 276