changeset 10011:32467b63f55a

[gaim-migrate @ 10928] More deprecation of serv_got_update or whatever it's called. Is all the sound and logging stuff done in the new code? I didn't actually check. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 11 Sep 2004 03:37:16 +0000
parents 56e34a659db2
children a38881ec9c0f
files HACKING src/protocols/novell/novell.c src/protocols/rendezvous/rendezvous.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/server.c src/server.h
diffstat 7 files changed, 52 insertions(+), 166 deletions(-) [+]
line wrap: on
line diff
--- a/HACKING	Fri Sep 10 22:39:35 2004 +0000
+++ b/HACKING	Sat Sep 11 03:37:16 2004 +0000
@@ -103,8 +103,8 @@
 show_buddy_list. Assuming the user has a buddy list (all buddy list
 functions are controlled by list.c; when you sign on do_import is called
 and that loads the locally saved list), the protocol calls
-serv_got_update, which sets the information in the appropriate struct
-buddy and then passes it off to set_buddy.
+gaim_prpl_got functions, which set the information in the appropriate 
+struct buddy and then passes it off to set_buddy.
 
 set_buddy is responsible for a lot of stuff, but most of it is done
 implicitly. It's responsible for the sounds (which is just a call to
@@ -242,8 +242,8 @@
 server.c:
   This is where all of the differentiation between the different protocols
   is done.  Nearly everything that's network related goes through here
-  at one point or another. This has good things like serv_send_im and
-  serv_got_update. Most of it should be pretty self-explanatory.
+  at one point or another. This has good things like serv_send_im. Most of 
+  it should be pretty self-explanatory.
 
 sound.c:
   The main function in this file is play_sound, which plays one of 8
@@ -339,9 +339,8 @@
 management of the protocols is, there will only ever be one prpl per
 numeric protocol. Each prpl defines a basic set of functions: login,
 logout, send_im, etc. The prpl is responsible not only for handling
-these functions, but also for calling the appropriate serv_got functions
-(e.g. serv_got_update when a buddy comes online/goes offline/goes
-idle/etc). It handles each of these on a per-connection basis.
+these functions, but also for calling the appropriate prpl_got functions
+It handles each of these on a per-account basis.
 
 So why's it called a PRPL? It stands for PRotocol PLugin. That means
 that it's possible to dynamically add new protocols to gaim. However,
--- a/src/protocols/novell/novell.c	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/protocols/novell/novell.c	Sat Sep 11 03:37:16 2004 +0000
@@ -1175,7 +1175,12 @@
 			break;
 	}
 
-	serv_got_update(gc, buddy->name, loggedin, 0, 0, idle, gstatus);
+	gaim_prpl_user_status(account, buddy->name,
+						  (loggedin ? "online" : "offline"), NULL);
+	if (time_idle > 0)
+		gaim_prpl_got_user_idle(account, buddy->name, TRUE, idle);
+	else
+		gaim_prpl_got_user_idle(account, buddy->name, FALSE, 0);
 #endif
 }
 
--- a/src/protocols/rendezvous/rendezvous.c	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/protocols/rendezvous/rendezvous.c	Sat Sep 11 03:37:16 2004 +0000
@@ -185,6 +185,7 @@
 static void rendezvous_handle_rr_txt(GaimConnection *gc, ResourceRecord *rr, const gchar *name)
 {
 	RendezvousData *rd = gc->proto_data;
+	GaimAccount *account = gaim_connection_get_account(gc);
 	RendezvousBuddy *rb;
 	GSList *rdata;
 	ResourceRecordRDataTXTNode *node1, *node2;
@@ -241,12 +242,12 @@
 				rb->idle += 978307200; /* convert to seconds-since-epoch */
 			}
 			rb->status = UC_IDLE;
-			gaim_prpl_got_user_idle(account, b->name, TRUE, rb->idle);
+			gaim_prpl_got_user_idle(account, name, TRUE, rb->idle);
 		} else if (!strcmp(node1->value, "dnd")) {
 			/* Away */
 			rb->status = UC_UNAVAILABLE;
 		}
-		gaim_prpl_got_user_status(account, b->name, "online", NULL);
+		gaim_prpl_got_user_status(account, name, "online", NULL);
 		/* XXX - Idle time is rb->idle and status is rb->status */
 	}
 
