changeset 7950:7b8407d8c546

[gaim-migrate @ 8624] Move the "Logged In:" tooltip thingy to the core. Much thanks to Evan Schoenberg of Adium. This shouldn't affect anything for oscar. For jabber some servers/accounts might start showing a "Logged In:" line in people's tooltips. I'm really not sure when it will or won't. I bet faceprint knows! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 29 Dec 2003 06:13:36 +0000
parents b356e2a9d7fc
children d40e91c32acf
files ChangeLog src/blist.c src/blist.h src/gtkblist.c src/protocols/oscar/oscar.c src/server.c
diffstat 6 files changed, 31 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 29 05:14:16 2003 +0000
+++ b/ChangeLog	Mon Dec 29 06:13:36 2003 +0000
@@ -1,7 +1,7 @@
 Gaim: The Pimpin' Penguin IM Clone that's good for the soul!
 
 version 0.75cvs :
-	* WYSIWYG text input
+	* WYSIWYG text input (with scrollbars, too!)
 	* Yahoo! file transfer (Tim Ringenbach)
 	* Yahoo! chat joining fixes (Tim Ringenbach)
 	* Improved i18n support for MSN email notification (Felipe Contreras)
--- a/src/blist.c	Mon Dec 29 05:14:16 2003 +0000
+++ b/src/blist.c	Mon Dec 29 06:13:36 2003 +0000
@@ -302,6 +302,16 @@
 	}
 }
 
+void  gaim_blist_update_buddy_signon (GaimBuddy *buddy, time_t signon)
+{
+	GaimBlistUiOps *ops = gaimbuddylist->ui_ops;
+	if(buddy->signon == signon)
+		return;
+
+	buddy->signon = signon;
+	if (ops)
+		ops->update(gaimbuddylist,(GaimBlistNode*)buddy);
+}
 
 void  gaim_blist_update_buddy_idle (GaimBuddy *buddy, int idle)
 {
--- a/src/blist.h	Mon Dec 29 05:14:16 2003 +0000
+++ b/src/blist.h	Mon Dec 29 06:13:36 2003 +0000
@@ -247,6 +247,13 @@
  */
 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence);
 
+/**
+ * Updates a buddy's signon time.
+ *
+ * @param buddy  The buddy whose idle time has changed.
+ * @param signon The buddy's signon time since the dawn of the UNIX epoch.
+ */
+void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon);
 
 /**
  * Updates a buddy's idle time.
--- a/src/gtkblist.c	Mon Dec 29 05:14:16 2003 +0000
+++ b/src/gtkblist.c	Mon Dec 29 06:13:36 2003 +0000
@@ -1796,7 +1796,8 @@
 		char *statustext = NULL;
 		char *contactaliastext = NULL;
 		char *aliastext = NULL, *nicktext = NULL;
-		char *warning = NULL, *idletime = NULL;
+		char *loggedin = NULL, *idletime = NULL;
+		char *warning = NULL;
 		char *accounttext = NULL;
 
 		if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
@@ -1826,6 +1827,9 @@
 		if (!statustext && !GAIM_BUDDY_IS_ONLINE(b))
 			statustext = g_strdup(_("<b>Status:</b> Offline"));
 
+		if (b->signon > 0)
+			loggedin = gaim_str_seconds_to_string(time(NULL) - b->signon);
+
 		if (b->idle > 0)
 			idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
 
@@ -1846,6 +1850,7 @@
 				       "%s %s"  /* Contact Alias */
 				       "%s %s"  /* Alias */
 				       "%s %s"  /* Nickname */
+				       "%s %s"     /* Logged In */
 				       "%s %s"     /* Idle */
 				       "%s %s"     /* Warning */
 				       "%s%s"     /* Status */
@@ -1855,6 +1860,7 @@
 					   contactaliastext ? _("\n<b>Contact Alias:</b>") : "", contactaliastext ? contactaliastext : "",
 				       aliastext ? _("\n<b>Alias:</b>") : "", aliastext ? aliastext : "",
 				       nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "",
+				       loggedin ? _("\n<b>Logged In:</b>") : "", loggedin ? loggedin : "",
 				       idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "",
 				       b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
 				       statustext ? "\n" : "", statustext ? statustext : "",
@@ -1864,6 +1870,8 @@
 
 		if(warning)
 			g_free(warning);
+		if(loggedin)
+			g_free(loggedin);
 		if(idletime)
 			g_free(idletime);
 		if(statustext)
--- a/src/protocols/oscar/oscar.c	Mon Dec 29 05:14:16 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Dec 29 06:13:36 2003 +0000
@@ -5458,9 +5458,8 @@
 			g_free(status);
 		}
 
+		/* XXX REMOVE THIS WHOLE CHUNCK OF CODE WHEN WE FIGURE THIS OUT */
 		if (userinfo != NULL) {
-			char *tstr = gaim_str_seconds_to_string(time(NULL) - userinfo->onlinesince +
-				(gc->login_time_official ? gc->login_time_official - gc->login_time : 0));
 			/* maybe this will help us figure out the rediculous online times */
 			gaim_debug_info("oscar", "time(NULL): %u\n"
 					"user->onlinesince: %u\n"
@@ -5468,11 +5467,6 @@
 					"gc->login_time: %u\n",
 					time(NULL), userinfo->onlinesince, gc->login_time_official,
 					gc->login_time);
-
-			tmp = ret;
-			ret = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL);
-			g_free(tmp);
-			g_free(tstr);
 		}
 
 		if ((bi != NULL) && (bi->ipaddr)) {
--- a/src/server.c	Mon Dec 29 05:14:16 2003 +0000
+++ b/src/server.c	Mon Dec 29 06:13:36 2003 +0000
@@ -1124,6 +1124,9 @@
 		gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b);
 	}
 
+	if (gc->login_time_official && gc->login_time)
+		signon += gc->login_time_official - gc->login_time;
+	gaim_blist_update_buddy_signon(b, signon);
 	gaim_blist_update_buddy_idle(b, idle);
 	gaim_blist_update_buddy_evil(b, evil);
 /* LOG