comparison src/buddy.c @ 1163:8f70ecf3e884

[gaim-migrate @ 1173] Fixing the FIXMEs committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 28 Nov 2000 16:49:53 +0000
parents 303bb4328328
children ed5bb86253c6
comparison
equal deleted inserted replaced
1162:37257f175ed8 1163:8f70ecf3e884
1700 bit <<= 1; 1700 bit <<= 1;
1701 } 1701 }
1702 return buf; 1702 return buf;
1703 } 1703 }
1704 1704
1705 /* for this we're just going to assume the first connection that registered the buddy.
1706 * if it's not the one you were hoping for then you're shit out of luck */
1705 static void update_idle_time(struct buddy_show *bs) { 1707 static void update_idle_time(struct buddy_show *bs) {
1706 /* this also updates the tooltip since that has idle time in it */ 1708 /* this also updates the tooltip since that has idle time in it */
1707 char idlet[16]; 1709 char idlet[16];
1708 time_t t; 1710 time_t t;
1709 int ihrs, imin; 1711 int ihrs, imin;
1710 struct buddy *b; 1712 struct buddy *b;
1711 1713
1712 char infotip[256]; 1714 char infotip[2048];
1713 char warn[256]; 1715 char warn[256];
1714 char caps[256]; 1716 char caps[256];
1715 char *sotime, *itime; 1717 char *sotime, *itime;
1716 1718
1717 time(&t); 1719 time(&t);
1718 if (g_slist_length(bs->connlist) == 1) { 1720 b = find_buddy(bs->connlist->data, bs->name);
1719 b = find_buddy(bs->connlist->data, bs->name); 1721 if (!b) return;
1720 if (!b) return; 1722 ihrs = (t - b->idle) / 3600; imin = ((t - b->idle) / 60) % 60;
1721 ihrs = (t - b->idle) / 3600; imin = ((t - b->idle) / 60) % 60; 1723
1722 1724 if (ihrs)
1723 if (ihrs) 1725 g_snprintf(idlet, sizeof idlet, "(%d:%02d)", ihrs, imin);
1724 g_snprintf(idlet, sizeof idlet, "(%d:%02d)", ihrs, imin); 1726 else
1725 else 1727 g_snprintf(idlet, sizeof idlet, "(%d)", imin);
1726 g_snprintf(idlet, sizeof idlet, "(%d)", imin); 1728
1727 1729 gtk_widget_hide(bs->idle);
1728 gtk_widget_hide(bs->idle); 1730 if (b->idle)
1729 if (b->idle) 1731 gtk_label_set(GTK_LABEL(bs->idle), idlet);
1730 gtk_label_set(GTK_LABEL(bs->idle), idlet); 1732 else
1731 else 1733 gtk_label_set(GTK_LABEL(bs->idle), "");
1732 gtk_label_set(GTK_LABEL(bs->idle), ""); 1734 if (display_options & OPT_DISP_SHOW_IDLETIME)
1733 if (display_options & OPT_DISP_SHOW_IDLETIME) 1735 gtk_widget_show(bs->idle);
1734 gtk_widget_show(bs->idle); 1736
1735 1737 /* now we do the tooltip */
1736 /* now we do the tooltip */ 1738 sotime = sec_to_text(t - b->signon +
1737 sotime = sec_to_text(t - b->signon + 1739 ((struct gaim_connection *)bs->connlist->data)->correction_time);
1738 ((struct gaim_connection *)bs->connlist->data)->correction_time); 1740
1739 1741 if (b->idle)
1740 if (b->idle) 1742 itime = sec_to_text(t - b->idle);
1741 itime = sec_to_text(t - b->idle); 1743 else {
1742 else { 1744 itime = g_malloc(1); itime[0] = 0;
1743 itime = g_malloc(1); itime[0] = 0; 1745 }
1744 } 1746
1745 1747 if (b->evil)
1746 if (b->evil) 1748 g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil);
1747 g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil); 1749 else
1748 else 1750 warn[0] = '\0';
1749 warn[0] = '\0'; 1751
1750 1752 if (b->caps)
1751 if (b->caps) 1753 g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps));
1752 g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps)); 1754 else
1753 else 1755 caps[0] = '\0';
1754 caps[0] = '\0'; 1756
1755 1757 g_snprintf(infotip, sizeof infotip, _("Alias: %s \nScreen Name: %s\n"
1756 g_snprintf(infotip, sizeof infotip, _("Alias: %s \nScreen Name: %s\n" 1758 "Logged in: %s\n%s%s%s%s%s"),
1757 "Logged in: %s\n%s%s%s%s%s"), 1759 b->show, b->name, sotime, warn,
1758 b->show, b->name, sotime, warn, 1760 (b->idle ? _("Idle: ") : ""), itime,
1759 (b->idle ? _("Idle: ") : ""), itime, 1761 (b->idle ? "\n" : ""), caps);
1760 (b->idle ? "\n" : ""), caps); 1762
1761 1763 gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, "");
1762 gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, ""); 1764
1763 1765 g_free(sotime);
1764 g_free(sotime); 1766 g_free(itime);
1765 g_free(itime);
1766 } else {
1767 /* FIXME : how do we do tooltips and idletime if 2 connections report a buddy?
1768 * keep in mind that we can't assume both connections are the same protocol */
1769 }
1770 } 1767 }
1771 1768
1772 void update_idle_times() { 1769 void update_idle_times() {
1773 GSList *grp = shows; 1770 GSList *grp = shows;
1774 GSList *mem; 1771 GSList *mem;