--- a/src/protocols/toc/toc.c	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/protocols/toc/toc.c	Sat Sep 11 03:37:16 2004 +0000
@@ -64,6 +64,7 @@
 #define FILE_GET_UID  "09461348-4C7F-11D1-8222-444553540000"
 #define GAMES_UID     "0946134a-4C7F-11D1-8222-444553540000"
 
+#define UC_UNAVAILABLE	0x01
 #define UC_AOL			0x02
 #define UC_ADMIN		0x04
 #define UC_UNCONFIRMED	0x08
@@ -601,11 +602,11 @@
 				   "Client sends TOC \"toc_signon\" message\n");
 		/* i hate icq. */
 		if (username[0] >= '0' && username[0] <= '9')
-			password = g_strndup(gaim_account_get_password(gc->account), 8);
+			password = g_strndup(gaim_account_get_password(account), 8);
 		else
-			password = g_strdup(gaim_account_get_password(gc->account));
+			password = g_strdup(gaim_account_get_password(account));
 		g_snprintf(snd, sizeof snd, "toc_signon %s %d  %s %s %s \"%s\"",
-			   AUTH_HOST, AUTH_PORT, gaim_normalize(gc->account, username),
+			   AUTH_HOST, AUTH_PORT, gaim_normalize(account, username),
 			   roast_password(password), LANGUAGE, REVISION);
 		g_free(password);
 		if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
@@ -682,8 +683,8 @@
 			tdt->state = STATE_ONLINE;
 			g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
 				   AUTH_HOST, AUTH_PORT,
-				   gaim_normalize(gc->account, gaim_account_get_username(gc->account)),
-				   roast_password(gaim_account_get_password(gc->account)),
+				   gaim_normalize(account, gaim_account_get_username(account)),
+				   roast_password(gaim_account_get_password(account)),
 				   LANGUAGE, REVISION);
 			if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
 				gaim_connection_error(gc, _("Disconnected."));
@@ -697,7 +698,7 @@
 		}
 	} else if (!g_ascii_strcasecmp(c, "CONFIG")) {
 		c = strtok(NULL, ":");
-		gaim_blist_parse_toc_buddy_list(gc->account, c);
+		gaim_blist_parse_toc_buddy_list(account, c);
 	} else if (!g_ascii_strcasecmp(c, "NICK")) {
 		/* ignore NICK so that things get imported/exported properly
 		c = strtok(NULL, ":");
@@ -764,14 +765,21 @@
 		 * 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))) {
+		tmp = g_strdup(gaim_normalize(account, gaim_account_get_username(gc->account)));
+		if (!strcmp(tmp, gaim_normalize(account, c))) {
 			gaim_connection_set_display_name(gc, c);
-			gc->evil = evil;
+			/* XXX - What should the second parameter be here? */
+			gaim_prpl_got_account_warning_level(account, NULL, evil);
+			gaim_prpl_got_account_login_time(account, NULL, signon);
 		}
 		g_free(tmp);
 
-		serv_got_update(gc, c, logged_in, evil, signon, time_idle, type);
+		gaim_prpl_got_user_status(account, c, (logged_in ? "online" : "offline"), NULL);
+		gaim_prpl_got_user_login_time(account, c, signon);
+		if (time_idle > 0)
+			gaim_prpl_got_user_idle(account, c, TRUE, time_idle);
+		else
+			gaim_prpl_got_user_idle(account, c, FALSE, 0);
 	} else if (!g_ascii_strcasecmp(c, "ERROR")) {
 		gaim_notify_error(gc, NULL, show_error_message(), NULL);
 	} else if (!g_ascii_strcasecmp(c, "EVILED")) {
@@ -781,7 +789,7 @@
 		sscanf(strtok(NULL, ":"), "%d", &lev);
 		name = strtok(NULL, ":");
 
-		serv_got_eviled(gc, name, lev);
+		gaim_prpl_got_account_warning_level(account, name, lev);
 	} else if (!g_ascii_strcasecmp(c, "CHAT_JOIN")) {
 		char *name;
 		int id;
@@ -1154,16 +1162,16 @@
 }
 #endif
 
