Mercurial > pidgin
comparison src/buddy.c @ 513:eaddaa0dbbcb
[gaim-migrate @ 523]
Oscar gets capabilities.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 21 Jul 2000 01:16:55 +0000 |
| parents | 3133ab511d92 |
| children | 44123888a941 |
comparison
equal
deleted
inserted
replaced
| 512:7922abb3262d | 513:eaddaa0dbbcb |
|---|---|
| 37 #include <time.h> | 37 #include <time.h> |
| 38 | 38 |
| 39 #include <gtk/gtk.h> | 39 #include <gtk/gtk.h> |
| 40 #include <gdk/gdkx.h> | 40 #include <gdk/gdkx.h> |
| 41 #include "gaim.h" | 41 #include "gaim.h" |
| 42 #include <aim.h> | |
| 42 #include "pixmaps/admin_icon.xpm" | 43 #include "pixmaps/admin_icon.xpm" |
| 43 #include "pixmaps/aol_icon.xpm" | 44 #include "pixmaps/aol_icon.xpm" |
| 44 #include "pixmaps/free_icon.xpm" | 45 #include "pixmaps/free_icon.xpm" |
| 45 #include "pixmaps/dt_icon.xpm" | 46 #include "pixmaps/dt_icon.xpm" |
| 46 #include "pixmaps/no_icon.xpm" | 47 #include "pixmaps/no_icon.xpm" |
| 1441 | 1442 |
| 1442 return FALSE; | 1443 return FALSE; |
| 1443 } | 1444 } |
| 1444 | 1445 |
| 1445 | 1446 |
| 1447 static char *caps_string(u_short caps) | |
| 1448 { | |
| 1449 static char buf[BUF_LEN]; | |
| 1450 int count = 0, i = 0; | |
| 1451 u_short bit = 1; | |
| 1452 while (bit <= AIM_CAPS_SENDFILE) { | |
| 1453 if (bit & caps) { | |
| 1454 switch (bit) { | |
| 1455 case AIM_CAPS_BUDDYICON: | |
| 1456 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sBuddy Icon"), count ? "," : ""); | |
| 1457 break; | |
| 1458 case AIM_CAPS_VOICE: | |
| 1459 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sVoice"), count ? "," : ""); | |
| 1460 break; | |
| 1461 case AIM_CAPS_IMIMAGE: | |
| 1462 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sIM Image"), count ? "," : ""); | |
| 1463 break; | |
| 1464 case AIM_CAPS_CHAT: | |
| 1465 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sChat"), count ? "," : ""); | |
| 1466 break; | |
| 1467 case AIM_CAPS_GETFILE: | |
| 1468 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sGet File"), count ? "," : ""); | |
| 1469 break; | |
| 1470 case AIM_CAPS_SENDFILE: | |
| 1471 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sSend File"), count ? "," : ""); | |
| 1472 break; | |
| 1473 } | |
| 1474 count++; | |
| 1475 } | |
| 1476 bit <<= 1; | |
| 1477 } | |
| 1478 return buf; | |
| 1479 } | |
| 1480 | |
| 1481 | |
| 1446 void set_buddy(struct buddy *b) | 1482 void set_buddy(struct buddy *b) |
| 1447 { | 1483 { |
| 1448 char infotip[256]; | 1484 char infotip[256]; |
| 1449 char idlet[16]; | 1485 char idlet[16]; |
| 1450 char warn[256]; | 1486 char warn[256]; |
| 1487 char caps[256]; | |
| 1451 char *who; | 1488 char *who; |
| 1452 int i; | 1489 int i; |
| 1453 int ihrs, imin; | 1490 int ihrs, imin; |
| 1454 time_t t; | 1491 time_t t; |
| 1455 GdkPixmap *pm; | 1492 GdkPixmap *pm; |
| 1489 g_snprintf(warn, sizeof(warn), _("Warnings: %d%%\n"), b->evil); | 1526 g_snprintf(warn, sizeof(warn), _("Warnings: %d%%\n"), b->evil); |
| 1490 | 1527 |
| 1491 } else | 1528 } else |
| 1492 warn[0] = '\0'; | 1529 warn[0] = '\0'; |
| 1493 | 1530 |
| 1494 i = g_snprintf(infotip, sizeof(infotip), _("Name: %s \nLogged in: %s\n%s%s%s"), b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""), itime); | 1531 if (b->caps) { |
| 1532 g_snprintf(caps, sizeof(caps), _("Capabilities: %s\n"), caps_string(b->caps)); | |
| 1533 } else | |
| 1534 caps[0] = '\0'; | |
| 1495 | 1535 |
| 1536 i = g_snprintf(infotip, sizeof(infotip), _("Name: %s \nLogged in: %s\n%s%s%s\n%s"), b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""), itime, caps); | |
| 1537 | |
| 1496 gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, ""); | 1538 gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, ""); |
| 1497 | 1539 |
| 1498 g_free(sotime); | 1540 g_free(sotime); |
| 1499 g_free(itime); | 1541 g_free(itime); |
| 1500 | 1542 |
