changeset 6621:42fdf16f1dad

[gaim-migrate @ 7145] Individual accounts remember the "No Proxy" setting instead of reverting back to "Use Global Proxy Settings" Proxy settings for individual accounts do not revert to "No Proxy" if you open an account, don't change the proxy drop down, then save the account. Those two sound like the same thing, but they're different. I think. Added the "use environmental variables" setting in a way that isn't horrible. We're not using that thing that splits the proxy variable into host:port yet. I'll do that later. I would have done that earlier, but I had to go buy a bike. Also, I'd like to show what the environmental variables are set to somewhere. That'll come later. Also a patch from Robot101: (22:10:25) Bzubhipheron: I have a patch that replaces #define WFLAG_* with GaimMessageFlags GAIM_MESSAGE_* (22:10:30) Bzubhipheron: (an enum in disguise) (22:14:18) Bzubhipheron: GaimMessageFlags protrays much better typing information than "int". most of the other #defines are gone, and glib standardises on enums for its flags too. (22:14:27) Bzubhipheron: (gone or going) (22:14:45) Bzubhipheron: and it makes the prototype of my message queueing stuff prettier. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 25 Aug 2003 02:49:42 +0000
parents 7230e5920911
children a4622f1fb5a1
files ChangeLog plugins/statenotify.c plugins/timestamp.c src/account.c src/account.h src/conversation.c src/conversation.h src/gaimrc.c src/gtkaccount.c src/gtkconv.c src/gtkpounce.c src/gtkprefs.c src/protocols/irc/cmds.c src/protocols/irc/msgs.c src/protocols/msn/switchboard.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/yahoo/util.c src/proxy.c src/proxy.h src/server.c src/server.h src/ui.h
diffstat 23 files changed, 321 insertions(+), 322 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 25 00:39:39 2003 +0000
+++ b/ChangeLog	Mon Aug 25 02:49:42 2003 +0000
@@ -9,9 +9,10 @@
 	* Yahoo color receiving support (Tim Ringenbach (marv_sf))
 	* Yahoo and MSN get info support (Nathan Poznick)
 	* Fixed Jabber registrations.
+	* Corrected problems with proxy preferences.
 	* Catalan translation updated (Robert Millan)
+	* German translation updated (Bjoern Voigt)
 	* Swedish translation updated (Tore Lundqvist (luntor))
-	* German translation updated (Bjoern Voigt)
 
 version 0.67 (08/14/2003):
 	* Brought back the message notification plugin (Brian Tarricone)
--- a/plugins/statenotify.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/plugins/statenotify.c	Mon Aug 25 02:49:42 2003 +0000
@@ -21,7 +21,7 @@
 
 	g_snprintf(buf, sizeof(buf), message, who);
 
-	gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
+	gaim_conversation_write(conv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 }
 
 static void
--- a/plugins/timestamp.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/plugins/timestamp.c	Mon Aug 25 02:49:42 2003 +0000
@@ -32,7 +32,7 @@
 
 	strftime(mdate, sizeof(mdate), "%H:%M", localtime(&tim));
 	buf = g_strdup_printf("            %s", mdate);
-	gaim_conversation_write(c, NULL, buf, -1, WFLAG_NOLOG, tim);
+	gaim_conversation_write(c, NULL, buf, -1, GAIM_MESSAGE_NO_LOG, tim);
 	g_free(buf);
 	return TRUE;
 }
--- a/src/account.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/account.c	Mon Aug 25 02:49:42 2003 +0000
@@ -930,12 +930,16 @@
 			if (!strcmp(buffer, "global"))
 				gaim_proxy_info_set_type(data->proxy_info,
 										 GAIM_PROXY_USE_GLOBAL);
+			else if (!strcmp(buffer, "none"))
+				gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_NONE);
 			else if (!strcmp(buffer, "http"))
 				gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_HTTP);
 			else if (!strcmp(buffer, "socks4"))
 				gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_SOCKS4);
 			else if (!strcmp(buffer, "socks5"))
 				gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_SOCKS5);
