Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/family_icq.c @ 17235:1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 22 May 2007 18:56:09 +0000 |
parents | 32c366eeeb99 |
children | f80f7e1047be |
comparison
equal
deleted
inserted
replaced
17234:12d0ad970a15 | 17235:1927f4ead3ca |
---|---|
210 byte_stream_putle32(&frame->data, atoi(uin)); | 210 byte_stream_putle32(&frame->data, atoi(uin)); |
211 | 211 |
212 flap_connection_send(conn, frame); | 212 flap_connection_send(conn, frame); |
213 | 213 |
214 /* Keep track of this request and the ICQ number and request ID */ | 214 /* Keep track of this request and the ICQ number and request ID */ |
215 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | 215 info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); |
216 info->reqid = snacid; | 216 info->reqid = snacid; |
217 info->uin = atoi(uin); | 217 info->uin = atoi(uin); |
218 info->next = od->icq_info; | 218 info->next = od->icq_info; |
219 od->icq_info = info; | 219 od->icq_info = info; |
220 | 220 |
254 byte_stream_putle32(&frame->data, atoi(uin)); | 254 byte_stream_putle32(&frame->data, atoi(uin)); |
255 | 255 |
256 flap_connection_send(conn, frame); | 256 flap_connection_send(conn, frame); |
257 | 257 |
258 /* Keep track of this request and the ICQ number and request ID */ | 258 /* Keep track of this request and the ICQ number and request ID */ |
259 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | 259 info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); |
260 info->reqid = snacid; | 260 info->reqid = snacid; |
261 info->uin = atoi(uin); | 261 info->uin = atoi(uin); |
262 info->next = od->icq_info; | 262 info->next = od->icq_info; |
263 od->icq_info = info; | 263 od->icq_info = info; |
264 | 264 |
424 byte_stream_put16(&frame->data, xmllen); | 424 byte_stream_put16(&frame->data, xmllen); |
425 byte_stream_putstr(&frame->data, xml); | 425 byte_stream_putstr(&frame->data, xml); |
426 | 426 |
427 flap_connection_send(conn, frame); | 427 flap_connection_send(conn, frame); |
428 | 428 |
429 free(xml); | 429 g_free(xml); |
430 | 430 |
431 return 0; | 431 return 0; |
432 } | 432 } |
433 #endif | 433 #endif |
434 | 434 |
435 static void aim_icq_freeinfo(struct aim_icq_info *info) { | 435 static void aim_icq_freeinfo(struct aim_icq_info *info) { |
436 int i; | 436 int i; |
437 | 437 |
438 if (!info) | 438 if (!info) |
439 return; | 439 return; |
440 free(info->nick); | 440 g_free(info->nick); |
441 free(info->first); | 441 g_free(info->first); |
442 free(info->last); | 442 g_free(info->last); |
443 free(info->email); | 443 g_free(info->email); |
444 free(info->homecity); | 444 g_free(info->homecity); |
445 free(info->homestate); | 445 g_free(info->homestate); |
446 free(info->homephone); | 446 g_free(info->homephone); |
447 free(info->homefax); | 447 g_free(info->homefax); |
448 free(info->homeaddr); | 448 g_free(info->homeaddr); |
449 free(info->mobile); | 449 g_free(info->mobile); |
450 free(info->homezip); | 450 g_free(info->homezip); |
451 free(info->personalwebpage); | 451 g_free(info->personalwebpage); |
452 if (info->email2) | 452 if (info->email2) |
453 for (i = 0; i < info->numaddresses; i++) | 453 for (i = 0; i < info->numaddresses; i++) |
454 free(info->email2[i]); | 454 g_free(info->email2[i]); |
455 free(info->email2); | 455 g_free(info->email2); |
456 free(info->workcity); | 456 g_free(info->workcity); |
457 free(info->workstate); | 457 g_free(info->workstate); |
458 free(info->workphone); | 458 g_free(info->workphone); |
459 free(info->workfax); | 459 g_free(info->workfax); |
460 free(info->workaddr); | 460 g_free(info->workaddr); |
461 free(info->workzip); | 461 g_free(info->workzip); |
462 free(info->workcompany); | 462 g_free(info->workcompany); |
463 free(info->workdivision); | 463 g_free(info->workdivision); |
464 free(info->workposition); | 464 g_free(info->workposition); |
465 free(info->workwebpage); | 465 g_free(info->workwebpage); |
466 free(info->info); | 466 g_free(info->info); |
467 free(info); | 467 g_free(info); |
468 } | 468 } |
469 | 469 |
470 /** | 470 /** |
471 * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. | 471 * Subtype 0x0003 - Response to 0x0015/0x002, contains an ICQesque packet. |
472 */ | 472 */ |
513 msg.msg = byte_stream_getstr(&qbs, msg.msglen); | 513 msg.msg = byte_stream_getstr(&qbs, msg.msglen); |
514 | 514 |
515 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG))) | 515 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG))) |
516 ret = userfunc(od, conn, frame, &msg); | 516 ret = userfunc(od, conn, frame, &msg); |
517 | 517 |
518 free(msg.msg); | 518 g_free(msg.msg); |
519 | 519 |
520 } else if (cmd == 0x0042) { | 520 } else if (cmd == 0x0042) { |
521 aim_rxcallback_t userfunc; | 521 aim_rxcallback_t userfunc; |
522 | 522 |
523 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE))) | 523 if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE))) |
532 byte_stream_advance(&qbs, 1); /* 0x0a */ | 532 byte_stream_advance(&qbs, 1); /* 0x0a */ |
533 | 533 |
534 /* find other data from the same request */ | 534 /* find other data from the same request */ |
535 for (info = od->icq_info; info && (info->reqid != reqid); info = info->next); | 535 for (info = od->icq_info; info && (info->reqid != reqid); info = info->next); |
536 if (!info) { | 536 if (!info) { |
537 info = (struct aim_icq_info *)calloc(1, sizeof(struct aim_icq_info)); | 537 info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); |
538 info->reqid = reqid; | 538 info->reqid = reqid; |
539 info->next = od->icq_info; | 539 info->next = od->icq_info; |
540 od->icq_info = info; | 540 od->icq_info = info; |
541 } | 541 } |
542 | 542 |
601 } break; | 601 } break; |
602 | 602 |
603 case 0x00eb: { /* email address(es) */ | 603 case 0x00eb: { /* email address(es) */ |
604 int i; | 604 int i; |
605 info->numaddresses = byte_stream_getle16(&qbs); | 605 info->numaddresses = byte_stream_getle16(&qbs); |
606 info->email2 = (char **)calloc(info->numaddresses, sizeof(char *)); | 606 info->email2 = (char **)g_new0(char *, info->numaddresses); |
607 for (i = 0; i < info->numaddresses; i++) { | 607 for (i = 0; i < info->numaddresses; i++) { |
608 info->email2[i] = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); | 608 info->email2[i] = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); |
609 if (i+1 != info->numaddresses) | 609 if (i+1 != info->numaddresses) |
610 byte_stream_advance(&qbs, 1); /* 0x00 */ | 610 byte_stream_advance(&qbs, 1); /* 0x00 */ |
611 } | 611 } |