diff src/protocols/toc/toc.c @ 9058:cde9fb3546ed

[gaim-migrate @ 9834] Removed OPT_PROTO_CORRECT_TIME and moved some functionality out of the core and into oscar.c and toc.c committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 25 May 2004 03:54:12 +0000
parents 7ab20f829190
children 6d7bb1274755
line wrap: on
line diff
--- a/src/protocols/toc/toc.c	Tue May 25 02:10:48 2004 +0000
+++ b/src/protocols/toc/toc.c	Tue May 25 03:54:12 2004 +0000
@@ -24,9 +24,10 @@
 #include "accountopt.h"
 #include "conversation.h"
 #include "debug.h"
-#include "prpl.h"
+#include "multi.h"
 #include "notify.h"
 #include "proxy.h"
+#include "prpl.h"
 #include "request.h"
 #include "util.h"
 
@@ -590,13 +591,14 @@
 static void toc_callback(gpointer data, gint source, GaimInputCondition condition)
 {
 	GaimConnection *gc = (GaimConnection *)data;
+	GaimAccount *account = gaim_connection_get_account(gc);
 	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
 	struct sflap_hdr *hdr;
 	struct signon so;
 	char buf[8 * 1024], *c;
 	char snd[BUF_LEN * 2];
 
-	const char *username = gaim_account_get_username(gc->account);
+	const char *username = gaim_account_get_username(account);
 	char *password;
 
 	/* there's data waiting to be read, so read it. */
@@ -671,6 +673,12 @@
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
 		serv_finish_login(gc);
 
+		/*
+		 * Add me to my buddy list so that we know the time when
+		 * the server thinks I signed on.
+		 */
+		serv_add_buddy(gc, username, NULL);
+
 		/* Client sends TOC toc_init_done message */
 		gaim_debug(GAIM_DEBUG_INFO, "toc",
 				   "Client sends TOC toc_init_done message\n");
@@ -778,9 +786,16 @@
 		} else
 			time_idle = 0;
 
+		/*
+		 * If we have info for ourselves then set our display name, warning
+		 * level and official time of login.
+		 */
 		tmp = g_strdup(gaim_normalize(gc->account, gaim_account_get_username(gc->account)));
-		if (!strcmp(tmp, gaim_normalize(gc->account, c)))
+		if (!strcmp(tmp, gaim_normalize(gc->account, c))) {
 			gaim_connection_set_display_name(gc, c);
+			gc->evil = evil;
+			gc->login_time_official = signon;
+		}
 		g_free(tmp);
 
 		serv_got_update(gc, c, logged, evil, signon, time_idle, type);
@@ -1127,7 +1142,7 @@
 	g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
 
 	buddy = (GaimBuddy *) node;
-	gc = gaim_acount_get_connection(buddy->account);
+	gc = gaim_account_get_connection(buddy->account);
 
 	g_snprintf(buf, MSG_LEN, "toc_get_dir %s",
 			gaim_normalize(buddy->account, buddy->name));
@@ -2103,7 +2118,7 @@
 static GaimPluginProtocolInfo prpl_info =
 {
 	GAIM_PRPL_API_VERSION,
-	OPT_PROTO_CORRECT_TIME,
+	0,
 	NULL,
 	NULL,
 	toc_list_icon,