Mercurial > pidgin
comparison libpurple/protocols/bonjour/jabber.c @ 23092:2a81912c229a
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
available offline buddies. Fixes #5873.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 22 May 2008 21:38:06 +0000 |
parents | 1c87e81c44fa |
children | a9db0aec7e59 |
comparison
equal
deleted
inserted
replaced
23091:69fbad87f8ae | 23092:2a81912c229a |
---|---|
383 const char *err = g_strerror(errno); | 383 const char *err = g_strerror(errno); |
384 | 384 |
385 purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); | 385 purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); |
386 | 386 |
387 bonjour_jabber_close_conversation(bconv); | 387 bonjour_jabber_close_conversation(bconv); |
388 if (bconv->pb != NULL) { | 388 if (bconv->pb != NULL && bconv->pb->proto_data != NULL) { |
389 BonjourBuddy *bb = bconv->pb->proto_data; | 389 BonjourBuddy *bb = bconv->pb->proto_data; |
390 bb->conversation = NULL; | 390 bb->conversation = NULL; |
391 } | 391 } |
392 | 392 |
393 /* I guess we really don't need to notify the user. | 393 /* I guess we really don't need to notify the user. |
955 PurpleBuddy *pb; | 955 PurpleBuddy *pb; |
956 BonjourBuddy *bb; | 956 BonjourBuddy *bb; |
957 int ret; | 957 int ret; |
958 | 958 |
959 pb = _find_or_start_conversation(jdata, to); | 959 pb = _find_or_start_conversation(jdata, to); |
960 if (pb == NULL) { | 960 if (pb == NULL || pb->proto_data == NULL) { |
961 purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); | 961 purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); |
962 /* You can not send a message to an offline buddy */ | 962 /* You can not send a message to an offline buddy */ |
963 return -10000; | 963 return -10000; |
964 } | 964 } |
965 | 965 |
1101 GSList *buddies, *l; | 1101 GSList *buddies, *l; |
1102 | 1102 |
1103 buddies = purple_find_buddies(jdata->account, NULL); | 1103 buddies = purple_find_buddies(jdata->account, NULL); |
1104 for (l = buddies; l; l = l->next) { | 1104 for (l = buddies; l; l = l->next) { |
1105 BonjourBuddy *bb = ((PurpleBuddy*) l->data)->proto_data; | 1105 BonjourBuddy *bb = ((PurpleBuddy*) l->data)->proto_data; |
1106 bonjour_jabber_close_conversation(bb->conversation); | 1106 if (bb != NULL) { |
1107 bb->conversation = NULL; | 1107 bonjour_jabber_close_conversation(bb->conversation); |
1108 bb->conversation = NULL; | |
1109 } | |
1108 } | 1110 } |
1109 | 1111 |
1110 g_slist_free(buddies); | 1112 g_slist_free(buddies); |
1111 } | 1113 } |
1112 | 1114 |