Mercurial > pidgin
comparison src/protocols/silc/buddy.c @ 9488:2770a0e659ca
[gaim-migrate @ 10313]
Stu Tomlinson assures me that this is a bunch of new and fancy
features for SILC that we really need. I believe him because his name
is pronounceable backward. This is from Patch #975859, and
additionally fixes bug #981066 and mitigates #981080. We love you, Stu.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 08 Jul 2004 18:45:01 +0000 |
parents | d27156c9c876 |
children | 578986136bac |
comparison
equal
deleted
inserted
replaced
9487:c23f7045357c | 9488:2770a0e659ca |
---|---|
1424 SilcGaim sg = b->account->gc->proto_data; | 1424 SilcGaim sg = b->account->gc->proto_data; |
1425 SilcClient client = sg->client; | 1425 SilcClient client = sg->client; |
1426 SilcClientConnection conn = sg->conn; | 1426 SilcClientConnection conn = sg->conn; |
1427 SilcClientID *client_id = b->proto_data; | 1427 SilcClientID *client_id = b->proto_data; |
1428 SilcClientEntry client_entry; | 1428 SilcClientEntry client_entry; |
1429 SilcAttributePayload attr; | 1429 char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; |
1430 SilcAttributeMood mood = 0; | |
1431 SilcAttributeContact contact; | |
1432 SilcAttributeObjDevice device; | |
1433 SilcAttributeObjGeo geo; | |
1434 GString *s; | 1430 GString *s; |
1435 char *buf; | 1431 char *buf; |
1436 char tmp[256]; | 1432 char tmp[256]; |
1437 | 1433 |
1438 s = g_string_new(""); | 1434 s = g_string_new(""); |
1447 client_entry->nickname); | 1443 client_entry->nickname); |
1448 if (client_entry->username && client_entry->hostname) | 1444 if (client_entry->username && client_entry->hostname) |
1449 g_string_append_printf(s, "\n<b>%s:</b> %s@%s", _("Username"), | 1445 g_string_append_printf(s, "\n<b>%s:</b> %s@%s", _("Username"), |
1450 client_entry->username, client_entry->hostname); | 1446 client_entry->username, client_entry->hostname); |
1451 if (client_entry->mode) { | 1447 if (client_entry->mode) { |
1452 g_string_append_printf(s, "\n<b>%s:</b> ", _("Modes")); | 1448 g_string_append_printf(s, "\n<b>%s:</b> ", _("User Modes")); |
1453 memset(tmp, 0, sizeof(tmp)); | 1449 memset(tmp, 0, sizeof(tmp)); |
1454 silcgaim_get_umode_string(client_entry->mode, | 1450 silcgaim_get_umode_string(client_entry->mode, |
1455 tmp, sizeof(tmp) - strlen(tmp)); | 1451 tmp, sizeof(tmp) - strlen(tmp)); |
1456 g_string_append_printf(s, "%s", tmp); | 1452 g_string_append_printf(s, "%s", tmp); |
1457 } | 1453 } |
1458 | 1454 |
1459 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); | 1455 silcgaim_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); |
1460 if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { | 1456 if (moodstr) { |
1461 if (mood) | 1457 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Mood"), moodstr); |
1462 g_string_append_printf(s, "\n<b>%s:</b> ", _("Mood")); | 1458 g_free(moodstr); |
1463 if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) | 1459 } |
1464 g_string_append_printf(s, "[%s] ", _("Happy")); | 1460 if (statusstr) { |
1465 if (mood & SILC_ATTRIBUTE_MOOD_SAD) | 1461 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Status Text"), statusstr); |
1466 g_string_append_printf(s, "[%s] ", _("Sad")); | 1462 g_free(statusstr); |
1467 if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) | 1463 } |
1468 g_string_append_printf(s, "[%s] ", _("Angry")); | 1464 |
1469 if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) | 1465 if (contactstr) { |
1470 g_string_append_printf(s, "[%s] ", _("Jealous")); | 1466 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Contact"), contactstr); |
1471 if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) | 1467 g_free(contactstr); |
1472 g_string_append_printf(s, "[%s] ", _("Ashamed")); | 1468 } |
1473 if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) | 1469 |
1474 g_string_append_printf(s, "[%s] ", _("Invincible")); | 1470 if (langstr) { |
1475 if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) | 1471 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Language"), langstr); |
1476 g_string_append_printf(s, "[%s] ", _("In Love")); | 1472 g_free(langstr); |
1477 if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) | 1473 } |
1478 g_string_append_printf(s, "[%s] ", _("Sleepy")); | 1474 |
1479 if (mood & SILC_ATTRIBUTE_MOOD_BORED) | 1475 if (devicestr) { |
1480 g_string_append_printf(s, "[%s] ", _("Bored")); | 1476 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Device"), devicestr); |
1481 if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) | 1477 g_free(devicestr); |
1482 g_string_append_printf(s, "[%s] ", _("Excited")); | 1478 } |
1483 if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) | 1479 |
1484 g_string_append_printf(s, "[%s] ", _("Anxious")); | 1480 if (tzstr) { |
1485 } | 1481 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Timezone"), tzstr); |
1486 | 1482 g_free(tzstr); |
1487 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); | 1483 } |
1488 memset(tmp, 0, sizeof(tmp)); | 1484 |
1489 if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) | 1485 if (geostr) { |
1490 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Status Text"), tmp); | 1486 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Geolocation"), geostr); |
1491 | 1487 g_free(geostr); |
1492 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); | 1488 } |
1493 if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { | |
1494 if (contact) | |
1495 g_string_append_printf(s, "\n<b>%s:</b> ", _("Preferred Contact")); | |
1496 if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) | |
1497 g_string_append_printf(s, "[%s] ", _("Chat")); | |
1498 if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) | |
1499 g_string_append_printf(s, "[%s] ", _("Email")); | |
1500 if (contact & SILC_ATTRIBUTE_CONTACT_CALL) | |
1501 g_string_append_printf(s, "[%s] ", _("Phone")); | |
1502 if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) | |
1503 g_string_append_printf(s, "[%s] ", _("Paging")); | |
1504 if (contact & SILC_ATTRIBUTE_CONTACT_SMS) | |
1505 g_string_append_printf(s, "[%s] ", _("SMS")); | |
1506 if (contact & SILC_ATTRIBUTE_CONTACT_MMS) | |
1507 g_string_append_printf(s, "[%s] ", _("MMS")); | |
1508 if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) | |
1509 g_string_append_printf(s, "[%s] ", _("Video Conferencing")); | |
1510 } | |
1511 | |
1512 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); | |
1513 memset(tmp, 0, sizeof(tmp)); | |
1514 if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) | |
1515 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Language"), tmp); | |
1516 | |
1517 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_DEVICE_INFO); | |
1518 memset(&device, 0, sizeof(device)); | |
1519 if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { | |
1520 g_string_append_printf(s, "\n<b>%s:</b> ", _("Device")); | |
1521 if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) | |
1522 g_string_append_printf(s, "%s: ", _("Computer")); | |
1523 if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) | |
1524 g_string_append_printf(s, "%s: ", _("Mobile Phone")); | |
1525 if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) | |
1526 g_string_append_printf(s, "%s: ", _("PDA")); | |
1527 if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) | |
1528 g_string_append_printf(s, "%s: ", _("Terminal")); | |
1529 g_string_append_printf(s, "%s %s %s %s", | |
1530 device.manufacturer ? device.manufacturer : "", | |
1531 device.version ? device.version : "", | |
1532 device.model ? device.model : "", | |
1533 device.language ? device.language : ""); | |
1534 } | |
1535 | |
1536 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_TIMEZONE); | |
1537 memset(tmp, 0, sizeof(tmp)); | |
1538 if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) | |
1539 g_string_append_printf(s, "\n<b>%s:</b> %s", _("Timezone"), tmp); | |
1540 | |
1541 attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_GEOLOCATION); | |
1542 memset(&geo, 0, sizeof(geo)); | |
1543 if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) | |
1544 g_string_append_printf(s, "\n<b>%s:</b> %s %s %s (%s)", | |
1545 _("Geolocation"), | |
1546 geo.longitude ? geo.longitude : "", | |
1547 geo.latitude ? geo.latitude : "", | |
1548 geo.altitude ? geo.altitude : "", | |
1549 geo.accuracy ? geo.accuracy : ""); | |
1550 | 1489 |
1551 buf = g_string_free(s, FALSE); | 1490 buf = g_string_free(s, FALSE); |
1552 return buf; | 1491 return buf; |
1553 } | 1492 } |
1554 | 1493 |