Mercurial > pidgin
comparison libpurple/protocols/bonjour/jabber.c @ 19399:649ac48fce1d
Reset unsigned int input handlers to 0 instead of -1.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 24 Aug 2007 03:08:54 +0000 |
parents | 6e3cd5e80420 |
children | 917b6f45c458 |
comparison
equal
deleted
inserted
replaced
19398:39248f5b53ad | 19399:649ac48fce1d |
---|---|
80 bonjour_jabber_conv_new() { | 80 bonjour_jabber_conv_new() { |
81 | 81 |
82 BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); | 82 BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); |
83 bconv->socket = -1; | 83 bconv->socket = -1; |
84 bconv->tx_buf = purple_circ_buffer_new(512); | 84 bconv->tx_buf = purple_circ_buffer_new(512); |
85 bconv->tx_handler = -1; | 85 bconv->tx_handler = 0; |
86 bconv->rx_handler = -1; | 86 bconv->rx_handler = 0; |
87 | 87 |
88 return bconv; | 88 return bconv; |
89 } | 89 } |
90 | 90 |
91 | 91 |
232 | 232 |
233 writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); | 233 writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); |
234 | 234 |
235 if (writelen == 0) { | 235 if (writelen == 0) { |
236 purple_input_remove(bconv->tx_handler); | 236 purple_input_remove(bconv->tx_handler); |
237 bconv->tx_handler = -1; | 237 bconv->tx_handler = 0; |
238 return; | 238 return; |
239 } | 239 } |
240 | 240 |
241 ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); | 241 ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); |
242 | 242 |
270 int len = strlen(message); | 270 int len = strlen(message); |
271 BonjourBuddy *bb = pb->proto_data; | 271 BonjourBuddy *bb = pb->proto_data; |
272 BonjourJabberConversation *bconv = bb->conversation; | 272 BonjourJabberConversation *bconv = bb->conversation; |
273 | 273 |
274 /* If we're not ready to actually send, append it to the buffer */ | 274 /* If we're not ready to actually send, append it to the buffer */ |
275 if (bconv->tx_handler != -1 | 275 if (bconv->tx_handler != 0 |
276 || bconv->connect_data != NULL | 276 || bconv->connect_data != NULL |
277 || !bconv->sent_stream_start | 277 || !bconv->sent_stream_start |
278 || !bconv->recv_stream_start | 278 || !bconv->recv_stream_start |
279 || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { | 279 || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { |
280 ret = -1; | 280 ret = -1; |
302 bb->conversation = NULL; | 302 bb->conversation = NULL; |
303 return -1; | 303 return -1; |
304 } | 304 } |
305 | 305 |
306 if (ret < len) { | 306 if (ret < len) { |
307 if (bconv->tx_handler == -1) | 307 if (bconv->tx_handler == 0) |
308 bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, | 308 bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, |
309 _send_data_write_cb, pb); | 309 _send_data_write_cb, pb); |
310 purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); | 310 purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); |
311 } | 311 } |
312 | 312 |
453 g_free(ss); | 453 g_free(ss); |
454 bconv->stream_data = NULL; | 454 bconv->stream_data = NULL; |
455 | 455 |
456 /* Stream started; process the send buffer if there is one */ | 456 /* Stream started; process the send buffer if there is one */ |
457 purple_input_remove(bconv->tx_handler); | 457 purple_input_remove(bconv->tx_handler); |
458 bconv->tx_handler= -1; | 458 bconv->tx_handler= 0; |
459 bconv->sent_stream_start = TRUE; | 459 bconv->sent_stream_start = TRUE; |
460 | 460 |
461 bonjour_jabber_stream_started(pb); | 461 bonjour_jabber_stream_started(pb); |
462 | 462 |
463 } | 463 } |
777 if (bconv->sent_stream_start) | 777 if (bconv->sent_stream_start) |
778 send(bconv->socket, STREAM_END, strlen(STREAM_END), 0); | 778 send(bconv->socket, STREAM_END, strlen(STREAM_END), 0); |
779 /* TODO: We're really supposed to wait for "</stream:stream>" before closing the socket */ | 779 /* TODO: We're really supposed to wait for "</stream:stream>" before closing the socket */ |
780 close(bconv->socket); | 780 close(bconv->socket); |
781 } | 781 } |
782 if (bconv->rx_handler != -1) | 782 if (bconv->rx_handler != 0) |
783 purple_input_remove(bconv->rx_handler); | 783 purple_input_remove(bconv->rx_handler); |
784 if (bconv->tx_handler > 0) | 784 if (bconv->tx_handler > 0) |
785 purple_input_remove(bconv->tx_handler); | 785 purple_input_remove(bconv->tx_handler); |
786 | 786 |
787 /* Free all the data related to the conversation */ | 787 /* Free all the data related to the conversation */ |