comparison finch/gntblist.c @ 18437:ecb223f9f75b

Show a pimping cool unicode status emblem for buddies on mobile (thanks, elb). Also show "On Mobile" in the tooltip. Closes #2020.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 05 Jul 2007 06:54:18 +0000
parents 1dbd8ce2f11f
children 24ecab0d40b3
comparison
equal deleted inserted replaced
18434:2bf8792760fe 18437:ecb223f9f75b
505 PurplePresence *presence; 505 PurplePresence *presence;
506 PurpleStatus *now; 506 PurpleStatus *now;
507 gboolean ascii = gnt_ascii_only(); 507 gboolean ascii = gnt_ascii_only();
508 508
509 presence = purple_buddy_get_presence(buddy); 509 presence = purple_buddy_get_presence(buddy);
510 now = purple_presence_get_active_status(presence); 510 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE))
511 511 strncpy(status, ascii ? ":" : "☎", sizeof(status) - 1);
512 prim = purple_status_type_get_primitive(purple_status_get_type(now)); 512 else {
513 513 now = purple_presence_get_active_status(presence);
514 switch(prim) 514
515 { 515 prim = purple_status_type_get_primitive(purple_status_get_type(now));
516 case PURPLE_STATUS_OFFLINE: 516
517 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1); 517 switch(prim) {
518 break; 518 case PURPLE_STATUS_OFFLINE:
519 case PURPLE_STATUS_AVAILABLE: 519 strncpy(status, ascii ? "x" : "⊗", sizeof(status) - 1);
520 strncpy(status, ascii ? "o" : "◯", sizeof(status) - 1); 520 break;
521 break; 521 case PURPLE_STATUS_AVAILABLE:
522 default: 522 strncpy(status, ascii ? "o" : "◯", sizeof(status) - 1);
523 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1); 523 break;
524 break; 524 default:
525 strncpy(status, ascii ? "." : "⊖", sizeof(status) - 1);
526 break;
527 }
525 } 528 }
526 name = purple_buddy_get_alias(buddy); 529 name = purple_buddy_get_alias(buddy);
527 } 530 }
528 else if (PURPLE_BLIST_NODE_IS_CHAT(node)) 531 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
529 { 532 {
1267 { 1270 {
1268 PurplePlugin *prpl; 1271 PurplePlugin *prpl;
1269 PurplePluginProtocolInfo *prpl_info; 1272 PurplePluginProtocolInfo *prpl_info;
1270 PurpleAccount *account; 1273 PurpleAccount *account;
1271 PurpleNotifyUserInfo *user_info; 1274 PurpleNotifyUserInfo *user_info;
1275 PurplePresence *presence;
1272 const char *alias = purple_buddy_get_alias(buddy); 1276 const char *alias = purple_buddy_get_alias(buddy);
1273 char *tmp, *strip; 1277 char *tmp, *strip;
1274 1278
1275 user_info = purple_notify_user_info_new(); 1279 user_info = purple_notify_user_info_new();
1276 1280
1277 account = purple_buddy_get_account(buddy); 1281 account = purple_buddy_get_account(buddy);
1282 presence = purple_buddy_get_presence(buddy);
1278 1283
1279 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias)) 1284 if (!full || g_utf8_collate(purple_buddy_get_name(buddy), alias))
1280 purple_notify_user_info_add_pair(user_info, _("Nickname"), alias); 1285 purple_notify_user_info_add_pair(user_info, _("Nickname"), alias);
1281 1286
1282 tmp = g_strdup_printf("%s (%s)", 1287 tmp = g_strdup_printf("%s (%s)",
1306 tmp = purple_notify_user_info_get_text_with_newline(user_info, "<BR>"); 1311 tmp = purple_notify_user_info_get_text_with_newline(user_info, "<BR>");
1307 purple_notify_user_info_destroy(user_info); 1312 purple_notify_user_info_destroy(user_info);
1308 1313
1309 strip = purple_markup_strip_html(tmp); 1314 strip = purple_markup_strip_html(tmp);
1310 g_string_append(str, strip); 1315 g_string_append(str, strip);
1316
1317 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE))
1318 g_string_append(str, _("On Mobile"));
1319
1311 g_free(strip); 1320 g_free(strip);
1312 g_free(tmp); 1321 g_free(tmp);
1313 } 1322 }
1314 1323
1315 static GString* 1324 static GString*