-static void toc_set_away(GaimConnection *g, const char *state, const char *message)
+static void toc_set_away(GaimConnection *gc, const char *state, const char *message)
 {
 	char buf[BUF_LEN * 2];
-	if (g->away) {
-		g_free (g->away);
-		g->away = NULL;
+	if (gc->away) {
+		g_free(gc->away);
+		gc->away = NULL;
 	}
 	if (message) {
 		char *tmp;
-		g->away = g_strdup(message);
+		gc->away = g_strdup(message);
 		tmp = escape_text(message);
 		g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", tmp);
 		g_free(tmp);
--- a/src/protocols/trepia/trepia.c	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/protocols/trepia/trepia.c	Sat Sep 11 03:37:16 2004 +0000
@@ -842,9 +842,9 @@
 				*int_p = id;
 				g_hash_table_insert(session->user_profiles, int_p, profile);
 
-				serv_got_update(session->gc,
-								username, TRUE, 0,
-								trepia_profile_get_login_time(profile), 0, 0);
+				gaim_prpl_got_user_status(account, username, "online", NULL);
+				gaim_prpl_got_user_login_time(account, username,
+											  trepia_profile_get_login_time(profile));
 
 				/* Buddy Icon */
 				if ((value = g_hash_table_lookup(info, "q")) != NULL) {
@@ -853,12 +853,12 @@
 
 					gaim_base64_decode(value, &icon, &icon_len);
 
-					gaim_buddy_icons_set_for_user(session->gc->account,
+					gaim_buddy_icons_set_for_user(account,
 							username, icon, icon_len);
 
 					g_free(icon);
 
-					serv_got_update(session->gc, username, TRUE, 0, 0, 0, 0);
+					gaim_prpl_got_user_status(account, username, "online", NULL);
 				}
 
 				/*
@@ -890,10 +890,12 @@
 
 				b = profile->buddy;
 
-				if (b != NULL)
-					serv_got_update(session->gc,
-									trepia_profile_get_login(profile),
-									FALSE, 0, 0, 0, 0);
+				if (b != NULL) {
+					gaim_prpl_got_user_status(account, trepia_profile_get_login(profile),
+											  "offline", NULL);
+					gaim_prpl_got_user_login_time(account, trepia_profile_get_login(profile),
+												  trepia_profile_get_login_time(profile));
+				}
 
 				gaim_blist_remove_buddy(b);
 
@@ -906,8 +908,8 @@
 		g_hash_table_destroy(info);
 	}
 	else {
-		gaim_debug(GAIM_DEBUG_WARNING, "trepia",
-				   "Unknown data received. Possibly an image?\n");
+		gaim_debug_warning("trepia",
+						   "Unknown data received. Possibly an image?\n");
 	}
 
 	return TRUE;
--- a/src/server.c	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/server.c	Sat Sep 11 03:37:16 2004 +0000
@@ -1053,133 +1053,6 @@
 	g_free(message);
 }
 
-/*
- * @param idle The time at which the buddy became idle, in seconds
- *             since the epoch.
- */
-void serv_got_update(GaimConnection *gc, const char *name, gboolean loggedin,
-					 time_t signon)
-{
-	GaimPresence *presence;
-	GaimAccount *account;
-	GaimConversation *c;
-	GaimBuddy *b;
-	char *alias;
-	GSList *buddies;
-	time_t current_time = time(NULL);
-	int signing_on = 0;
-	int signing_off = 0;
-
-	account = gaim_connection_get_account(gc);
-	b = gaim_find_buddy(account, name);
-
-	if (!b) {
-		gaim_debug(GAIM_DEBUG_ERROR, "server", "No such buddy: %s\n", name);
-		return;
-	}
-
-	c = gaim_find_conversation_with_account(b->name, account);
-
-	/* This code will 'align' the name from the TOC */
-	/* server with what's in our record.  We want to */
-	/* store things how THEY want it... */
-	if (strcmp(name, b->name)) {
-		gaim_blist_rename_buddy(b, name);
-	}
-
-	alias = gaim_escape_html(gaim_buddy_get_alias(b));
-
-	presence = gaim_buddy_get_presence(b);
-
-	if (loggedin) {
-		if (!GAIM_BUDDY_IS_ONLINE(b)) {
-			signing_on = TRUE;
-		}
-	} else if (GAIM_BUDDY_IS_ONLINE(b)) {
-		signing_off = TRUE;
-	}
-
-
-	if (signing_on) {
-		if (c != NULL) {
-			char *tmp = g_strdup_printf(_("%s logged in."), alias);
-
-			gaim_conversation_write(c, NULL, tmp, GAIM_MESSAGE_SYSTEM,
-									time(NULL));
-			g_free(tmp);
-		}
-#if 0
-		else if (awayqueue && find_queue_total_by_name(b->name)) {
-			struct queued_message *qm = g_new0(struct queued_message, 1);
-			g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
-			qm->message = g_strdup_printf(_("%s logged in."), alias);
-			qm->account = gc->account;
-			qm->tm = time(NULL);
-			qm->flags = GAIM_MESSAGE_SYSTEM;
-			message_queue = g_slist_append(message_queue, qm);
-		}
-#endif
-		gaim_sound_play_event(GAIM_SOUND_BUDDY_ARRIVE);
-
-		if(gaim_prefs_get_bool("/core/logging/log_system") &&
-		   gaim_prefs_get_bool("/core/logging/log_signon_signoff")) {
-			GaimAccount *account = gaim_connection_get_account(gc);
-			GaimLog *log = gaim_account_get_log(account);
-			char *tmp = g_strdup_printf(_("%s signed on"), alias);
-
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
-						   current_time, tmp);
-			g_free(tmp);
-		}
-	}
-
-	if (signing_off) {
-		if (c != NULL) {
-			char *tmp = g_strdup_printf(_("%s logged out."), alias);
-			gaim_conversation_write(c, NULL, tmp,
-									GAIM_MESSAGE_SYSTEM, time(NULL));
-			g_free(tmp);
-		}
-#if 0
-		else if (awayqueue && find_queue_total_by_name(b->name)) {
-			struct queued_message *qm = g_new0(struct queued_message, 1);
-			g_snprintf(qm->name, sizeof(qm->name), "%s", b->name);
-			qm->message = g_strdup_printf(_("%s logged out."), alias);
-			qm->account = gc->account;
-			qm->tm = time(NULL);
-			qm->flags = GAIM_MESSAGE_SYSTEM;
-			message_queue = g_slist_append(message_queue, qm);
-		}
-#endif
-		serv_got_typing_stopped(gc, name); /* obviously not typing */
-		gaim_sound_play_event(GAIM_SOUND_BUDDY_LEAVE);
-
-		if(gaim_prefs_get_bool("/core/logging/log_system") &&
-		   gaim_prefs_get_bool("/core/logging/log_signon_signoff")) {
-			GaimAccount *account = gaim_connection_get_account(gc);
-			GaimLog *log = gaim_account_get_log(account);
-			char *tmp = g_strdup_printf(_("%s signed off"), alias);
-
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, (alias ? alias : name),
-						   current_time, tmp);
-			g_free(tmp);
-		}
-	}
-
-	gaim_blist_update_buddy_signon(b, signon);
-
-	if (c != NULL)
-		gaim_conversation_update(c, GAIM_CONV_UPDATE_AWAY);
-
-	gaim_blist_update_buddy_presence(b, loggedin);
-
-	for (buddies = gaim_find_buddies(account, name); buddies; buddies = g_slist_remove(buddies, buddies->data)) {
-		b = buddies->data;
-		gaim_blist_update_buddy_presence(b, loggedin);
-	}
-	g_free(alias);
-}
-
 void serv_got_typing(GaimConnection *gc, const char *name, int timeout,
 					 GaimTypingState state) {
 
--- a/src/server.h	Fri Sep 10 22:39:35 2004 +0000
+++ b/src/server.h	Sat Sep 11 03:37:16 2004 +0000
@@ -76,8 +76,6 @@
 void serv_got_typing_stopped(GaimConnection *gc, const char *name);
 void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
 				 GaimConvImFlags imflags, time_t mtime);
-void serv_got_update(GaimConnection *gc, const char *name, gboolean loggedin,
-					 time_t signon);
 void serv_finish_login(GaimConnection *gc);
 void serv_got_chat_invite(GaimConnection *gc, const char *name,
 						  const char *who, const char *message,