Changeset e046390 for protocols/purple
- Timestamp:
- 2009-10-10T23:25:54Z (15 years ago)
- Branches:
- master
- Children:
- c5c18c1
- Parents:
- 0cbef26
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
r0cbef26 re046390 63 63 } 64 64 65 static void purple_glib_io_destroy(gpointer data) 66 { 67 g_free(data); 68 } 69 70 static gboolean purple_glib_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) 71 { 72 PurpleGLibIOClosure *closure = data; 73 PurpleInputCondition purple_cond = 0; 74 75 if (condition & PURPLE_GLIB_READ_COND) 76 purple_cond |= PURPLE_INPUT_READ; 77 if (condition & PURPLE_GLIB_WRITE_COND) 78 purple_cond |= PURPLE_INPUT_WRITE; 79 80 closure->function(closure->data, g_io_channel_unix_get_fd(source), 81 purple_cond); 82 83 return TRUE; 84 } 85 86 static guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, 87 gpointer data) 88 { 89 PurpleGLibIOClosure *closure = g_new0(PurpleGLibIOClosure, 1); 90 GIOChannel *channel; 91 GIOCondition cond = 0; 92 93 closure->function = function; 94 closure->data = data; 95 96 if (condition & PURPLE_INPUT_READ) 97 cond |= PURPLE_GLIB_READ_COND; 98 if (condition & PURPLE_INPUT_WRITE) 99 cond |= PURPLE_GLIB_WRITE_COND; 100 101 channel = g_io_channel_unix_new(fd); 102 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, 103 purple_glib_io_invoke, closure, purple_glib_io_destroy); 104 105 g_io_channel_unref(channel); 106 return closure->result; 65 static guint prplcb_ev_timeout_add( guint interval, GSourceFunc func, gpointer udata ) 66 { 67 return b_timeout_add( interval, (b_event_handler) func, udata ); 68 } 69 70 static guint prplcb_ev_input_add( int fd, PurpleInputCondition cond, PurpleInputFunction func, gpointer udata ) 71 { 72 return (guint) b_input_add( fd, cond, (b_event_handler) func, udata ); 107 73 } 108 74 109 75 static PurpleEventLoopUiOps glib_eventloops = 110 76 { 111 g_timeout_add, 112 g_source_remove, 113 glib_input_add, 114 g_source_remove, 115 NULL, 116 #if GLIB_CHECK_VERSION(2,14,0) 117 g_timeout_add_seconds, 118 #else 119 NULL, 120 #endif 121 122 /* padding */ 123 NULL, 124 NULL, 125 NULL 77 prplcb_ev_timeout_add, 78 b_event_remove, 79 prplcb_ev_input_add, 80 b_event_remove, 126 81 }; 127 82 … … 137 92 PurpleAccount *pa; 138 93 //PurpleSavedStatus *ps; 139 GList *i;94 //GList *i; 140 95 141 96 /* For now this is needed in the _connected() handlers if using … … 343 298 NULL, /* write_chat */ 344 299 prplcb_conv_im, /* write_im */ 345 NULL, //null_write_conv,/* write_conv */300 NULL, /* write_conv */ 346 301 NULL, /* chat_add_users */ 347 302 NULL, /* chat_rename_user */ … … 381 336 { 382 337 GList *prots; 338 339 if( B_EV_IO_READ != PURPLE_INPUT_READ || 340 B_EV_IO_WRITE != PURPLE_INPUT_WRITE ) 341 { 342 /* FIXME FIXME FIXME FIXME FIXME :-) */ 343 exit( 1 ); 344 } 383 345 384 346 purple_util_set_user_dir("/tmp");
Note: See TracChangeset
for help on using the changeset viewer.