+			else if (!strcmp(buffer, "envvar"))
+				gaim_proxy_info_set_type(data->proxy_info, GAIM_PROXY_USE_ENVVAR);
 			else
 				gaim_debug(GAIM_DEBUG_ERROR, "account",
 						   "Invalid proxy type found when loading account "
@@ -984,7 +988,7 @@
 	else if (!strcmp(element_name, "proxy")) {
 		data->in_proxy = FALSE;
 
-		if (gaim_proxy_info_get_type(data->proxy_info) == GAIM_PROXY_NONE) {
+		if (gaim_proxy_info_get_type(data->proxy_info) == GAIM_PROXY_USE_GLOBAL) {
 			gaim_proxy_info_destroy(data->proxy_info);
 			data->proxy_info = NULL;
 		}
@@ -1173,20 +1177,25 @@
 
 	g_hash_table_foreach(account->ui_settings, write_ui_setting_list, fp);
 
-	if ((proxy_info = gaim_account_get_proxy_info(account)) != NULL &&
-		(proxy_type = gaim_proxy_info_get_type(proxy_info)) != GAIM_PROXY_NONE)
+	if ((proxy_info = gaim_account_get_proxy_info(account)) != NULL)
 	{
 		const char *value;
 		int int_value;
 
+		proxy_type = gaim_proxy_info_get_type(proxy_info);
+
 		fprintf(fp, "  <proxy>\n");
 		fprintf(fp, "   <type>%s</type>\n",
 				(proxy_type == GAIM_PROXY_USE_GLOBAL ? "global" :
+				 proxy_type == GAIM_PROXY_NONE       ? "none"   :
 				 proxy_type == GAIM_PROXY_HTTP       ? "http"   :
 				 proxy_type == GAIM_PROXY_SOCKS4     ? "socks4" :
-				 proxy_type == GAIM_PROXY_SOCKS5     ? "socks5" : "unknown"));
+				 proxy_type == GAIM_PROXY_SOCKS5     ? "socks5" :
+				 proxy_type == GAIM_PROXY_USE_ENVVAR ? "envvar" : "unknown"));
 
-		if (proxy_type != GAIM_PROXY_USE_GLOBAL) {
+		if (proxy_type != GAIM_PROXY_USE_GLOBAL &&
+			proxy_type != GAIM_PROXY_NONE &&
+			proxy_type != GAIM_PROXY_USE_ENVVAR) {
 			if ((value = gaim_proxy_info_get_host(proxy_info)) != NULL)
 				fprintf(fp, "   <host>%s</host>\n", value);
 
--- a/src/account.h	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/account.h	Mon Aug 25 02:49:42 2003 +0000
@@ -41,28 +41,30 @@
 
 struct _GaimAccount
 {
-	char *username;             /**< The username.                 */
-	char *alias;                /**< The current alias.            */
-	char *password;             /**< The account password.         */
-	char *user_info;            /**< User information.             */
+	char *username;             /**< The username.                        */
+	char *alias;                /**< The current alias.                   */
+	char *password;             /**< The account password.                */
+	char *user_info;            /**< User information.                    */
 
-	char *buddy_icon;           /**< The buddy icon.               */
+	char *buddy_icon;           /**< The buddy icon.                      */
 
-	gboolean remember_pass;     /**< Remember the password.        */
+	gboolean remember_pass;     /**< Remember the password.               */
 
-	char *protocol_id;          /**< The ID of the protocol.       */
+	char *protocol_id;          /**< The ID of the protocol.              */
 
-	GaimConnection *gc;         /**< The connection handle.        */
+	GaimConnection *gc;         /**< The connection handle.               */
 
-	GHashTable *settings;       /**< Protocol-specific settings.   */
-	GHashTable *ui_settings;    /**< UI-specific settings.         */
+	GHashTable *settings;       /**< Protocol-specific settings.          */
+	GHashTable *ui_settings;    /**< UI-specific settings.                */
 
-	char *ip;                   /**< The IP address for transfers. */
-	GaimProxyInfo *proxy_info;  /**< Proxy information.            */
+	char *ip;                   /**< The IP address for transfers.        */
+	GaimProxyInfo *proxy_info;  /**< Proxy information.  This will be set */
+								/*   to NULL when the account inherits    */
+								/*   proxy settings from global prefs.    */
 
-	GSList *permit;             /**< Permit list.                  */
-	GSList *deny;               /**< Deny list.                    */
-	int perm_deny;              /**< The permit/deny setting.      */
+	GSList *permit;             /**< Permit list.                         */
+	GSList *deny;               /**< Deny list.                           */
+	int perm_deny;              /**< The permit/deny setting.             */
 };
 
 #ifdef __cplusplus
--- a/src/conversation.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/conversation.c	Mon Aug 25 02:49:42 2003 +0000
@@ -374,9 +374,9 @@
 
 					if (binary)
 						gaim_im_write(im, NULL, bigbuf, length,
-									  WFLAG_SEND, time(NULL));
+									  GAIM_MESSAGE_SEND, time(NULL));
 					else
-						gaim_im_write(im, NULL, buffy, -1, WFLAG_SEND,
+						gaim_im_write(im, NULL, buffy, -1, GAIM_MESSAGE_SEND,
 									  time(NULL));
 				}
 
@@ -388,7 +388,7 @@
 								   buffy, -1, imflags);
 
 				if (err > 0)
-					gaim_im_write(im, NULL, buf, -1, WFLAG_SEND, time(NULL));
+					gaim_im_write(im, NULL, buf, -1, GAIM_MESSAGE_SEND, time(NULL));
 			}
 
 			gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
@@ -1430,7 +1430,7 @@
 
 void
 gaim_conversation_write(GaimConversation *conv, const char *who,
-						const char *message, size_t length, int flags,
+						const char *message, size_t length, GaimMessageFlags flags,
 						time_t mtime)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
@@ -1470,7 +1470,7 @@
 			!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
 
 			if (who == NULL) {
-				if (flags & WFLAG_SEND) {
+				if (flags & GAIM_MESSAGE_SEND) {
 					b = gaim_find_buddy(account,
 										gaim_account_get_username(account));
 
@@ -1507,19 +1507,19 @@
 	win = gaim_conversation_get_window(conv);
 
 	/* Tab highlighting */
-	if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM))
+	if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM))
 		return;
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
-		if ((flags & WFLAG_RECV) == WFLAG_RECV)
+		if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV)
 			gaim_im_set_typing_state(GAIM_IM(conv), GAIM_NOT_TYPING);
 	}
 
 	if (gaim_window_get_active_conversation(win) != conv) {
-		if ((flags & WFLAG_NICK) == WFLAG_NICK ||
+		if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK ||
 				gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK)
 			unseen = GAIM_UNSEEN_NICK;
-		else if ((flags & WFLAG_SYSTEM) == WFLAG_SYSTEM &&
+		else if ((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM &&
 				 gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT)
 			unseen = GAIM_UNSEEN_EVENT;
 		else
@@ -1683,7 +1683,7 @@
 
 void
 gaim_im_write(GaimIm *im, const char *who, const char *message,
-			  size_t len, int flags, time_t mtime)
+			  size_t len, GaimMessageFlags flags, time_t mtime)
 {
 	GaimConversation *c;
 
@@ -1872,7 +1872,7 @@
 
 void
 gaim_chat_write(GaimChat *chat, const char *who, const char *message,
-				int flags, time_t mtime)
+				GaimMessageFlags flags, time_t mtime)
 {
 	GaimAccount *account;
 	GaimConversation *conv;
@@ -1890,7 +1890,7 @@
 	if (gaim_chat_is_user_ignored(chat, who))
 		return;
 
-	if (!(flags & WFLAG_WHISPER)) {
+	if (!(flags & GAIM_MESSAGE_WHISPER)) {
 		char *str;
 		const char *disp;
 
@@ -1900,13 +1900,13 @@
 		if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) ||
 			(disp && !gaim_utf8_strcasecmp(str, normalize(disp)))) {
 
-			flags |= WFLAG_SEND;
+			flags |= GAIM_MESSAGE_SEND;
 		}
 		else {
-			flags |= WFLAG_RECV;
+			flags |= GAIM_MESSAGE_RECV;
 
 			if (find_nick(gc, message))
-				flags |= WFLAG_NICK;
+				flags |= GAIM_MESSAGE_NICK;
 		}
 
 		g_free(str);
@@ -1959,7 +1959,7 @@
 					   _("%s [<I>%s</I>] entered the room."),
 					   user, extra_msg);
 
-		gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL));
+		gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 	}
 
 	gaim_signal_emit(gaim_conversations_get_handle(),
@@ -2043,7 +2043,7 @@
 		g_snprintf(tmp, sizeof(tmp),
 				   _("%s is now known as %s"), old_user, new_user);
 
-		gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL));
+		gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 	}
 }
 
@@ -2087,7 +2087,7 @@
 		else
 			g_snprintf(tmp, sizeof(tmp), _("%s left the room."), user);
 
-		gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL));
+		gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 	}
 
 	gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
@@ -2163,7 +2163,7 @@
 			g_snprintf(tmp, sizeof(tmp), _(" left the room (%s)."), reason);
 
 			gaim_conversation_write(conv, NULL, tmp, -1,
-									WFLAG_SYSTEM, time(NULL));
+									GAIM_MESSAGE_SYSTEM, time(NULL));
 		}
 	}
 }
--- a/src/conversation.h	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/conversation.h	Mon Aug 25 02:49:42 2003 +0000
@@ -97,6 +97,21 @@
 
 } GaimTypingState;
 
+/**
+ * Flags applicable to a message. Most will have send, recv or system.
+ */
+typedef enum
+{
+	GAIM_MESSAGE_SEND = 0x01,      /**< Outgoing message.     */
+	GAIM_MESSAGE_RECV = 0x02,      /**< Incoming message.     */
+	GAIM_MESSAGE_SYSTEM = 0x04,    /**< System message.       */
+	GAIM_MESSAGE_AUTO_RESP = 0x08, /**< Auto response.        */
+	GAIM_MESSAGE_COLORIZE = 0x10,  /**< Colorize nicks.       */
+	GAIM_MESSAGE_NICK = 0x20,      /**< Contains your nick.   */
+	GAIM_MESSAGE_NO_LOG = 0x40,    /**< Do not log.           */
+	GAIM_MESSAGE_WHISPER = 0x80    /**< Whispered message.    */
+} GaimMessageFlags;
+
 #include "account.h"
 #include "server.h"
 
@@ -136,11 +151,11 @@
 {
 	void (*destroy_conversation)(GaimConversation *conv);
 	void (*write_chat)(GaimConversation *conv, const char *who,
-					   const char *message, int flags, time_t mtime);
+					   const char *message, GaimMessageFlags flags, time_t mtime);
 	void (*write_im)(GaimConversation *conv, const char *who,
-					 const char *message, size_t len, int flags, time_t mtime);
+					 const char *message, size_t len, GaimMessageFlags flags, time_t mtime);
 	void (*write_conv)(GaimConversation *conv, const char *who,
-					   const char *message, size_t length, int flags,
+					   const char *message, size_t length, GaimMessageFlags flags,
 					   time_t mtime);
 
 	void (*chat_add_user)(GaimConversation *conv, const char *user);
