Mercurial > pidgin
comparison libpurple/protocols/bonjour/jabber.c @ 21527:5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 15 Nov 2007 17:27:16 +0000 |
parents | dc703f13449a |
children | 9736ee1ca29e |
comparison
equal
deleted
inserted
replaced
21526:aee91450a46a | 21527:5b9da9db7e81 |
---|---|
325 | 325 |
326 return ret; | 326 return ret; |
327 } | 327 } |
328 | 328 |
329 void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { | 329 void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { |
330 | |
331 g_return_if_fail(packet != NULL); | |
332 | |
330 if (!strcmp(packet->name, "message")) | 333 if (!strcmp(packet->name, "message")) |
331 _jabber_parse_and_write_message_to_ui(packet, pb); | 334 _jabber_parse_and_write_message_to_ui(packet, pb); |
332 else if(!strcmp(packet->name, "iq")) | 335 else if(!strcmp(packet->name, "iq")) |
333 xep_iq_parse(packet, NULL, pb); | 336 xep_iq_parse(packet, NULL, pb); |
334 else | 337 else |
335 purple_debug_warning("bonjour", "Unknown packet: %s\n", | 338 purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)"); |
336 packet->name); | |
337 } | 339 } |
338 | 340 |
339 | 341 |
340 static void | 342 static void |
341 _client_socket_handler(gpointer data, gint socket, PurpleInputCondition condition) | 343 _client_socket_handler(gpointer data, gint socket, PurpleInputCondition condition) |
349 /* Read the data from the socket */ | 351 /* Read the data from the socket */ |
350 if ((len = recv(socket, message, sizeof(message) - 1, 0)) == -1) { | 352 if ((len = recv(socket, message, sizeof(message) - 1, 0)) == -1) { |
351 /* There have been an error reading from the socket */ | 353 /* There have been an error reading from the socket */ |
352 if (errno != EAGAIN) { | 354 if (errno != EAGAIN) { |
353 BonjourBuddy *bb = pb->proto_data; | 355 BonjourBuddy *bb = pb->proto_data; |
354 | 356 const char *err = g_strerror(errno); |
355 purple_debug_warning("bonjour", "receive error: %s\n", g_strerror(errno)); | 357 |
358 purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); | |
356 | 359 |
357 bonjour_jabber_close_conversation(bb->conversation); | 360 bonjour_jabber_close_conversation(bb->conversation); |
358 bb->conversation = NULL; | 361 bb->conversation = NULL; |
359 | 362 |
360 /* I guess we really don't need to notify the user. | 363 /* I guess we really don't need to notify the user. |
361 * If they try to send another message it'll reconnect */ | 364 * If they try to send another message it'll reconnect */ |
362 } | 365 } |
363 return; | 366 return; |
364 } else if (len == 0) { /* The other end has closed the socket */ | 367 } else if (len == 0) { /* The other end has closed the socket */ |
365 purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", pb->name); | 368 purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", pb->name ? pb->name : "(null)"); |
366 bonjour_jabber_stream_ended(pb); | 369 bonjour_jabber_stream_ended(pb); |
367 return; | 370 return; |
368 } else { | 371 } else { |
369 message_length = len; | 372 message_length = len; |
370 message[message_length] = '\0'; | 373 message[message_length] = '\0'; |