changeset 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 c55aa23bf56e
children 665657341a80
files src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/prpl.h src/server.c
diffstat 4 files changed, 33 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Tue May 25 02:10:48 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Tue May 25 03:54:12 2004 +0000
@@ -2680,6 +2680,7 @@
 
 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
 	GaimConnection *gc = sess->aux_data;
+	GaimAccount *account = gaim_connection_get_account(gc);
 	OscarData *od = gc->proto_data;
 	struct buddyinfo *bi;
 	time_t time_idle = 0, signon = 0;
@@ -2785,6 +2786,17 @@
 		g_free(b16);
 	}
 
+	/*
+	 * If we have info for ourselves, then update our local warning
+	 * level and set our official time of login.  Is this necessary?
+	 * XXX - This needs to be changed some how.  evil should not be
+	 * handled by the core at all?
+	 */
+	if (!aim_sncmp(info->sn, gaim_account_get_username(account))) {
+		gc->evil = (info->warnlevel/10.0);
+		gc->login_time_official = signon;
+	}
+
 	serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type);
 
 	return 1;
--- 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,
--- a/src/prpl.h	Tue May 25 02:10:48 2004 +0000
+++ b/src/prpl.h	Tue May 25 03:54:12 2004 +0000
@@ -112,24 +112,6 @@
 typedef enum
 {
 	/**
-	 * TOC and Oscar send HTML-encoded messages;
-	 * most other protocols don't.
-	 */
-#if 0
-	#define OPT_PROTO_HTML            0x00000001 this should be per-connection */
-#endif
-
-	/**
-	 * Synchronize the time between the local computer and the server.
-	 *
-	 * TOC and Oscar have signon time, and the server's time needs
-	 * to be adjusted to match your computer's time.
-	 *
-	 * We wouldn't need this if everyone used NTP.
-	 */
-	OPT_PROTO_CORRECT_TIME = 0x00000002,
-
-	/**
 	 * Use a unique name, not an alias, for chat rooms.
 	 *
 	 * Jabber lets you choose what name you want for chat.
--- a/src/server.c	Tue May 25 02:10:48 2004 +0000
+++ b/src/server.c	Tue May 25 03:54:12 2004 +0000
@@ -147,11 +147,8 @@
 
 	account = gaim_connection_get_account(gc);
 
-	if (gaim_account_get_user_info(account) != NULL) {
-		/* buf = gaim_strdup_withhtml(gc->user->user_info); */
+	if (gaim_account_get_user_info(account) != NULL)
 		serv_set_info(gc, gaim_account_get_user_info(account));
-		/* g_free(buf); */
-	}
 
 	if (gc->idle_timer > 0)
 		gaim_timeout_remove(gc->idle_timer);
@@ -159,12 +156,6 @@
 	gc->idle_timer = gaim_timeout_add(20000, check_idle, gc);
 	serv_touch_idle(gc);
 
-	/* Move this hack into toc.c */
-	if (prpl_info->options & OPT_PROTO_CORRECT_TIME)
-		serv_add_buddy(gc,
-				gaim_account_get_username(gaim_connection_get_account(gc)),
-				NULL);
-
 	update_keepalive(gc, TRUE);
 }
 
@@ -1066,20 +1057,6 @@
 	account = gaim_connection_get_account(gc);
 	b = gaim_find_buddy(account, name);
 
-	if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options &
-				   OPT_PROTO_CORRECT_TIME)) {
-
-		char *tmp = g_strdup(gaim_normalize(account, name));
-		if (!gaim_utf8_strcasecmp(tmp,
-				gaim_normalize(account, gaim_account_get_username(account)))) {
-
-			gc->evil = evil;
-			gc->login_time_official = signon;
-			/*update_idle_times();*/
-		}
-		g_free(tmp);
-	}
-
 	if (!b) {
 		gaim_debug(GAIM_DEBUG_ERROR, "server", "No such buddy: %s\n", name);
 		return;