comparison src/protocols/oscar/oscar.c @ 4641:94635db7c6af

[gaim-migrate @ 4951] I introduced a bug with my extended ICQ info that caused AIM unicode messages to get dropped. This fixes that. I am such a clumsy American. Oh, thanks a bunch to cool people for helping me test this. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 03 Mar 2003 07:43:55 +0000
parents d19872836812
children c0abcd675ca6
comparison
equal deleted inserted replaced
4640:951204c08b13 4641:94635db7c6af
2014 * there is something we don't understand about it. */ 2014 * there is something we don't understand about it. */
2015 /* For the record, AIM Unicode is big-endian UCS-2 */ 2015 /* For the record, AIM Unicode is big-endian UCS-2 */
2016 2016
2017 if (!args->msg || !args->msglen) 2017 if (!args->msg || !args->msglen)
2018 return 1; 2018 return 1;
2019 2019
2020 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); 2020 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err);
2021 if (err) { 2021 if (err) {
2022 debug_printf("Unicode IM conversion: %s\n", err->message); 2022 debug_printf("Unicode IM conversion: %s\n", err->message);
2023 tmp = strdup(_("(There was an error receiving this message)")); 2023 tmp = strdup(_("(There was an error receiving this message)"));
2024 } 2024 }
3518 info = va_arg(ap, struct aim_icq_info *); 3518 info = va_arg(ap, struct aim_icq_info *);
3519 va_end(ap); 3519 va_end(ap);
3520 3520
3521 g_snprintf(who, sizeof(who), "%lu", info->uin); 3521 g_snprintf(who, sizeof(who), "%lu", info->uin);
3522 buf = g_strdup_printf("<b>UIN:</b> %s", who); 3522 buf = g_strdup_printf("<b>UIN:</b> %s", who);
3523 if (info->nick) { 3523 if (info->nick && info->nick[0]) {
3524 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Nick:</b> ", info->nick, NULL); g_free(tmp); 3524 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Nick:</b> ", info->nick, NULL); g_free(tmp);
3525 serv_got_alias(gc, who, info->nick); 3525 serv_got_alias(gc, who, info->nick);
3526 } 3526 }
3527 if (info->first) { 3527 if (info->first && info->first[0]) {
3528 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>First Name:</b> ", info->first, NULL); g_free(tmp); 3528 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>First Name:</b> ", info->first, NULL); g_free(tmp);
3529 } 3529 }
3530 if (info->last) { 3530 if (info->last && info->last[0]) {
3531 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Last Name:</b> ", info->last, NULL); g_free(tmp); 3531 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Last Name:</b> ", info->last, NULL); g_free(tmp);
3532 } 3532 }
3533 if (info->email) { 3533 if (info->email && info->email[0]) {
3534 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email, "\">", info->email, "</a>", NULL); g_free(tmp); 3534 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email, "\">", info->email, "</a>", NULL); g_free(tmp);
3535 } 3535 }
3536 if (info->numaddresses && info->email2) { 3536 if (info->numaddresses && info->email2) {
3537 int i; 3537 int i;
3538 for (i = 0; i < info->numaddresses; i++) { 3538 for (i = 0; i < info->numaddresses; i++) {
3539 if (info->email2[i] && info->email2[i][0])
3539 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email2[i], "\">", info->email2[i], "</a>", NULL); g_free(tmp); 3540 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Email Address:</b> <a href=\"mailto:", info->email2[i], "\">", info->email2[i], "</a>", NULL); g_free(tmp);
3540 } 3541 }
3541 } 3542 }
3542 if (info->mobile) { 3543 if (info->mobile && info->mobile[0]) {
3543 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Mobile Phone:</b> ", info->mobile, NULL); g_free(tmp); 3544 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Mobile Phone:</b> ", info->mobile, NULL); g_free(tmp);
3544 } 3545 }
3545 if (info->gender) { 3546 if (info->gender) {
3546 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Gender:</b> ", info->gender==1 ? "Female" : "Male", NULL); g_free(tmp); 3547 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Gender:</b> ", info->gender==1 ? "Female" : "Male", NULL); g_free(tmp);
3547 } 3548 }
3557 if (info->age) { 3558 if (info->age) {
3558 char age[5]; 3559 char age[5];
3559 snprintf(age, sizeof(age), "%hhd", info->age); 3560 snprintf(age, sizeof(age), "%hhd", info->age);
3560 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Age:</b> ", age, NULL); g_free(tmp); 3561 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Age:</b> ", age, NULL); g_free(tmp);
3561 } 3562 }
3562 if (info->personalwebpage) { 3563 if (info->personalwebpage && info->personalwebpage[0]) {
3563 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Personal Web Page:</b> <a href=\"", info->personalwebpage, "\">", info->personalwebpage, "</a>", NULL); g_free(tmp); 3564 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Personal Web Page:</b> <a href=\"", info->personalwebpage, "\">", info->personalwebpage, "</a>", NULL); g_free(tmp);
3564 } 3565 }
3565 if (info->info) { 3566 if (info->info && info->info[0]) {
3566 tmp = buf; buf = g_strconcat(tmp, "<hr><b>Additional Information:</b><br>", info->info, NULL); g_free(tmp); 3567 tmp = buf; buf = g_strconcat(tmp, "<hr><b>Additional Information:</b><br>", info->info, NULL); g_free(tmp);
3567 } 3568 }
3568 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); 3569 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp);
3569 if (info->homeaddr || info->homecity || info->homestate || info->homezip) { 3570 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
3570 tmp = buf; buf = g_strconcat(tmp, "<b>Home Address:</b>", NULL); g_free(tmp); 3571 tmp = buf; buf = g_strconcat(tmp, "<b>Home Address:</b>", NULL); g_free(tmp);
3571 if (info->homeaddr) { 3572 if (info->homeaddr && info->homeaddr[0]) {
3572 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Address:</b> ", info->homeaddr, NULL); g_free(tmp); 3573 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Address:</b> ", info->homeaddr, NULL); g_free(tmp);
3573 } 3574 }
3574 if (info->homecity) { 3575 if (info->homecity && info->homecity[0]) {
3575 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>City:</b> ", info->homecity, NULL); g_free(tmp); 3576 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>City:</b> ", info->homecity, NULL); g_free(tmp);
3576 } 3577 }
3577 if (info->homestate) { 3578 if (info->homestate && info->homestate[0]) {
3578 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>State:</b> ", info->homestate, NULL); g_free(tmp); 3579 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>State:</b> ", info->homestate, NULL); g_free(tmp);
3579 } 3580 }
3580 if (info->homezip) { 3581 if (info->homezip && info->homezip[0]) {
3581 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Zip Code:</b> ", info->homezip, NULL); g_free(tmp); 3582 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Zip Code:</b> ", info->homezip, NULL); g_free(tmp);
3582 } 3583 }
3583 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); 3584 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp);
3584 } 3585 }
3585 if (info->workaddr || info->workcity || info->workstate || info->workzip) { 3586 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
3586 tmp = buf; buf = g_strconcat(tmp, "<b>Work Address:</b>", NULL); g_free(tmp); 3587 tmp = buf; buf = g_strconcat(tmp, "<b>Work Address:</b>", NULL); g_free(tmp);
3587 if (info->workaddr) { 3588 if (info->workaddr && info->workaddr[0]) {
3588 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Address:</b> ", info->workaddr, NULL); g_free(tmp); 3589 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Address:</b> ", info->workaddr, NULL); g_free(tmp);
3589 } 3590 }
3590 if (info->workcity) { 3591 if (info->workcity && info->workcity[0]) {
3591 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>City:</b> ", info->workcity, NULL); g_free(tmp); 3592 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>City:</b> ", info->workcity, NULL); g_free(tmp);
3592 } 3593 }
3593 if (info->workstate) { 3594 if (info->workstate && info->workstate[0]) {
3594 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>State:</b> ", info->workstate, NULL); g_free(tmp); 3595 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>State:</b> ", info->workstate, NULL); g_free(tmp);
3595 } 3596 }
3596 if (info->workzip) { 3597 if (info->workzip && info->workzip[0]) {
3597 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Zip Code:</b> ", info->workzip, NULL); g_free(tmp); 3598 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Zip Code:</b> ", info->workzip, NULL); g_free(tmp);
3598 } 3599 }
3599 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); 3600 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp);
3600 } 3601 }
3601 if (info->workcompany || info->workdivision || info->workposition || info->workwebpage) { 3602 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
3602 tmp = buf; buf = g_strconcat(tmp, "<b>Work Information:</b>", NULL); g_free(tmp); 3603 tmp = buf; buf = g_strconcat(tmp, "<b>Work Information:</b>", NULL); g_free(tmp);
3603 if (info->workcompany) { 3604 if (info->workcompany && info->workcompany[0]) {
3604 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Company:</b> ", info->workcompany, NULL); g_free(tmp); 3605 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Company:</b> ", info->workcompany, NULL); g_free(tmp);
3605 } 3606 }
3606 if (info->workdivision) { 3607 if (info->workdivision && info->workdivision[0]) {
3607 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Division:</b> ", info->workdivision, NULL); g_free(tmp); 3608 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Division:</b> ", info->workdivision, NULL); g_free(tmp);
3608 } 3609 }
3609 if (info->workposition) { 3610 if (info->workposition && info->workposition[0]) {
3610 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Position:</b> ", info->workposition, NULL); g_free(tmp); 3611 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Position:</b> ", info->workposition, NULL); g_free(tmp);
3611 } 3612 }
3612 if (info->workwebpage) { 3613 if (info->workwebpage && info->workwebpage[0]) {
3613 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Web Page:</b> <a href=\"", info->workwebpage, "\">", info->workwebpage, "</a>", NULL); g_free(tmp); 3614 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>Web Page:</b> <a href=\"", info->workwebpage, "\">", info->workwebpage, "</a>", NULL); g_free(tmp);
3614 } 3615 }
3615 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); 3616 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp);
3616 } 3617 }
3617 3618