Mercurial > pidgin.yaz
diff 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 |
line wrap: on
line diff
--- a/src/protocols/silc/buddy.c Thu Jul 08 17:37:33 2004 +0000 +++ b/src/protocols/silc/buddy.c Thu Jul 08 18:45:01 2004 +0000 @@ -1426,11 +1426,7 @@ SilcClientConnection conn = sg->conn; SilcClientID *client_id = b->proto_data; SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; + char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; GString *s; char *buf; char tmp[256]; @@ -1449,104 +1445,47 @@ g_string_append_printf(s, "\n<b>%s:</b> %s@%s", _("Username"), client_entry->username, client_entry->hostname); if (client_entry->mode) { - g_string_append_printf(s, "\n<b>%s:</b> ", _("Modes")); + g_string_append_printf(s, "\n<b>%s:</b> ", _("User Modes")); memset(tmp, 0, sizeof(tmp)); silcgaim_get_umode_string(client_entry->mode, tmp, sizeof(tmp) - strlen(tmp)); g_string_append_printf(s, "%s", tmp); } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood) - g_string_append_printf(s, "\n<b>%s:</b> ", _("Mood")); - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); + silcgaim_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); + if (moodstr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Mood"), moodstr); + g_free(moodstr); + } + if (statusstr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Status Text"), statusstr); + g_free(statusstr); } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - g_string_append_printf(s, "\n<b>%s:</b> %s", _("Status Text"), tmp); + if (contactstr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Contact"), contactstr); + g_free(contactstr); + } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact) - g_string_append_printf(s, "\n<b>%s:</b> ", _("Preferred Contact")); - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); + if (langstr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Language"), langstr); + g_free(langstr); } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - g_string_append_printf(s, "\n<b>%s:</b> %s", _("Preferred Language"), tmp); - - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - g_string_append_printf(s, "\n<b>%s:</b> ", _("Device")); - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); + if (devicestr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Device"), devicestr); + g_free(devicestr); } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - g_string_append_printf(s, "\n<b>%s:</b> %s", _("Timezone"), tmp); + if (tzstr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Timezone"), tzstr); + g_free(tzstr); + } - attr = silcgaim_get_attr(client_entry->attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - g_string_append_printf(s, "\n<b>%s:</b> %s %s %s (%s)", - _("Geolocation"), - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); + if (geostr) { + g_string_append_printf(s, "\n<b>%s:</b> %s", _("Geolocation"), geostr); + g_free(geostr); + } buf = g_string_free(s, FALSE); return buf;