- Timestamp:
- 2010-06-07T14:31:07Z (14 years ago)
- Branches:
- master
- Children:
- 56699f0
- Parents:
- 0d9d53e (diff), 1fdb0a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- lib
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/Makefile
r0d9d53e r4aa0f6b 8 8 9 9 -include ../Makefile.settings 10 ifdef SRCDIR 11 SRCDIR := $(SRCDIR)lib/ 12 endif 10 13 11 14 # [SH] Program variables … … 37 40 $(objects): ../Makefile.settings Makefile 38 41 39 $(objects): %.o: %.c42 $(objects): %.o: $(SRCDIR)%.c 40 43 @echo '*' Compiling $< 41 44 @$(CC) -c $(CFLAGS) $< -o $@ -
lib/events.h
r0d9d53e r4aa0f6b 48 48 the given callback function. */ 49 49 typedef enum { 50 GAIM_INPUT_READ = 1 << 1, 51 GAIM_INPUT_WRITE = 1 << 2 50 B_EV_IO_READ = 1 << 0, 51 B_EV_IO_WRITE = 1 << 1, 52 B_EV_FLAG_FORCE_ONCE = 1 << 16, 53 B_EV_FLAG_FORCE_REPEAT = 1 << 17, 52 54 } b_input_condition; 53 55 typedef gboolean (*b_event_handler)(gpointer data, gint fd, b_input_condition cond); -
lib/events_glib.c
r0d9d53e r4aa0f6b 49 49 b_event_handler function; 50 50 gpointer data; 51 guint flags; 51 52 } GaimIOClosure; 52 53 … … 76 77 77 78 if (condition & GAIM_READ_COND) 78 gaim_cond |= GAIM_INPUT_READ;79 gaim_cond |= B_EV_IO_READ; 79 80 if (condition & GAIM_WRITE_COND) 80 gaim_cond |= GAIM_INPUT_WRITE;81 gaim_cond |= B_EV_IO_WRITE; 81 82 82 83 event_debug( "gaim_io_invoke( %d, %d, 0x%x )\n", g_io_channel_unix_get_fd(source), condition, data ); … … 87 88 event_debug( "Returned FALSE, cancelling.\n" ); 88 89 89 return st; 90 if (closure->flags & B_EV_FLAG_FORCE_ONCE) 91 return FALSE; 92 else if (closure->flags & B_EV_FLAG_FORCE_REPEAT) 93 return TRUE; 94 else 95 return st; 90 96 } 91 97 … … 105 111 closure->function = function; 106 112 closure->data = data; 113 closure->flags = condition; 107 114 108 if (condition & GAIM_INPUT_READ)115 if (condition & B_EV_IO_READ) 109 116 cond |= GAIM_READ_COND; 110 if (condition & GAIM_INPUT_WRITE)117 if (condition & B_EV_IO_WRITE) 111 118 cond |= GAIM_WRITE_COND; 112 119 -
lib/events_libevent.c
r0d9d53e r4aa0f6b 60 60 b_event_handler function; 61 61 void *data; 62 guint flags; 62 63 }; 63 64 … … 126 127 { 127 128 if( event & EV_READ ) 128 cond |= GAIM_INPUT_READ;129 cond |= B_EV_IO_READ; 129 130 if( event & EV_WRITE ) 130 cond |= GAIM_INPUT_WRITE;131 cond |= B_EV_IO_WRITE; 131 132 } 132 133 … … 150 151 return; 151 152 } 152 else if( !st )153 else if( !st && !( b_ev->flags & B_EV_FLAG_FORCE_REPEAT ) ) 153 154 { 154 155 event_debug( "Handler returned FALSE: " ); … … 174 175 event_debug( "b_input_add( %d, %d, 0x%x, 0x%x ) ", fd, condition, function, data ); 175 176 176 if( ( condition & GAIM_INPUT_READ && ( b_ev = g_hash_table_lookup( read_hash, &fd ) ) ) ||177 ( condition & GAIM_INPUT_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) )177 if( ( condition & B_EV_IO_READ && ( b_ev = g_hash_table_lookup( read_hash, &fd ) ) ) || 178 ( condition & B_EV_IO_WRITE && ( b_ev = g_hash_table_lookup( write_hash, &fd ) ) ) ) 178 179 { 179 180 /* We'll stick with this libevent entry, but give it a new BitlBee id. */ … … 198 199 199 200 out_cond = EV_PERSIST; 200 if( condition & GAIM_INPUT_READ )201 if( condition & B_EV_IO_READ ) 201 202 out_cond |= EV_READ; 202 if( condition & GAIM_INPUT_WRITE )203 if( condition & B_EV_IO_WRITE ) 203 204 out_cond |= EV_WRITE; 204 205 … … 212 213 } 213 214 215 b_ev->flags = condition; 214 216 g_hash_table_insert( id_hash, &b_ev->id, b_ev ); 215 217 return b_ev->id; -
lib/http_client.c
r0d9d53e r4aa0f6b 149 149 if( req->bytes_written < req->request_length ) 150 150 req->inpa = b_input_add( source, 151 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_WRITE,151 req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_WRITE, 152 152 http_connected, req ); 153 153 else 154 req->inpa = b_input_add( source, GAIM_INPUT_READ, http_incoming_data, req );154 req->inpa = b_input_add( source, B_EV_IO_READ, http_incoming_data, req ); 155 155 156 156 return FALSE; … … 234 234 /* There will be more! */ 235 235 req->inpa = b_input_add( req->fd, 236 req->ssl ? ssl_getdirection( req->ssl ) : GAIM_INPUT_READ,236 req->ssl ? ssl_getdirection( req->ssl ) : B_EV_IO_READ, 237 237 http_incoming_data, req ); 238 238 -
lib/proxy.c
r0d9d53e r4aa0f6b 91 91 b_event_remove(phb->inpa); 92 92 if( phb->proxy_func ) 93 phb->proxy_func(phb->proxy_data, -1, GAIM_INPUT_READ);93 phb->proxy_func(phb->proxy_data, -1, B_EV_IO_READ); 94 94 else { 95 phb->func(phb->data, -1, GAIM_INPUT_READ);95 phb->func(phb->data, -1, B_EV_IO_READ); 96 96 g_free(phb); 97 97 } … … 102 102 b_event_remove(phb->inpa); 103 103 if( phb->proxy_func ) 104 phb->proxy_func(phb->proxy_data, source, GAIM_INPUT_READ);104 phb->proxy_func(phb->proxy_data, source, B_EV_IO_READ); 105 105 else { 106 phb->func(phb->data, source, GAIM_INPUT_READ);106 phb->func(phb->data, source, B_EV_IO_READ); 107 107 g_free(phb); 108 108 } … … 147 147 return -1; 148 148 } else { 149 phb->inpa = b_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);149 phb->inpa = b_input_add(fd, B_EV_IO_WRITE, gaim_io_connected, phb); 150 150 phb->fd = fd; 151 151 … … 179 179 if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING)) == 0) || 180 180 (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) { 181 phb->func(phb->data, source, GAIM_INPUT_READ);181 phb->func(phb->data, source, B_EV_IO_READ); 182 182 g_free(phb->host); 183 183 g_free(phb); … … 186 186 187 187 close(source); 188 phb->func(phb->data, -1, GAIM_INPUT_READ);188 phb->func(phb->data, -1, B_EV_IO_READ); 189 189 g_free(phb->host); 190 190 g_free(phb); … … 204 204 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 205 205 close(source); 206 phb->func(phb->data, -1, GAIM_INPUT_READ);206 phb->func(phb->data, -1, B_EV_IO_READ); 207 207 g_free(phb->host); 208 208 g_free(phb); … … 215 215 if (send(source, cmd, strlen(cmd), 0) < 0) { 216 216 close(source); 217 phb->func(phb->data, -1, GAIM_INPUT_READ);217 phb->func(phb->data, -1, B_EV_IO_READ); 218 218 g_free(phb->host); 219 219 g_free(phb); … … 230 230 if (send(source, cmd, strlen(cmd), 0) < 0) { 231 231 close(source); 232 phb->func(phb->data, -1, GAIM_INPUT_READ);232 phb->func(phb->data, -1, B_EV_IO_READ); 233 233 g_free(phb->host); 234 234 g_free(phb); … … 240 240 if (send(source, cmd, strlen(cmd), 0) < 0) { 241 241 close(source); 242 phb->func(phb->data, -1, GAIM_INPUT_READ);243 g_free(phb->host); 244 g_free(phb); 245 return FALSE; 246 } 247 248 phb->inpa = b_input_add(source, GAIM_INPUT_READ, http_canread, phb);242 phb->func(phb->data, -1, B_EV_IO_READ); 243 g_free(phb->host); 244 g_free(phb); 245 return FALSE; 246 } 247 248 phb->inpa = b_input_add(source, B_EV_IO_READ, http_canread, phb); 249 249 250 250 return FALSE; … … 273 273 memset(packet, 0, sizeof(packet)); 274 274 if (read(source, packet, 9) >= 4 && packet[1] == 90) { 275 phb->func(phb->data, source, GAIM_INPUT_READ);275 phb->func(phb->data, source, B_EV_IO_READ); 276 276 g_free(phb->host); 277 277 g_free(phb); … … 280 280 281 281 close(source); 282 phb->func(phb->data, -1, GAIM_INPUT_READ);282 phb->func(phb->data, -1, B_EV_IO_READ); 283 283 g_free(phb->host); 284 284 g_free(phb); … … 299 299 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 300 300 close(source); 301 phb->func(phb->data, -1, GAIM_INPUT_READ);301 phb->func(phb->data, -1, B_EV_IO_READ); 302 302 g_free(phb->host); 303 303 g_free(phb); … … 309 309 if (!(hp = gethostbyname(phb->host))) { 310 310 close(source); 311 phb->func(phb->data, -1, GAIM_INPUT_READ);311 phb->func(phb->data, -1, B_EV_IO_READ); 312 312 g_free(phb->host); 313 313 g_free(phb); … … 326 326 if (write(source, packet, 9) != 9) { 327 327 close(source); 328 phb->func(phb->data, -1, GAIM_INPUT_READ);329 g_free(phb->host); 330 g_free(phb); 331 return FALSE; 332 } 333 334 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s4_canread, phb);328 phb->func(phb->data, -1, B_EV_IO_READ); 329 g_free(phb->host); 330 g_free(phb); 331 return FALSE; 332 } 333 334 phb->inpa = b_input_add(source, B_EV_IO_READ, s4_canread, phb); 335 335 336 336 return FALSE; … … 359 359 if (read(source, buf, 10) < 10) { 360 360 close(source); 361 phb->func(phb->data, -1, GAIM_INPUT_READ);361 phb->func(phb->data, -1, B_EV_IO_READ); 362 362 g_free(phb->host); 363 363 g_free(phb); … … 366 366 if ((buf[0] != 0x05) || (buf[1] != 0x00)) { 367 367 close(source); 368 phb->func(phb->data, -1, GAIM_INPUT_READ);369 g_free(phb->host); 370 g_free(phb); 371 return FALSE; 372 } 373 374 phb->func(phb->data, source, GAIM_INPUT_READ);368 phb->func(phb->data, -1, B_EV_IO_READ); 369 g_free(phb->host); 370 g_free(phb); 371 return FALSE; 372 } 373 374 phb->func(phb->data, source, B_EV_IO_READ); 375 375 g_free(phb->host); 376 376 g_free(phb); … … 396 396 if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) { 397 397 close(source); 398 phb->func(phb->data, -1, GAIM_INPUT_READ);398 phb->func(phb->data, -1, B_EV_IO_READ); 399 399 g_free(phb->host); 400 400 g_free(phb); … … 402 402 } 403 403 404 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb);404 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread_again, phb); 405 405 } 406 406 … … 414 414 if (read(source, buf, 2) < 2) { 415 415 close(source); 416 phb->func(phb->data, -1, GAIM_INPUT_READ);416 phb->func(phb->data, -1, B_EV_IO_READ); 417 417 g_free(phb->host); 418 418 g_free(phb); … … 422 422 if ((buf[0] != 0x01) || (buf[1] != 0x00)) { 423 423 close(source); 424 phb->func(phb->data, -1, GAIM_INPUT_READ);424 phb->func(phb->data, -1, B_EV_IO_READ); 425 425 g_free(phb->host); 426 426 g_free(phb); … … 442 442 if (read(source, buf, 2) < 2) { 443 443 close(source); 444 phb->func(phb->data, -1, GAIM_INPUT_READ);444 phb->func(phb->data, -1, B_EV_IO_READ); 445 445 g_free(phb->host); 446 446 g_free(phb); … … 450 450 if ((buf[0] != 0x05) || (buf[1] == 0xff)) { 451 451 close(source); 452 phb->func(phb->data, -1, GAIM_INPUT_READ);452 phb->func(phb->data, -1, B_EV_IO_READ); 453 453 g_free(phb->host); 454 454 g_free(phb); … … 465 465 if (write(source, buf, 3 + i + j) < 3 + i + j) { 466 466 close(source); 467 phb->func(phb->data, -1, GAIM_INPUT_READ);467 phb->func(phb->data, -1, B_EV_IO_READ); 468 468 g_free(phb->host); 469 469 g_free(phb); … … 471 471 } 472 472 473 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_readauth, phb);473 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_readauth, phb); 474 474 } else { 475 475 s5_sendconnect(phb, source); … … 491 491 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 492 492 close(source); 493 phb->func(phb->data, -1, GAIM_INPUT_READ);493 phb->func(phb->data, -1, B_EV_IO_READ); 494 494 g_free(phb->host); 495 495 g_free(phb); … … 513 513 if (write(source, buf, i) < i) { 514 514 close(source); 515 phb->func(phb->data, -1, GAIM_INPUT_READ);516 g_free(phb->host); 517 g_free(phb); 518 return FALSE; 519 } 520 521 phb->inpa = b_input_add(source, GAIM_INPUT_READ, s5_canread, phb);515 phb->func(phb->data, -1, B_EV_IO_READ); 516 g_free(phb->host); 517 g_free(phb); 518 return FALSE; 519 } 520 521 phb->inpa = b_input_add(source, B_EV_IO_READ, s5_canread, phb); 522 522 523 523 return FALSE; -
lib/ssl_bogus.c
r0d9d53e r4aa0f6b 59 59 b_input_condition ssl_getdirection( void *conn ) 60 60 { 61 return GAIM_INPUT_READ;61 return B_EV_IO_READ; 62 62 } 63 63 -
lib/ssl_client.h
r0d9d53e r4aa0f6b 71 71 G_MODULE_EXPORT int ssl_getfd( void *conn ); 72 72 73 /* This function returns GAIM_INPUT_READ/WRITE. With SSL connections it's73 /* This function returns B_EV_IO_READ/WRITE. With SSL connections it's 74 74 possible that something has to be read while actually were trying to 75 75 write something (think about key exchange/refresh/etc). So when an -
lib/ssl_gnutls.c
r0d9d53e r4aa0f6b 106 106 struct scd *conn = data; 107 107 108 return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );108 return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); 109 109 } 110 110 … … 244 244 { 245 245 return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ? 246 GAIM_INPUT_WRITE : GAIM_INPUT_READ );247 } 246 B_EV_IO_WRITE : B_EV_IO_READ ); 247 } -
lib/ssl_nss.c
r0d9d53e r4aa0f6b 193 193 { 194 194 /* Just in case someone calls us, let's return the most likely case: */ 195 return GAIM_INPUT_READ;195 return B_EV_IO_READ; 196 196 } -
lib/ssl_openssl.c
r0d9d53e r4aa0f6b 102 102 struct scd *conn = data; 103 103 104 return ssl_connected( conn, conn->fd, GAIM_INPUT_WRITE );104 return ssl_connected( conn, conn->fd, B_EV_IO_WRITE ); 105 105 } 106 106 … … 270 270 b_input_condition ssl_getdirection( void *conn ) 271 271 { 272 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );273 } 272 return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? B_EV_IO_WRITE : B_EV_IO_READ ); 273 } -
lib/ssl_sspi.c
r0d9d53e r4aa0f6b 275 275 GaimInputCondition ssl_getdirection( void *conn ) 276 276 { 277 return GAIM_INPUT_WRITE; /* FIXME: or GAIM_INPUT_READ */278 } 277 return B_EV_IO_WRITE; /* FIXME: or B_EV_IO_READ */ 278 }
Note: See TracChangeset
for help on using the changeset viewer.