Mercurial > pidgin
comparison src/protocols/bonjour/jabber.c @ 13900:47c3d00713af
[gaim-migrate @ 16386]
sf patch #1497232, from Jono Cole, "Segfault in bonjour
when another protocol is logged in"
"The Bonjour protocol plugin was causing Gaim to
segfault on receiving a message when other protocols
were logged in. This is dependant on the active buddies
in the buddy list and has been noticed the most when
msn is used."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 01 Jul 2006 18:04:55 +0000 |
parents | d1088b7771d4 |
children | 425e0f861e88 |
comparison
equal
deleted
inserted
replaced
13899:79f29d8dcd7a | 13900:47c3d00713af |
---|---|
219 } | 219 } |
220 | 220 |
221 struct _check_buddy_by_address_t { | 221 struct _check_buddy_by_address_t { |
222 char *address; | 222 char *address; |
223 GaimBuddy **gb; | 223 GaimBuddy **gb; |
224 BonjourJabber *bj; | |
224 }; | 225 }; |
225 | 226 |
226 static void | 227 static void |
227 _check_buddy_by_address(gpointer key, gpointer value, gpointer data) | 228 _check_buddy_by_address(gpointer key, gpointer value, gpointer data) |
228 { | 229 { |
229 GaimBuddy *gb = (GaimBuddy*)value; | 230 GaimBuddy *gb = (GaimBuddy*)value; |
230 BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data; | 231 BonjourBuddy *bb; |
231 struct _check_buddy_by_address_t *d = (struct _check_buddy_by_address_t *)data; | 232 struct _check_buddy_by_address_t *cbba; |
232 | 233 |
233 if (bb != NULL) { | 234 gb = value; |
234 if (g_strcasecmp(bb->ip, (char*)d->address) == 0) | 235 cbba = data; |
235 *(d->gb) = gb; | 236 |
237 /* | |
238 * If the current GaimBuddy's data is not null and the GaimBuddy's account | |
239 * is the same as the account requesting the check then continue to determine | |
240 * whether the buddies IP matches the target IP. | |
241 */ | |
242 if (cbba->bj->account == gb->account) | |
243 { | |
244 bb = gb->proto_data; | |
245 if ((bb != NULL) && (g_strcasecmp(bb->ip, cbba->address) == 0)) | |
246 *(cbba->gb) = gb; | |
236 } | 247 } |
237 } | 248 } |
238 | 249 |
239 static gint | 250 static gint |
240 _read_data(gint socket, char **message) | 251 _read_data(gint socket, char **message) |
369 GaimBuddy *gb = NULL; | 380 GaimBuddy *gb = NULL; |
370 struct sockaddr_in their_addr; /* connector's address information */ | 381 struct sockaddr_in their_addr; /* connector's address information */ |
371 socklen_t sin_size = sizeof(struct sockaddr); | 382 socklen_t sin_size = sizeof(struct sockaddr); |
372 int client_socket; | 383 int client_socket; |
373 BonjourBuddy *bb = NULL; | 384 BonjourBuddy *bb = NULL; |
385 BonjourJabber *bj = data; | |
374 char *address_text = NULL; | 386 char *address_text = NULL; |
375 GaimBuddyList *bl = gaim_get_blist(); | 387 GaimBuddyList *bl = gaim_get_blist(); |
376 struct _check_buddy_by_address_t *cbba; | 388 struct _check_buddy_by_address_t *cbba; |
377 | 389 |
378 /* Check that it is a read condition */ | 390 /* Check that it is a read condition */ |
384 { | 396 { |
385 return; | 397 return; |
386 } | 398 } |
387 fcntl(client_socket, F_SETFL, O_NONBLOCK); | 399 fcntl(client_socket, F_SETFL, O_NONBLOCK); |
388 | 400 |
389 /* Look for the buddy that has open the conversation and fill information */ | 401 /* Look for the buddy that has opened the conversation and fill information */ |
390 address_text = inet_ntoa(their_addr.sin_addr); | 402 address_text = inet_ntoa(their_addr.sin_addr); |
391 cbba = g_new0(struct _check_buddy_by_address_t, 1); | 403 cbba = g_new0(struct _check_buddy_by_address_t, 1); |
392 cbba->address = address_text; | 404 cbba->address = address_text; |
393 cbba->gb = &gb; | 405 cbba->gb = &gb; |
406 cbba->bj = bj; | |
394 g_hash_table_foreach(bl->buddies, _check_buddy_by_address, cbba); | 407 g_hash_table_foreach(bl->buddies, _check_buddy_by_address, cbba); |
395 g_free(cbba); | 408 g_free(cbba); |
396 if (gb == NULL) | 409 if (gb == NULL) |
397 { | 410 { |
398 gaim_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); | 411 gaim_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); |