@@ -732,14 +747,14 @@
  * @param who     The user who sent the message.
  * @param message The message.
  * @param length  The length of the message.
- * @param flags   The flags.
+ * @param flags   The message flags.
  * @param mtime   The time the message was sent.
  *
  * @see gaim_im_write()
  * @see gaim_chat_write()
  */
 void gaim_conversation_write(GaimConversation *conv, const char *who,
-							 const char *message, size_t length, int flags,
+							 const char *message, size_t length, GaimMessageFlags flags,
 							 time_t mtime);
 
 /**
@@ -884,11 +899,11 @@
  * @param message The message to write.
  * @param len     The length of the message, or -1 to specify the length
  *                of @a message.
- * @param flag    The flags.
+ * @param flags   The message flags.
  * @param mtime   The time the message was sent.
  */
 void gaim_im_write(GaimIm *im, const char *who,
-				   const char *message, size_t len, int flag, time_t mtime);
+				   const char *message, size_t len, GaimMessageFlags flags, time_t mtime);
 
 /**
  * Sends a message to this IM conversation.
@@ -1043,11 +1058,11 @@
  * @param chat    The chat.
  * @param who     The user who sent the message.
  * @param message The message to write.
- * @param flag    The flags.
+ * @param flags   The flags.
  * @param mtime   The time the message was sent.
  */
 void gaim_chat_write(GaimChat *chat, const char *who,
-					 const char *message, int flag, time_t mtime);
+					 const char *message, GaimMessageFlags flags, time_t mtime);
 
 /**
  * Sends a message to this chat conversation.
--- a/src/gaimrc.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/gaimrc.c	Mon Aug 25 02:49:42 2003 +0000
@@ -1347,106 +1347,6 @@
 	}
 }
 
-static gboolean gaimrc_parse_proxy_uri(const char *proxy)
-{
-	GaimProxyInfo *info;
-
-	char *c, *d;
-	char buffer[2048];
-
-	char host[128];
-	char user[128];
-	char pass[128];
-	int  port = 0;
-	int  len  = 0;
-
-	host[0] = '\0';
-	user[0] = '\0';
-	pass[0] = '\0';
-
-	gaim_debug(GAIM_DEBUG_MISC, "gaimrc",
-			   "gaimrc_parse_proxy_uri(%s)\n", proxy);
-
-	if ((c = strchr(proxy, ':')) == NULL)
-	{
-		gaim_debug(GAIM_DEBUG_ERROR, "gaimrc",
-				   "No URI detected.\n");
-		/* No URI detected. */
-		return FALSE;
-	}
-
-	len = c - proxy;
-
-	if (strncmp(proxy, "http://", len + 3))
-		return FALSE;
-
-	gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Found HTTP proxy.\n");
-	/* Get past "://" */
-	c += 3;
-
-	gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Looking at %s\n", c);
-
-	for (;;)
-	{
-		*buffer = '\0';
-		d = buffer;
-
-		while (*c != '\0' && *c != '@' && *c != ':' && *c != '/')
-			*d++ = *c++;
-
-		*d = '\0';
-
-		if (*c == ':')
-		{
-			/*
-			 * If there is a '@' in there somewhere, we are in the auth part.
-			 * If not, host.
-			 */
-			if (strchr(c, '@') != NULL)
-				strcpy(user, buffer);
-			else
-				strcpy(host, buffer);
-		}
-		else if (*c == '@')
-		{
-			if (user[0] == '\0')
-				strcpy(user, buffer);
-			else
-				strcpy(pass, buffer);
-		}
-		else if (*c == '/' || *c == '\0')
-		{
-			if (host[0] == '\0')
-				strcpy(host, buffer);
-			else
-				port = atoi(buffer);
-
-			/* Done. */
-			break;
-		}
-
-		c++;
-	}
-
-	/* NOTE: HTTP_PROXY takes precendence. */
-	info = gaim_global_proxy_get_info();
-
-	if (*host) gaim_proxy_info_set_host(info, host);
-	if (*user) gaim_proxy_info_set_username(info, user);
-	if (*pass) gaim_proxy_info_set_password(info, pass);
-
-	gaim_proxy_info_set_port(info, port);
-
-	gaim_debug(GAIM_DEBUG_MISC, "gaimrc",
-			   "Host: '%s', User: '%s', Password: '%s', Port: %d\n",
-			   gaim_proxy_info_get_host(info),
-			   gaim_proxy_info_get_username(info),
-			   gaim_proxy_info_get_password(info),
-			   gaim_proxy_info_get_port(info));
-
-	return TRUE;
-}
-
 static void gaimrc_read_proxy(FILE *f)
 {
 	char buf[2048];
@@ -1482,49 +1382,6 @@
 			gaim_proxy_info_set_password(info, p->value[0]);
 		}
 	}
-
-	if (gaim_proxy_info_get_host(info) != NULL)
-		gaim_global_proxy_set_from_prefs(TRUE);
-	else {
-		const char *host;
-		gboolean getVars = TRUE;
-
-		if ((host = g_getenv("HTTP_PROXY")) != NULL ||
-			(host = g_getenv("http_proxy")) != NULL ||
-			(host = g_getenv("HTTPPROXY")) != NULL) {
-
-			gaim_proxy_info_set_host(info, host);
-		}
-
-		if (gaim_proxy_info_get_host(info) != NULL)
-			getVars = !gaimrc_parse_proxy_uri(gaim_proxy_info_get_host(info));
-
-		if (getVars)
-		{
-			const char *port_str, *user, *pass;
-
-			if ((port_str = g_getenv("HTTP_PROXY_PORT")) != NULL ||
-				(port_str = g_getenv("http_proxy_port")) != NULL ||
-				(port_str = g_getenv("HTTPPROXYPORT")) != NULL) {
-
-				gaim_proxy_info_set_port(info, atoi(port_str));
-			}
-
-			if ((user = g_getenv("HTTP_PROXY_USER")) != NULL ||
-				(user = g_getenv("http_proxy_user")) != NULL ||
-				(user = g_getenv("HTTPPROXYUSER")) != NULL) {
-
-				gaim_proxy_info_set_username(info, user);
-			}
-
-			if ((pass = g_getenv("HTTP_PROXY_PASS")) != NULL ||
-				(pass = g_getenv("http_proxy_pass")) != NULL ||
-				(pass = g_getenv("HTTPPROXYPASS")) != NULL) {
-
-				gaim_proxy_info_set_password(info, pass);
-			}
-		}
-	}
 }
 
 static void set_defaults()
--- a/src/gtkaccount.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/gtkaccount.c	Mon Aug 25 02:49:42 2003 +0000
@@ -736,6 +736,13 @@
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 	gtk_widget_show(item);
 
+	/* Use Environmental Settings */
+	item = gtk_menu_item_new_with_label(_("Use Environmental Settings"));
+	g_object_set_data(G_OBJECT(item), "proxytype",
+					  GINT_TO_POINTER(GAIM_PROXY_USE_ENVVAR));
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+	gtk_widget_show(item);
+
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
 
 	return dropdown;
@@ -748,7 +755,8 @@
 		gtk_option_menu_get_history(GTK_OPTION_MENU(optmenu)) - 1;
 
 	if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL ||
