Mercurial > pidgin
comparison libpurple/example/nullclient.c @ 23558:05d3447fb34e
disapproval of revision '3d39da6c8014095cac3a0741bf6fc26219e7aff8'
| author | Daniel Atallah <daniel.atallah@gmail.com> |
|---|---|
| date | Thu, 17 Jul 2008 04:49:35 +0000 |
| parents | aaaff38e144f |
| children |
comparison
equal
deleted
inserted
replaced
| 23557:aaaff38e144f | 23558:05d3447fb34e |
|---|---|
| 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 | |
| 31 #include <unistd.h> | 30 #include <unistd.h> |
| 32 #else | |
| 33 #include "win32/win32dep.h" | |
| 34 #endif | |
| 35 | |
| 36 | 31 |
| 37 #include "defines.h" | 32 #include "defines.h" |
| 38 | 33 |
| 39 /** | 34 /** |
| 40 * The following eventloop functions are used in both pidgin and purple-text. If your | 35 * The following eventloop functions are used in both pidgin and purple-text. If your |
| 83 if (condition & PURPLE_INPUT_READ) | 78 if (condition & PURPLE_INPUT_READ) |
| 84 cond |= PURPLE_GLIB_READ_COND; | 79 cond |= PURPLE_GLIB_READ_COND; |
| 85 if (condition & PURPLE_INPUT_WRITE) | 80 if (condition & PURPLE_INPUT_WRITE) |
| 86 cond |= PURPLE_GLIB_WRITE_COND; | 81 cond |= PURPLE_GLIB_WRITE_COND; |
| 87 | 82 |
| 88 #if defined _WIN32 && !defined WINPIDGIN_USE_GLIB_IO_CHANNEL | |
| 89 channel = wpurple_g_io_channel_win32_new_socket(fd); | |
| 90 #else | |
| 91 channel = g_io_channel_unix_new(fd); | 83 channel = g_io_channel_unix_new(fd); |
| 92 #endif | |
| 93 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, | 84 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, |
| 94 purple_glib_io_invoke, closure, purple_glib_io_destroy); | 85 purple_glib_io_invoke, closure, purple_glib_io_destroy); |
| 95 | 86 |
| 96 g_io_channel_unref(channel); | 87 g_io_channel_unref(channel); |
| 97 return closure->result; | 88 return closure->result; |
| 260 GMainLoop *loop = g_main_loop_new(NULL, FALSE); | 251 GMainLoop *loop = g_main_loop_new(NULL, FALSE); |
| 261 PurpleAccount *account; | 252 PurpleAccount *account; |
| 262 PurpleSavedStatus *status; | 253 PurpleSavedStatus *status; |
| 263 char *res; | 254 char *res; |
| 264 | 255 |
| 265 #ifndef _WIN32 | |
| 266 /* libpurple's built-in DNS resolution forks processes to perform | 256 /* libpurple's built-in DNS resolution forks processes to perform |
| 267 * blocking lookups without blocking the main process. It does not | 257 * blocking lookups without blocking the main process. It does not |
| 268 * handle SIGCHLD itself, so if the UI does not you quickly get an army | 258 * handle SIGCHLD itself, so if the UI does not you quickly get an army |
| 269 * of zombie subprocesses marching around. | 259 * of zombie subprocesses marching around. |
| 270 */ | 260 */ |
| 271 signal(SIGCHLD, SIG_IGN); | 261 signal(SIGCHLD, SIG_IGN); |
| 272 #endif | |
| 273 | 262 |
| 274 init_libpurple(); | 263 init_libpurple(); |
| 275 | 264 |
| 276 printf("libpurple initialized.\n"); | 265 printf("libpurple initialized.\n"); |
| 277 | 266 |
| 303 | 292 |
| 304 /* Create the account */ | 293 /* Create the account */ |
| 305 account = purple_account_new(name, prpl); | 294 account = purple_account_new(name, prpl); |
| 306 | 295 |
| 307 /* Get the password for the account */ | 296 /* Get the password for the account */ |
| 308 //password = getpass("Password: "); | 297 password = getpass("Password: "); |
| 309 password = ""; | |
| 310 purple_account_set_password(account, password); | 298 purple_account_set_password(account, password); |
| 311 | 299 |
| 312 /* It's necessary to enable the account first. */ | 300 /* It's necessary to enable the account first. */ |
| 313 purple_account_set_enabled(account, UI_ID, TRUE); | 301 purple_account_set_enabled(account, UI_ID, TRUE); |
| 314 | 302 |