-		dialog->new_proxy_type == GAIM_PROXY_NONE) {
+		dialog->new_proxy_type == GAIM_PROXY_NONE ||
+		dialog->new_proxy_type == GAIM_PROXY_USE_ENVVAR) {
 
 		gtk_widget_hide_all(dialog->proxy_vbox);
 	}
@@ -832,10 +840,13 @@
 		GaimProxyType type = gaim_proxy_info_get_type(proxy_info);
 
 		/* Hah! */
+		/* I dunno what you're laughing about, fuzz ball. */
+		dialog->new_proxy_type = type;
 		gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->proxy_dropdown),
 									(int)type + 1);
 
-		if (type == GAIM_PROXY_NONE || type == GAIM_PROXY_USE_GLOBAL) {
+		if (type == GAIM_PROXY_USE_GLOBAL || type == GAIM_PROXY_NONE ||
+			type == GAIM_PROXY_USE_ENVVAR) {
 			gtk_widget_hide_all(vbox2);
 		}
 		else {
@@ -1030,7 +1041,7 @@
 	}
 
 	/* Set the proxy stuff. */
-	if (dialog->new_proxy_type == GAIM_PROXY_NONE) {
+	if (dialog->new_proxy_type == GAIM_PROXY_USE_GLOBAL) {
 		gaim_account_set_proxy_info(dialog->account, NULL);
 	}
 	else {
@@ -1106,8 +1117,6 @@
 static void
 register_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog)
 {
-	GaimPluginProtocolInfo *prpl_info = dialog->prpl_info;
-
 	ok_account_prefs_cb(NULL, dialog);
 
 	gaim_account_register(dialog->account);
--- a/src/gtkconv.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/gtkconv.c	Mon Aug 25 02:49:42 2003 +0000
@@ -2698,7 +2698,7 @@
 			matches = g_list_remove(matches, matches->data);
 		}
 
-		gaim_conversation_write(conv, NULL, addthis, -1, WFLAG_NOLOG,
+		gaim_conversation_write(conv, NULL, addthis, -1, GAIM_MESSAGE_NO_LOG,
 								time(NULL));
 		gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1);
 		g_free(addthis);
@@ -4204,14 +4204,14 @@
 
 static void
 gaim_gtkconv_write_im(GaimConversation *conv, const char *who,
-					  const char *message, size_t len, int flags,
+					  const char *message, size_t len, GaimMessageFlags flags,
 					  time_t mtime)
 {
 	GaimGtkConversation *gtkconv;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	if (!(flags & WFLAG_NOLOG) &&
+	if (!(flags & GAIM_MESSAGE_NO_LOG) &&
 		gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) {
 
 		gaim_window_raise(gaim_conversation_get_window(conv));
@@ -4219,7 +4219,7 @@
 
 	/* Play a sound, if specified in prefs. */
 	if (gtkconv->make_sound) {
-		if (flags & WFLAG_RECV) {
+		if (flags & GAIM_MESSAGE_RECV) {
 			if (gtkconv->u.im->a_virgin &&
 				gaim_prefs_get_bool("/gaim/gtk/sound/enabled/first_im_recv")) {
 
@@ -4240,7 +4240,7 @@
 
 static void
 gaim_gtkconv_write_chat(GaimConversation *conv, const char *who,
-						const char *message, int flags, time_t mtime)
+						const char *message, GaimMessageFlags flags, time_t mtime)
 {
 	GaimGtkConversation *gtkconv;
 
@@ -4248,10 +4248,10 @@
 
 	/* Play a sound, if specified in prefs. */
 	if (gtkconv->make_sound) {
-		if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND))
+		if (!(flags & GAIM_MESSAGE_WHISPER) && (flags & GAIM_MESSAGE_SEND))
 			gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY);
-		else if (flags & WFLAG_RECV) {
-			if ((flags & WFLAG_NICK) &&
+		else if (flags & GAIM_MESSAGE_RECV) {
+			if ((flags & GAIM_MESSAGE_NICK) &&
 				gaim_prefs_get_bool("/gaim/gtk/sound/enabled/nick_said")) {
 
 				gaim_sound_play_event(GAIM_SOUND_CHAT_NICK);
@@ -4262,10 +4262,10 @@
 	}
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks"))
-		flags |= WFLAG_COLORIZE;
+		flags |= GAIM_MESSAGE_COLORIZE;
 
 	/* Raise the window, if specified in prefs. */
-	if (!(flags & WFLAG_NOLOG) &&
+	if (!(flags & GAIM_MESSAGE_NO_LOG) &&
 		gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) {
 
 		gaim_window_raise(gaim_conversation_get_window(conv));
@@ -4276,7 +4276,7 @@
 
 static void
 gaim_gtkconv_write_conv(GaimConversation *conv, const char *who,
-						const char *message, size_t length, int flags,
+						const char *message, size_t length, GaimMessageFlags flags,
 						time_t mtime)
 {
 	GaimGtkConversation *gtkconv;
@@ -4301,7 +4301,7 @@
 
 	win = gaim_conversation_get_window(conv);
 
-	if (!(flags & WFLAG_NOLOG) &&
+	if (!(flags & GAIM_MESSAGE_NO_LOG) &&
 		((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT &&
 		  gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) ||
 		 (gaim_conversation_get_type(conv) == GAIM_CONV_IM &&
@@ -4340,7 +4340,7 @@
 		gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE;
 	}
 
-	if (flags & WFLAG_SYSTEM) {
+	if (flags & GAIM_MESSAGE_SYSTEM) {
 		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
 			g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>",
 					   mdate, message);
@@ -4366,7 +4366,7 @@
 			conv->history = g_string_append(conv->history, "<BR>\n");
 		}
 
-		if (!(flags & WFLAG_NOLOG) && gaim_conversation_is_logging(conv)) {
+		if (!(flags & GAIM_MESSAGE_NO_LOG) && gaim_conversation_is_logging(conv)) {
 
 			char *t1;
 			char nm[256];
@@ -4398,7 +4398,7 @@
 				g_free(t1);
 		}
 	}
-	else if (flags & WFLAG_NOLOG) {
+	else if (flags & GAIM_MESSAGE_NO_LOG) {
 		g_snprintf(buf, BUF_LONG,
 				   "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>",
 				   message);
@@ -4408,7 +4408,7 @@
 	else {
 		char *new_message = g_memdup(message, length);
 		
-		if (flags & WFLAG_WHISPER) {
+		if (flags & GAIM_MESSAGE_WHISPER) {
 			str = g_malloc(1024);
 
 			/* If we're whispering, it's not an autoresponse. */
@@ -4425,12 +4425,12 @@
 			if (meify(new_message, length)) {
 				str = g_malloc(1024);
 
-				if (flags & WFLAG_AUTO)
+				if (flags & GAIM_MESSAGE_AUTO_RESP)
 					g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who);
 				else
 					g_snprintf(str, 1024, "***%s", who);
 
-				if (flags & WFLAG_NICK)
+				if (flags & GAIM_MESSAGE_NICK)
 					strcpy(color, "#AF7F00");
 				else
 					strcpy(color, "#062585");
@@ -4438,15 +4438,15 @@
 			else {
 				str = g_malloc(1024);
 
-				if (flags & WFLAG_AUTO)
+				if (flags & GAIM_MESSAGE_AUTO_RESP)
 					g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE);
 				else
 					g_snprintf(str, 1024, "%s:", who);
 
-				if (flags & WFLAG_NICK)
+				if (flags & GAIM_MESSAGE_NICK)
 					strcpy(color, "#AF7F00");
-				else if (flags & WFLAG_RECV) {
-					if (flags & WFLAG_COLORIZE) {
+				else if (flags & GAIM_MESSAGE_RECV) {
+					if (flags & GAIM_MESSAGE_COLORIZE) {
 						const char *u;
 						int m = 0;
 
@@ -4460,7 +4460,7 @@
 					else
 						strcpy(color, "#A82F2F");
 				}
-				else if (flags & WFLAG_SEND)
+				else if (flags & GAIM_MESSAGE_SEND)
 					strcpy(color, "#16569E");
 			}
 		}
--- a/src/gtkpounce.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/gtkpounce.c	Mon Aug 25 02:49:42 2003 +0000
@@ -859,7 +859,7 @@
 				conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
 
 			gaim_conversation_write(conv, NULL, message, -1,
-									WFLAG_SEND, time(NULL));
+									GAIM_MESSAGE_SEND, time(NULL));
 
 			serv_send_im(account->gc, (char *)pouncee, (char *)message, -1, 0);
 		}
--- a/src/gtkprefs.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/gtkprefs.c	Mon Aug 25 02:49:42 2003 +0000
@@ -1067,7 +1067,10 @@
 	GtkWidget *frame = data;
 	const char *proxy = value;
 
-	gtk_widget_set_sensitive(frame, strcmp(proxy, "none"));
+	if (strcmp(proxy, "none") && strcmp(proxy, "envvar"))
+		gtk_widget_set_sensitive(frame, TRUE);
+	else
+		gtk_widget_set_sensitive(frame, FALSE);
 }
 
 static void proxy_print_option(GtkEntry *entry, int entrynum)
@@ -1080,9 +1083,6 @@
 		gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry));
 	else if (entrynum == PROXYPASS)
 		gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry));
-
-	/* If the user specifies it, we want to save it. */
-	gaim_global_proxy_set_from_prefs(TRUE);
 }
 
 GtkWidget *proxy_page() {
@@ -1104,6 +1104,7 @@
 				   "SOCKS 4", "socks4",
 				   "SOCKS 5", "socks5",
 				   "HTTP", "http",
+				   _("Use Environmental Settings"), "envvar",
 				   NULL);
 
 	vbox = gaim_gtk_make_frame(ret, _("Proxy Server"));
@@ -1112,7 +1113,8 @@
 	proxy_info = gaim_global_proxy_get_info();
 
 	if (proxy_info == NULL ||
-		gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE) {
+		gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE ||
+		gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) {
 
 		gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE);
 	}
--- a/src/protocols/irc/cmds.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/irc/cmds.c	Mon Aug 25 02:49:42 2003 +0000
@@ -40,9 +40,9 @@
 
 	buf = g_strdup_printf(_("Unknown command: %s"), cmd);
 	if (gaim_conversation_get_type(convo) == GAIM_CONV_IM)
-		gaim_im_write(GAIM_IM(convo), "", buf, -1, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_im_write(GAIM_IM(convo), "", buf, -1, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	else
-		gaim_chat_write(GAIM_CHAT(convo), "", buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	g_free(buf);
 
 	return 1;
@@ -139,13 +139,13 @@
 							"PART PING QUERY QUIT<BR>"
 							"QUOTE REMOVE TOPIC UMODE<BR>"
 							"VOICE DEVOICE WALLOPS WHOIS<BR>"),
-				WFLAG_NOLOG, time(NULL));
+				GAIM_MESSAGE_NO_LOG, time(NULL));
 	} else {
 		gaim_im_write(GAIM_IM(convo), "", _("<B>Supported IRC Commands:</B><BR>"
 						    "AWAY JOIN ME MODE<BR>"
 						    "MSG NICK OPERWALL PING<BR>"
 						    "QUERY QUIT QUOTE UMODE<BR>"
-						    "WALLOPS WHOIS"), -1, WFLAG_NOLOG, time(NULL));
+						    "WALLOPS WHOIS"), -1, GAIM_MESSAGE_NO_LOG, time(NULL));
 	}
 
 	return 0;
@@ -413,7 +413,7 @@
 		gc = gaim_account_get_connection(irc->account);
 		irc_cmd_privmsg(irc, cmd, target, args);
 		gaim_im_write(GAIM_IM(convo), gaim_connection_get_display_name(gc),
-			      args[1], -1, WFLAG_SEND, time(NULL));
+			      args[1], -1, GAIM_MESSAGE_SEND, time(NULL));
 	}
 
 	return 0;
@@ -459,7 +459,7 @@
 			buf = g_strdup_printf(_("current topic is: %s"), topic);
 		else
 			buf = g_strdup(_("No topic is set"));
-		gaim_chat_write(GAIM_CHAT(convo), target, buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), target, buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 		g_free(buf);
 
 		return 0;
--- a/src/protocols/irc/msgs.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/irc/msgs.c	Mon Aug 25 02:49:42 2003 +0000
@@ -127,7 +127,7 @@
 		return;
 
 	buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], args[3] ? args[3] : "");
-	gaim_chat_write(GAIM_CHAT(convo), "", buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+	gaim_chat_write(GAIM_CHAT(convo), "", buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	g_free(buf);
 
 	return;
@@ -244,11 +244,11 @@
 		nick = irc_mask_nick(from);
 		msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick, topic);
 		g_free(nick);
-		gaim_chat_write(GAIM_CHAT(convo), from, msg, WFLAG_SYSTEM, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), from, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	} else {
 		msg = g_strdup_printf(_("The topic for %s is: %s"), chan, topic);
-		gaim_chat_write(GAIM_CHAT(convo), "", msg, WFLAG_SYSTEM, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	}
 }
@@ -287,9 +287,9 @@
 		if (irc->nameconv) {
 			msg = g_strdup_printf("Users on %s: %s", args[1], names);
 			if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT)
-				gaim_chat_write(GAIM_CHAT(convo), "", msg, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+				gaim_chat_write(GAIM_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 			else
-				gaim_im_write(GAIM_IM(convo), "", msg, -1, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+				gaim_im_write(GAIM_IM(convo), "", msg, -1, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 			g_free(msg);
 			g_free(irc->nameconv);
 			irc->nameconv = NULL;
@@ -367,10 +367,10 @@
 	if (convo) {
 		if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */
 			gaim_chat_write(GAIM_CHAT(convo), args[1], _("no such channel"),
-					WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+					GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 		else
 			gaim_im_write(GAIM_IM(convo), args[1], _("User is not logged in"), -1,
-				      WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+				      GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	} else {
 		if ((gc = gaim_account_get_connection(irc->account)) == NULL)
 			return;
@@ -390,7 +390,7 @@
 
 	convo = gaim_find_conversation_with_account(args[1], irc->account);
 	if (convo) {
-		gaim_chat_write(GAIM_CHAT(convo), args[1], args[2], WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	} else {
 		if ((gc = gaim_account_get_connection(irc->account)) == NULL)
 			return;
@@ -406,7 +406,7 @@
 	if (convo) {
 		/*g_slist_remove(irc->gc->buddy_chats, convo);
 		  gaim_conversation_set_account(convo, NULL);*/
-		gaim_chat_write(GAIM_CHAT(convo), args[1], args[2], WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	}
 }
 
@@ -421,7 +421,7 @@
 	if (!convo)
 		return;
 
-	gaim_chat_write(GAIM_CHAT(convo), "", args[2], WFLAG_SYSTEM, time(NULL));
+	gaim_chat_write(GAIM_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL));
 }
 
 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args)
@@ -548,7 +548,7 @@
 
 	if (!gaim_utf8_strcasecmp(gaim_connection_get_display_name(gc), args[1])) {
 		buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]);
-		gaim_chat_write(GAIM_CHAT(convo), args[0], buf, WFLAG_SYSTEM, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(buf);
 		/*g_slist_remove(irc->gc->buddy_chats, convo);
 		  gaim_conversation_set_account(convo, NULL);*/
@@ -577,7 +577,7 @@
 			return;
 		}
 		buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], args[2] ? args[2] : "", nick);
-		gaim_chat_write(GAIM_CHAT(convo), args[0], buf, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), args[0], buf, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 		g_free(buf);
 	} else {					/* User		*/
 	}
@@ -665,7 +665,7 @@
 	nick = irc_mask_nick(from);
 	if (!gaim_utf8_strcasecmp(nick, gaim_connection_get_display_name(gc))) {
 		msg = g_strdup_printf(_("You have parted the channel%s%s"), *args[1] ? ": " : "", args[1]);
-		gaim_chat_write(GAIM_CHAT(convo), args[0], msg, WFLAG_SYSTEM, time(NULL));
+		gaim_chat_write(GAIM_CHAT(convo), args[0], msg, GAIM_MESSAGE_SYSTEM, time(NULL));
 		g_free(msg);
 	} else {
 		gaim_chat_remove_user(GAIM_CHAT(convo), nick, args[1]);
@@ -711,9 +711,9 @@
 	g_strfreev(parts);
 	if (convo) {
 		if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT)
-			gaim_chat_write(GAIM_CHAT(convo), "PONG", msg, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+			gaim_chat_write(GAIM_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 		else
-			gaim_im_write(GAIM_IM(convo), "PONG", msg, -1, WFLAG_SYSTEM|WFLAG_NOLOG, time(NULL));
+			gaim_im_write(GAIM_IM(convo), "PONG", msg, -1, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL));
 	} else {
 		gc = gaim_account_get_connection(irc->account);
 		if (!gc) {
--- a/src/protocols/msn/switchboard.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Mon Aug 25 02:49:42 2003 +0000
@@ -131,7 +131,7 @@
 		}
 
 		if (*buf != '\0' && (conv = gaim_find_conversation(user)) != NULL) {
-			gaim_conversation_write(conv, NULL, buf, -1, WFLAG_SYSTEM,
+			gaim_conversation_write(conv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM,
 									time(NULL));
 		}
 
--- a/src/protocols/napster/napster.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/napster/napster.c	Mon Aug 25 02:49:42 2003 +0000
@@ -435,7 +435,7 @@
 		buf3 = g_strdup_printf("/me %s", buf2);
 		g_free(buf2);
 		if ((c = nap_find_chat(gc, res[0]))) {
-			gaim_chat_write(GAIM_CHAT(c), res[1], buf3, WFLAG_NICK, time(NULL));
+			gaim_chat_write(GAIM_CHAT(c), res[1], buf3, GAIM_MESSAGE_NICK, time(NULL));
 		}
 		g_free(buf3);
 		g_strfreev(res);
--- a/src/protocols/oscar/oscar.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Aug 25 02:49:42 2003 +0000
@@ -477,7 +477,7 @@
 		g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn);
 		
 	if ((cnv = gaim_find_conversation(sn)))
-		gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
+		gaim_conversation_write(cnv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 
 	gaim_conversation_update_progress(cnv, 0);
 
@@ -1912,7 +1912,7 @@
 	if (getpeername(source, &name, &name_len) == 0) {
 		g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
 		dim->connected = TRUE;
-		gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
+		gaim_conversation_write(cnv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 	}
 	od->direct_ims = g_slist_append(od->direct_ims, dim);
 	
@@ -5591,7 +5591,7 @@
 	dim->connected = TRUE;
 	g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn);
 	g_free(sn);
-	gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
+	gaim_conversation_write(cnv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 
 	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0);
 	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0);
--- a/src/protocols/yahoo/util.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/protocols/yahoo/util.c	Mon Aug 25 02:49:42 2003 +0000
@@ -128,7 +128,7 @@
 					continue;
 				else {
 					tmp = g_string_new_len(x + i + 2, j - i - 2);
-					if ((tmp->str[0] == '#'))
+					if (tmp->str[0] == '#')
 						g_string_append_printf(s, "<FONT COLOR=\"%s\">", tmp->str);
 					else if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
 						g_string_append(s, match);
--- a/src/proxy.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/proxy.c	Mon Aug 25 02:49:42 2003 +0000
@@ -29,6 +29,7 @@
 
 #include "internal.h"
 #include "debug.h"
+#include "notify.h"
 #include "prefs.h"
 #include "proxy.h"
 #include "util.h"
@@ -37,7 +38,6 @@
 #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
 
 static GaimProxyInfo *global_proxy_info = NULL;
-static gboolean global_proxy_info_from_prefs = FALSE;
 
 static int opt_debug = 0;
 
@@ -171,24 +171,12 @@
 /**************************************************************************
  * Global Proxy API
  **************************************************************************/
-void
-gaim_global_proxy_set_from_prefs(gboolean from_prefs)
-{
-	global_proxy_info_from_prefs = from_prefs;
-}
-
 GaimProxyInfo *
 gaim_global_proxy_get_info(void)
 {
 	return global_proxy_info;
 }
 
-gboolean
-gaim_global_proxy_is_from_prefs(void)
-{
-	return global_proxy_info_from_prefs;
-}
- 
 /**************************************************************************
  * Proxy API
  **************************************************************************/
@@ -844,6 +832,110 @@
 #define HTTP_GOODSTRING "HTTP/1.0 200"
 #define HTTP_GOODSTRING2 "HTTP/1.1 200"
 
+#if 0
+/* QQQ */
+static void
+http_uri_get_host(const char *uri)
+{
+	GaimProxyInfo *info;
+
+	char *c, *d;
+	char buffer[2048];
+
+	char host[128];
+	char user[128];
+	char pass[128];
+	int  port = 0;
+	int  len  = 0;
+
+	host[0] = '\0';
+	user[0] = '\0';
+	pass[0] = '\0';
+
+	gaim_debug(GAIM_DEBUG_MISC, "gaimrc",
+			   "gaimrc_parse_proxy_uri(%s)\n", proxy);
+
+	if ((c = strchr(proxy, ':')) == NULL)
+	{
+		gaim_debug(GAIM_DEBUG_ERROR, "gaimrc",
+				   "No URI detected.\n");
+		/* No URI detected. */
+		return FALSE;
+	}
+
+	len = c - proxy;
+
+	if (strncmp(proxy, "http://", len + 3))
+		return FALSE;
+
+	gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Found HTTP proxy.\n");
+	/* Get past "://" */
+	c += 3;
+
+	gaim_debug(GAIM_DEBUG_MISC, "gaimrc", "Looking at %s\n", c);
+
+	for (;;)
+	{
+		*buffer = '\0';
+		d = buffer;
+
+		while (*c != '\0' && *c != '@' && *c != ':' && *c != '/')
+			*d++ = *c++;
+
+		*d = '\0';
+
+		if (*c == ':')
+		{
+			/*
+			 * If there is a '@' in there somewhere, we are in the auth part.
+			 * If not, host.
+			 */
+			if (strchr(c, '@') != NULL)
+				strcpy(user, buffer);
+			else
+				strcpy(host, buffer);
+		}
+		else if (*c == '@')
+		{
+			if (user[0] == '\0')
+				strcpy(user, buffer);
+			else
+				strcpy(pass, buffer);
+		}
+		else if (*c == '/' || *c == '\0')
+		{
+			if (host[0] == '\0')
+				strcpy(host, buffer);
+			else
+				port = atoi(buffer);
+
+			/* Done. */
+			break;
+		}
+
+		c++;
+	}
+
+	/* NOTE: HTTP_PROXY takes precendence. */
+	info = gaim_global_proxy_get_info();
+
+	if (*host) gaim_proxy_info_set_host(info, host);
+	if (*user) gaim_proxy_info_set_username(info, user);
+	if (*pass) gaim_proxy_info_set_password(info, pass);
+
+	gaim_proxy_info_set_port(info, port);
+
+	gaim_debug(GAIM_DEBUG_MISC, "gaimrc",
+			   "Host: '%s', User: '%s', Password: '%s', Port: %d\n",
+			   gaim_proxy_info_get_host(info),
+			   gaim_proxy_info_get_username(info),
+			   gaim_proxy_info_get_password(info),
+			   gaim_proxy_info_get_port(info));
+
+	return TRUE;
+}
+#endif
+
 static void
 http_canread(gpointer data, gint source, GaimInputCondition cond)
 {
@@ -1505,6 +1597,10 @@
 				ret = proxy_connect_socks5(phb, addr, addrlen);
 				break;
 
+			case GAIM_PROXY_USE_ENVVAR:
+				ret = proxy_connect_http(phb, addr, addrlen);
+				break;
+
 			default:
 				break;
 		}
@@ -1532,6 +1628,7 @@
 	const char *connecthost = host;
 	int connectport = port;
 	struct PHB *phb;
+	const gchar *tmp;
 
 	g_return_val_if_fail(host != NULL, -1);
 	g_return_val_if_fail(port != 0 && port != -1, -1);
@@ -1550,12 +1647,40 @@
 	phb->port = port;
 	phb->account = account;
 
+	if (gaim_proxy_info_get_type(phb->gpi) == GAIM_PROXY_USE_ENVVAR) {
+		if ((tmp = g_getenv("HTTP_PROXY")) != NULL ||
+			(tmp = g_getenv("http_proxy")) != NULL ||
+			(tmp= g_getenv("HTTPPROXY")) != NULL) {
+			connecthost = tmp;
+			gaim_proxy_info_set_host(phb->gpi, connecthost);
+		}
+
+		if ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL ||
+			(tmp = g_getenv("http_proxy_port")) != NULL ||
+			(tmp = g_getenv("HTTPPROXYPORT")) != NULL) {
+			connectport = atoi(tmp);
+			gaim_proxy_info_set_port(phb->gpi, connectport);
+		}
+
+		if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL ||
+			(tmp = g_getenv("http_proxy_user")) != NULL ||
+			(tmp = g_getenv("HTTPPROXYUSER")) != NULL)
+			gaim_proxy_info_set_username(phb->gpi, tmp);
+
+		if ((tmp = g_getenv("HTTP_PROXY_PASS")) != NULL ||
+			(tmp = g_getenv("http_proxy_pass")) != NULL ||
+			(tmp = g_getenv("HTTPPROXYPASS")) != NULL)
+			gaim_proxy_info_set_password(phb->gpi, tmp);
+	}
+
 	if ((gaim_proxy_info_get_type(phb->gpi) != GAIM_PROXY_NONE) &&
 		(gaim_proxy_info_get_host(phb->gpi) == NULL ||
-		 gaim_proxy_info_get_port(phb->gpi) == 0 ||
-		 gaim_proxy_info_get_port(phb->gpi) == -1)) {
+		 gaim_proxy_info_get_port(phb->gpi) <= 0)) {
 
-		gaim_proxy_info_set_type(phb->gpi, GAIM_PROXY_NONE);
+		gaim_notify_error(NULL, NULL, _("Invalid proxy settings"), _("Either the host name or port number specified for your given proxy type is invalid."));
+		g_free(phb->host);
+		g_free(phb);
+		return -1;
 	}
 
 	switch (gaim_proxy_info_get_type(phb->gpi))
@@ -1566,6 +1691,7 @@
 		case GAIM_PROXY_HTTP:
 		case GAIM_PROXY_SOCKS4:
 		case GAIM_PROXY_SOCKS5:
+		case GAIM_PROXY_USE_ENVVAR:
 			connecthost = gaim_proxy_info_get_host(phb->gpi);
 			connectport = gaim_proxy_info_get_port(phb->gpi);
 			break;
@@ -1599,6 +1725,8 @@
 			proxytype = GAIM_PROXY_SOCKS4;
 		else if (!strcmp(type, "socks5"))
 			proxytype = GAIM_PROXY_SOCKS5;
+		else if (!strcmp(type, "envvar"))
+			proxytype = GAIM_PROXY_USE_ENVVAR;
 		else
 			proxytype = -1;
 
--- a/src/proxy.h	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/proxy.h	Mon Aug 25 02:49:42 2003 +0000
@@ -35,7 +35,8 @@
 	GAIM_PROXY_NONE = 0,         /**< No proxy.                         */
 	GAIM_PROXY_HTTP,             /**< HTTP proxy.                       */
 	GAIM_PROXY_SOCKS4,           /**< SOCKS 4 proxy.                    */
-	GAIM_PROXY_SOCKS5            /**< SOCKS 5 proxy.                    */
+	GAIM_PROXY_SOCKS5,           /**< SOCKS 5 proxy.                    */
+	GAIM_PROXY_USE_ENVVAR        /**< Use environmental settings.       */
 
 } GaimProxyType;
 
@@ -184,27 +185,12 @@
 /*@{*/
 
 /**
- * Sets whether or not the global proxy information is from preferences.
- *
- * @param from_prefs @c TRUE if the info is from preferences.
- */
-void gaim_global_proxy_set_from_prefs(gboolean from_prefs);
-
-/**
  * Returns gaim's global proxy information.
  *
  * @return The global proxy information.
  */
 GaimProxyInfo *gaim_global_proxy_get_info(void);
 
-/**
- * Returns whether or not the current global proxy information is from
- * preferences.
- *
- * @return @c TRUE if the info is from preferences.
- */
-gboolean gaim_global_proxy_is_from_prefs(void);
-
 /*@}*/
 
 /**************************************************************************/
--- a/src/server.c	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/server.c	Mon Aug 25 02:49:42 2003 +0000
@@ -258,7 +258,7 @@
 }
 
 int serv_send_im(GaimConnection *gc, const char *name, const char *message,
-				 int len, int flags)
+				 int len, int imflags)
 {
 	GaimConversation *c;
 	int val = -EINVAL;
@@ -270,9 +270,9 @@
 	c = gaim_find_conversation(name);
 
 	if (prpl_info && prpl_info->send_im)
-		val = prpl_info->send_im(gc, name, message, len, flags);
+		val = prpl_info->send_im(gc, name, message, len, imflags);
 
-	if (!(flags & IM_FLAG_AWAY))
+	if (!(imflags & IM_FLAG_AWAY))
 		serv_touch_idle(gc);
 
 	if (gc->away &&
@@ -799,7 +799,7 @@
 
 	while (templist) {
 		struct queued_message *qm = (struct queued_message *)templist->data;
-		if ((qm->flags & WFLAG_RECV) && !strcmp(name, qm->name))
+		if ((qm->flags & GAIM_MESSAGE_RECV) && !strcmp(name, qm->name))
 			i++;
 
 		templist = templist->next;
@@ -813,12 +813,12 @@
  * sure to follow along, kids
  */
 void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
-				 guint32 flags, time_t mtime, gint len)
+				 guint32 imflags, time_t mtime, gint len)
 {
 	char *buffy;
 	char *angel;
 	int plugin_return;
-	int away = 0;
+	GaimMessageFlags away = 0;
 
 	GaimConversation *cnv;
 
@@ -835,7 +835,7 @@
 	 * It's a start.
 	 */
 
-	if (flags & IM_FLAG_GAIMUSER)
+	if (imflags & IM_FLAG_GAIMUSER)
 		gaim_debug(GAIM_DEBUG_MISC, "server", "%s is a gaim user.\n", who);
 
 	/*
@@ -859,7 +859,7 @@
 		plugin_return = GPOINTER_TO_INT(
 			gaim_signal_emit_return_1(gaim_conversations_get_handle(),
 									  "received-im-msg", gc->account,
-									  &angel, &buffy, &flags));
+									  &angel, &buffy, &imflags));
 
 		if (!buffy || !angel || plugin_return) {
 			if (buffy)
@@ -891,10 +891,10 @@
 	 * Um. When we call gaim_conversation_write with the message we received,
 	 * it's nice to pass whether or not it was an auto-response. So if it
 	 * was an auto-response, we set the appropriate flag. This is just so
-	 * prpls don't have to know about WFLAG_* (though some do anyway)
+	 * prpls don't have to know about GAIM_MESSAGE_* (though some do anyway)
 	 */
-	if (flags & IM_FLAG_AWAY)
-		away = WFLAG_AUTO;
+	if (imflags & IM_FLAG_AWAY)
+		away = GAIM_MESSAGE_AUTO_RESP;
 
 	/*
 	 * Alright. Two cases for how to handle this. Either we're away or
@@ -936,7 +936,7 @@
 			qm->message = g_memdup(message, len == -1 ? strlen(message) + 1 : len);
 			qm->account = gc->account;
 			qm->tm = mtime;
-			qm->flags = WFLAG_RECV | away;
+			qm->flags = GAIM_MESSAGE_RECV | away;
 			qm->len = len;
 			message_queue = g_slist_append(message_queue, qm);
 
@@ -973,7 +973,7 @@
 				cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name);
 
 			gaim_im_write(GAIM_IM(cnv), NULL, message, len,
-						  away | WFLAG_RECV, mtime);
+						  away | GAIM_MESSAGE_RECV, mtime);
 		}
 
 		/*
@@ -1030,12 +1030,12 @@
 			qm->message = g_strdup(away_subs(tmpmsg, alias));
 			qm->account = gc->account;
 			qm->tm = mtime;
-			qm->flags = WFLAG_SEND | WFLAG_AUTO;
+			qm->flags = GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP;
 			qm->len = -1;
 			message_queue = g_slist_append(message_queue, qm);
 		} else if (cnv != NULL)
 			gaim_im_write(GAIM_IM(cnv), NULL, away_subs(tmpmsg, alias),
-						  len, WFLAG_SEND | WFLAG_AUTO, mtime);
+						  len, GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP, mtime);
 
 		g_free(tmpmsg);
 	} else {
@@ -1063,7 +1063,7 @@
 			qm->message = g_strdup(message);
 			qm->account = gc->account;
 			qm->tm = mtime;
-			qm->flags = away | WFLAG_RECV;
+			qm->flags = away | GAIM_MESSAGE_RECV;
 			qm->len = len;
 			unread_message_queue = g_slist_append(unread_message_queue, qm);
 		}
@@ -1072,7 +1072,7 @@
 				cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name);
 
 			gaim_im_write(GAIM_IM(cnv), NULL, message, len,
-						  away | WFLAG_RECV, mtime);
+						  away | GAIM_MESSAGE_RECV, mtime);
 			gaim_window_flash(gaim_conversation_get_window(cnv));
 		}
 	}
@@ -1113,7 +1113,7 @@
 		return;
 	}
 
-	c = gaim_find_conversation(b->name);
+	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 */
@@ -1154,7 +1154,7 @@
 					char *tmp = g_strdup_printf(_("%s logged in."),
 												gaim_get_buddy_alias(b));
 
-					gaim_conversation_write(c, NULL, tmp, -1, WFLAG_SYSTEM,
+					gaim_conversation_write(c, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM,
 											time(NULL));
 					g_free(tmp);
 				}
@@ -1165,7 +1165,7 @@
 												  gaim_get_buddy_alias(b));
 					qm->account = gc->account;
 					qm->tm = time(NULL);
-					qm->flags = WFLAG_SYSTEM;
+					qm->flags = GAIM_MESSAGE_SYSTEM;
 					qm->len = -1;
 					message_queue = g_slist_append(message_queue, qm);
 				}
@@ -1183,7 +1183,7 @@
 					char *tmp = g_strdup_printf(_("%s logged out."),
 												gaim_get_buddy_alias(b));
 					gaim_conversation_write(c, NULL, tmp, -1,
-											WFLAG_SYSTEM, time(NULL));
+											GAIM_MESSAGE_SYSTEM, time(NULL));
 					g_free(tmp);
 				} else if (awayqueue && find_queue_total_by_name(b->name)) {
 					struct queued_message *qm = g_new0(struct queued_message, 1);
@@ -1192,7 +1192,7 @@
 												  gaim_get_buddy_alias(b));
 					qm->account = gc->account;
 					qm->tm = time(NULL);
-					qm->flags = WFLAG_SYSTEM;
+					qm->flags = GAIM_MESSAGE_SYSTEM;
 					qm->len = -1;
 					message_queue = g_slist_append(message_queue, qm);
 				}
@@ -1437,7 +1437,7 @@
 void serv_got_chat_in(GaimConnection *g, int id, const char *who,
 					  int whisper, const char *message, time_t mtime)
 {
-	int w;
+	GaimMessageFlags w;
 	GSList *bcs;
 	GaimConversation *conv = NULL;
 	GaimChat *chat = NULL;
@@ -1495,7 +1495,7 @@
 		buf = g_strdup(message);
 
 	if (whisper)
-		w = WFLAG_WHISPER;
+		w = GAIM_MESSAGE_WHISPER;
 	else
 		w = 0;
 
--- a/src/server.h	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/server.h	Mon Aug 25 02:49:42 2003 +0000
@@ -23,16 +23,6 @@
 #ifndef _GAIM_SERVER_H_
 #define _GAIM_SERVER_H_
 
-#define WFLAG_SEND	0x01
-#define WFLAG_RECV	0x02
-#define WFLAG_AUTO	0x04
-#define WFLAG_WHISPER	0x08
-#define WFLAG_FILERECV	0x10
-#define WFLAG_SYSTEM	0x20
-#define WFLAG_NICK	0x40
-#define WFLAG_NOLOG	0x80
-#define WFLAG_COLORIZE  0x100
-
 #define IM_FLAG_AWAY     0x01
 #define IM_FLAG_CHECKBOX 0x02
 #define IM_FLAG_GAIMUSER 0x04
--- a/src/ui.h	Mon Aug 25 00:39:39 2003 +0000
+++ b/src/ui.h	Mon Aug 25 02:49:42 2003 +0000
@@ -83,7 +83,7 @@
 	char *message;
 	time_t tm;
 	GaimAccount *account;
-	int flags;
+	GaimMessageFlags flags;
 	int len;
 };