changeset 5872:059d95c67cda

[gaim-migrate @ 6304] The legendary Header File Cleanup! Files now only include what they need. This should reduce the number of files that must recompile when a header file changes. It's a lot nicer. Trust me on it. I also added a couple new header files. I hope I didn't break TOO much! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 14 Jun 2003 23:21:02 +0000
parents 508adf90fbb9
children a18e88c4dace
files plugins/autorecon.c plugins/docklet/docklet.c plugins/gaim-remote/Makefile.am plugins/gaim-remote/remote-socket.c plugins/gaim-remote/remote.c plugins/gaim-remote/remote.h plugins/gestures/gestures.c plugins/history.c plugins/iconaway.c plugins/idle.c plugins/perl/perl.c plugins/spellchk.c plugins/statenotify.c plugins/ticker/ticker.c plugins/timestamp.c src/about.c src/account.c src/account.h src/away.c src/blist.c src/browser.c src/buddy_chat.c src/connection.c src/connection.h src/conversation.c src/conversation.h src/core.c src/core.h src/dialogs.c src/ft.c src/ft.h src/gaim-remote.c src/gaim.h src/gaimrc.c src/gtkaccount.c src/gtkblist.h src/gtkconn.c src/gtkconv.c src/gtkconv.h src/gtkdebug.c src/gtkdebug.h src/gtkft.c src/gtkft.h src/gtknotify.c src/gtkpounce.c src/gtkprefs.c src/gtkrequest.c src/gtksound.c src/gtkutils.c src/gtkutils.h src/html.c src/idle.c src/internal.h src/log.c src/log.h src/main.c src/multi.h src/plugin.c src/pounce.c src/privacy.h src/protocols/gg/gg.c src/protocols/gg/libgg.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/msn/msn.h src/protocols/msn/switchboard.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/ZVariables.c src/protocols/zephyr/zephyr.c src/proxy.c src/proxy.h src/prpl.c src/prpl.h src/server.c src/server.h src/session.c src/sound.c src/stock.c src/themes.c src/ui.h src/util.c src/util.h
diffstat 87 files changed, 1318 insertions(+), 1519 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/autorecon.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/autorecon.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,11 +1,10 @@
-#include "config.h"
+#include "internal.h"
+
+#include "connection.h"
+#include "debug.h"
+#include "prpl.h"
 
 #include "gaim.h"
-#include "prpl.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 #define AUTORECON_PLUGIN_ID "core-autorecon"
 
--- a/plugins/docklet/docklet.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/docklet/docklet.c	Sat Jun 14 23:21:02 2003 +0000
@@ -27,16 +27,26 @@
     - optional pop up notices when GNOME2's system-tray-applet supports it */
 
 /* includes */
-#include <gtk/gtk.h>
-#include "gtkplugin.h"
-#include "gtkaccount.h"
-#include "gaim.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "prefs.h"
 #include "sound.h"
+
+#include "gtkaccount.h"
+#include "gtkblist.h"
+#include "gtkft.h"
+#include "gtkplugin.h"
+#include "gtkprefs.h"
 #include "gtksound.h"
-#include "prefs.h"
-#include "gtkblist.h"
+#include "gtkutils.h"
+#include "stock.h"
+
 #include "eggtrayicon.h"
 
+#include "gaim.h"
+#include "ui.h"
+
 #define DOCKLET_PLUGIN_ID "gtk-docklet"
 
 /* types */
--- a/plugins/gaim-remote/Makefile.am	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/gaim-remote/Makefile.am	Sat Jun 14 23:21:02 2003 +0000
@@ -15,6 +15,7 @@
 
 INCLUDES = \
 	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/plugins \
 	-DVERSION=\"$(VERSION)\" \
 	-DDATADIR=\"$(datadir)\" \
 	$(DEBUG_CFLAGS)
--- a/plugins/gaim-remote/remote-socket.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/gaim-remote/remote-socket.c	Sat Jun 14 23:21:02 2003 +0000
@@ -28,12 +28,9 @@
 /* This provides code for connecting to a Gaim socket and communicating with
  * it.  It will eventually be made a library once the core and ui are split. */
 
-#include <sys/types.h>
-#include <sys/socket.h>
+#include "internal.h"
 #include <sys/un.h>
-#include <unistd.h>
-#include "gaim.h"
-#include "remote-socket.h"
+#include <gaim-remote/remote.h>
 
 void
 gaim_remote_session_send_packet(int fd, GaimRemotePacket *p)
--- a/plugins/gaim-remote/remote.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/gaim-remote/remote.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,34 +18,29 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
+ *
+ * @todo Make this a core plugin!
  */
-#include "config.h"
-
-#include "gaim.h"
+#include "internal.h"
 
-#ifdef _WIN32
-#include <winsock.h>
-#include <io.h>
-#else
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
+#ifndef _WIN32
+# include <sys/un.h>
 #endif
 
-#include <sys/stat.h>
-#include <errno.h>
 #include <signal.h>
 #include <getopt.h>
-#include <stdarg.h>
-#include <string.h>
 
+#include "conversation.h"
+#include "debug.h"
+#include "prpl.h"
+
+/* XXX */
+#include "gtkconv.h"
+#include "gtkplugin.h"
 #include "gaim.h"
-#include "remote-socket.h"
+#include "ui.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
-
+#include <gaim-remote/remote.h>
 
 #define REMOTE_PLUGIN_ID "core-remote"
 
@@ -57,8 +52,148 @@
 #ifndef _WIN32
 static gint UI_fd = -1;
 #endif
-int gaim_session = 0;
-GSList *uis = NULL;
+static int gaim_session = 0;
+static GSList *uis = NULL;
+
+/* AIM URI's ARE FUN :-D */
+const char *
+gaim_remote_handle_uri(const char *uri)
+{
+	const char *username;
+	GString *str;
+	GList *conn;
+	GaimConnection *gc = NULL;
+	GaimAccount *account;
+
+	gaim_debug(GAIM_DEBUG_INFO, "gaim_remote_handle_uri", "Handling URI: %s\n", uri);
+
+	/* Well, we'd better check to make sure we have at least one
+	   AIM account connected. */
+	for (conn = gaim_connections_get_all(); conn != NULL; conn = conn->next) {
+		gc = conn->data;
+		account = gaim_connection_get_account(gc);
+		username = gaim_account_get_username(account);
+
+		if (gaim_account_get_protocol(account) == GAIM_PROTO_OSCAR &&
+			username != NULL && isalpha(*username)) {
+
+			break;
+		}
+	}
+
+	if (gc == NULL)
+		return _("Not connected to AIM");
+
+ 	/* aim:goim?screenname=screenname&message=message */
+	if (!g_ascii_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) {
+		char *who, *what;
+		GaimConversation *c;
+		uri = uri + strlen("aim:goim?");
+		
+		if (!(who = strstr(uri, "screenname="))) {
+			return _("No screenname given.");
+		}
+		/* spaces are encoded as +'s */
+		who = who + strlen("screenname=");
+		str = g_string_new(NULL);
+		while (*who && (*who != '&')) {
+			g_string_append_c(str, *who == '+' ? ' ' : *who);
+			who++;
+		}
+		who = g_strdup(str->str);
+		g_string_free(str, TRUE);
+		
+		what = strstr(uri, "message=");
+		if (what) {
+			what = what + strlen("message=");
+			str = g_string_new(NULL);
+			while (*what && (*what != '&' || !g_ascii_strncasecmp(what, "&amp;", 5))) {
+				g_string_append_c(str, *what == '+' ? ' ' : *what);
+				what++;
+			}
+			what = g_strdup(str->str);
+			g_string_free(str, TRUE);
+		}
+
+		c = gaim_conversation_new(GAIM_CONV_IM, gc->account, who);
+		g_free(who);
+
+		if (what) {
+			GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(c);
+
+			gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, what, -1);
+			g_free(what);
+		}
+	} else if (!g_ascii_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) {
+		char *who, *group;
+		uri = uri + strlen("aim:addbuddy?");
+		/* spaces are encoded as +'s */
+
+		if (!(who = strstr(uri, "screenname="))) {
+			return _("No screenname given.");
+		}
+		who = who + strlen("screenname=");
+		str = g_string_new(NULL);
+		while (*who && (*who != '&')) {
+			g_string_append_c(str, *who == '+' ? ' ' : *who);
+			who++;
+		}
+		who = g_strdup(str->str);
+		g_string_free(str, TRUE);
+
+		group = strstr(uri, "group=");
+		if (group) {
+			group = group + strlen("group=");
+			str = g_string_new(NULL);
+			while (*group && (*group != '&' || !g_ascii_strncasecmp(group, "&amp;", 5))) {
+				g_string_append_c(str, *group == '+' ? ' ' : *group);
+				group++;
+			}
+			group = g_strdup(str->str);
+			g_string_free(str, TRUE);
+		}
+
+		gaim_debug(GAIM_DEBUG_MISC, "gaim_remote_handle_uri", "who: %s\n", who);
+		show_add_buddy(gc, who, group, NULL);
+		g_free(who);
+		if (group)
+			g_free(group);
+	} else if (!g_ascii_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) {
+		char *room;
+		GHashTable *components;
+		int exch = 5;
+		
+		uri = uri + strlen("aim:gochat?");
+		/* spaces are encoded as +'s */
+		
+		if (!(room = strstr(uri, "roomname="))) {
+			return _("No roomname given.");
+		}
+		room = room + strlen("roomname=");
+		str = g_string_new(NULL);
+		while (*room && (*room != '&')) {
+			g_string_append_c(str, *room == '+' ? ' ' : *room);
+			room++;
+		}
+		room = g_strdup(str->str);
+		g_string_free(str, TRUE);
+		components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+				g_free);
+		g_hash_table_replace(components, g_strdup("room"), room);
+		g_hash_table_replace(components, g_strdup("exchange"),
+				g_strdup_printf("%d", exch));
+
+		serv_join_chat(gc, components);
+		g_hash_table_destroy(components);
+	} else {
+		return _("Invalid AIM URI");
+	}
+	
+	
+	return NULL;
+}
+
+
 
 #if 0
 static guchar *
@@ -345,7 +480,7 @@
 		send = g_malloc(len + 1);
 		memcpy(send, data, len);
 		send[len] = 0;
-		resp = handle_uri(send);
+		resp = gaim_remote_handle_uri(send);
 		g_free(send);
 		/* report error */
 		break;
@@ -585,7 +720,7 @@
 {
 	2,                                                /**< api_version    */
 	GAIM_PLUGIN_STANDARD,                             /**< type           */
-	NULL,                                             /**< ui_requirement */
+	GAIM_GTK_PLUGIN_TYPE,                             /**< ui_requirement */
 	0,                                                /**< flags          */
 	NULL,                                             /**< dependencies   */
 	GAIM_PRIORITY_DEFAULT,                            /**< priority       */
--- a/plugins/gaim-remote/remote.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/gaim-remote/remote.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,4 +24,79 @@
 
 #include <gaim-remote/remote-socket.h>
 
+
+/* this is the basis of the CUI protocol. */
+#define CUI_TYPE_META		1
+#define CUI_TYPE_PLUGIN		2
+#define CUI_TYPE_USER		3
+#define CUI_TYPE_CONN		4
+#define CUI_TYPE_BUDDY		5	/* BUDDY_LIST, i.e., both groups and buddies */
+#define CUI_TYPE_MESSAGE	6
+#define CUI_TYPE_CHAT		7
+#define CUI_TYPE_REMOTE         8       
+					/* This is used to send commands to other UI's, 
+					 * like "Open new conversation" or "send IM".
+					 * Even though there's much redundancy with the
+					 * other CUI_TYPES, we're better keeping this stuff
+					 * seperate because it's intended use is so different */
+
+#define CUI_META_LIST		1	
+					/* 1 is always list; this is ignored by the core.
+					   If we move to TCP this can be a keepalive */
+#define CUI_META_QUIT		2
+#define CUI_META_DETACH		3	
+					/* you don't need to send this, you can just close
+					   the socket. the core will understand. */
+#define CUI_META_PING           4
+#define CUI_META_ACK            5
+
+#define CUI_PLUGIN_LIST		1
+#define CUI_PLUGIN_LOAD		2
+#define CUI_PLUGIN_UNLOAD	3
+
+#define CUI_USER_LIST		1
+#define CUI_USER_ADD		2
+#define CUI_USER_REMOVE		3
+#define CUI_USER_MODIFY		4	/* this handles moving them in the list too */
+#define CUI_USER_SIGNON		5
+
+#define CUI_CONN_LIST		1
+#define CUI_CONN_PROGRESS	2
+#define CUI_CONN_ONLINE		3
+#define CUI_CONN_OFFLINE	4	/* this may send a "reason" for why it was killed */
+
+#define CUI_BUDDY_LIST		1
+#define CUI_BUDDY_STATE		2	
+					/* notifies the UI of state changes; UI can use it to
+					   request the current status from the core */
+#define CUI_BUDDY_ADD		3
+#define CUI_BUDDY_REMOVE	4
+#define CUI_BUDDY_MODIFY	5
+
+#define CUI_MESSAGE_LIST	1	/* no idea */
+#define CUI_MESSAGE_SEND	2
+#define CUI_MESSAGE_RECV	3
+
+#define CUI_CHAT_LIST		1
+#define CUI_CHAT_HISTORY	2	/* is this necessary? should we have one for IMs? */
+#define CUI_CHAT_JOIN		3	/* handles other people joining/parting too */
+#define CUI_CHAT_PART		4
+#define CUI_CHAT_SEND		5
+#define CUI_CHAT_RECV		6
+
+#define CUI_REMOTE_CONNECTIONS  2       /* Get a list of gaim_connections */
+#define CUI_REMOTE_URI          3       /* Have the core handle aim:// URI's */
+#define CUI_REMOTE_BLIST        4       /* Return a copy of the buddy list */
+#define CUI_REMOTE_STATE        5       /* Given a buddy, return his presence. */
+#define CUI_REMOTE_NEW_CONVO    6       /* Must give a user, can give an optional message */
+#define CUI_REMOTE_SEND         7       /* Sends a message, a 'quiet' flag determines whether
+					 * a convo window is displayed or not. */
+#define CUI_REMOTE_ADD_BUDDY    8       /* Adds buddy to list */
+#define CUI_REMOTE_REMOVE_BUDDY 9       /* Removes buddy from list */
+#define CUI_REMOTE_JOIN_CHAT    10       /* Joins a chat. */
+                              /* What else?? */
+
+
+const char *gaim_remote_handle_uri(const char *uri);
+
 #endif /* _GAIM_REMOTE_H_ */
--- a/plugins/gestures/gestures.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/gestures/gestures.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,13 +18,18 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-#include "config.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "prefs.h"
+
+#include "gtkconv.h"
+#include "gtkplugin.h"
+#include "gtkutils.h"
 
 #include "gaim.h"
-#include "prefs.h"
+
 #include "gstroke.h"
-#include "gtkconv.h"
-#include "gtkplugin.h"
 
 #define GESTURES_PLUGIN_ID "gtk-gestures"
 
--- a/plugins/history.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/history.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,15 +1,18 @@
 /* Puts last 4k of log in new conversations a la Everybuddy (and then
  * stolen by Trillian "Pro") */
 
-#include "config.h"
+#include "internal.h"
+
+#include "conversation.h"
+#include "debug.h"
+#include "prefs.h"
+#include "util.h"
+
+#include "gtkconv.h"
+#include "gtkimhtml.h"
+#include "gtkplugin.h"
 
 #include "gaim.h"
-#include "prefs.h"
-#include "gtkimhtml.h"
-#include "gtkplugin.h"
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
 
 #define HISTORY_PLUGIN_ID "core-history"
 
--- a/plugins/iconaway.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/iconaway.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,11 +1,11 @@
-#include "config.h"
+#include "internal.h"
+
+#include "conversation.h"
+
+#include "gtkconv.h"
+#include "gtkplugin.h"
 
 #include "gaim.h"
-#include "gtkplugin.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 #define ICONAWAY_PLUGIN_ID "gtk-iconaway"
 
--- a/plugins/idle.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/idle.c	Sat Jun 14 23:21:02 2003 +0000
@@ -3,12 +3,16 @@
  * 40-day idle times.
  */
 
-#include "config.h"
+#include "internal.h"
+
+#include "connection.h"
+#include "debug.h"
+#include "server.h"
+
+#include "gtkplugin.h"
+#include "gtkutils.h"
 
 #include "gaim.h"
-#include "multi.h"
-#include "gtkplugin.h"
-#include <sys/time.h>
 
 #define IDLE_PLUGIN_ID "gtk-idle"
 
--- a/plugins/perl/perl.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/perl/perl.c	Sat Jun 14 23:21:02 2003 +0000
@@ -23,43 +23,42 @@
  * X-Chat Copyright (C) 1998 Peter Zelezny.
  *
  */
+#ifdef DEBUG
+# undef DEBUG
+#endif
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#ifdef DEBUG
-#undef DEBUG
-#endif
-#endif
 #undef PACKAGE
 
 #define group perl_group
+
 #ifdef _WIN32
 /* This took me an age to figure out.. without this __declspec(dllimport)
  * will be ignored.
  */
-#define HASATTRIBUTE
+# define HASATTRIBUTE
 #endif
+
 #include <EXTERN.h>
+
 #ifndef _SEM_SEMUN_UNDEFINED
-#define HAS_UNION_SEMUN
+# define HAS_UNION_SEMUN
 #endif
+
 #include <perl.h>
 #include <XSUB.h>
+
 #ifndef _WIN32
-#include <sys/mman.h>
+# include <sys/mman.h>
 #endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+
 #undef PACKAGE
-#include <stdio.h>
+
 #ifndef _WIN32
-#include <dirent.h>
+# include <dirent.h>
 #else
-/* We're using perl's win32 port of this */
-#define dirent direct
+ /* We're using perl's win32 port of this */
+# define dirent direct
 #endif
-#include <string.h>
 
 #undef group
 
@@ -72,14 +71,22 @@
 
 #undef _
 #ifdef DEBUG
-#undef DEBUG
+# undef DEBUG
 #endif
 #ifdef _WIN32
-#undef pipe
+# undef pipe
 #endif
+
+#include "internal.h"
+
+#include "debug.h"
+#include "prpl.h"
+#include "notify.h"
+#include "server.h"
+#include "sound.h"
+
 #include "gaim.h"
-#include "prpl.h"
-#include "sound.h"
+#include "ui.h"
 
 #ifndef call_pv
 # define call_pv(i,j) perl_call_pv((i), (j))
@@ -1395,11 +1402,11 @@
 };
 
 static void
-__init_plugin(GaimPlugin *plugin)
+init_plugin(GaimPlugin *plugin)
 {
 	my_plugin = plugin;
 
 	loader_info.exts = g_list_append(loader_info.exts, "pl");
 }
 
-GAIM_INIT_PLUGIN(perl, __init_plugin, info);
+GAIM_INIT_PLUGIN(perl, init_plugin, info);
--- a/plugins/spellchk.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/spellchk.c	Sat Jun 14 23:21:02 2003 +0000
@@ -8,21 +8,15 @@
  * BUGS:
  *	? I think i fixed them all.
  */
-#include "config.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "util.h"
+
+#include "gtkplugin.h"
+#include "gtkutils.h"
 
 #include "gaim.h"
-#include "gtkplugin.h"
-
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 #define SPELLCHECK_PLUGIN_ID "gtk-spellcheck"
 
--- a/plugins/statenotify.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/statenotify.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,3 +1,9 @@
+#include "internal.h"
+
+#include "blist.h"
+#include "conversation.h"
+#include "debug.h"
+
 #include "gaim.h"
 
 static void
--- a/plugins/ticker/ticker.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/ticker/ticker.c	Sat Jun 14 23:21:02 2003 +0000
@@ -21,20 +21,19 @@
  * ticker.c -- Syd Logan, Summer 2000
  * pluginized- Sean Egan, Summer 2002
  */
-
+#include "internal.h"
 
-#include <gtk/gtk.h>
-#include "gtkticker.h"
-#include <string.h>
-#include <stdlib.h>
+#include "blist.h"
+#include "conversation.h"
+#include "debug.h"
+#include "prpl.h"
+
+#include "gtkblist.h"
+#include "gtkplugin.h"
+
 #include "gaim.h"
-#include "prpl.h"
-#include "gtkplugin.h"
-#include "blist.h"
-#include "gtkblist.h"
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+
+#include "gtkticker.h"
 
 #define TICKER_PLUGIN_ID "gtk-ticker"
 
--- a/plugins/timestamp.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/plugins/timestamp.c	Sat Jun 14 23:21:02 2003 +0000
@@ -3,12 +3,16 @@
  * Modified by: Chris J. Friesen <Darth_Sebulba04@yahoo.com> Jan 05, 2003.
  * <INSERT GPL HERE> */
 
-#include "config.h"
+#include "internal.h"
 
-#include <time.h>
-#include "gaim.h"
+#include "conversation.h"
+#include "debug.h"
+
 #include "gtkimhtml.h"
 #include "gtkplugin.h"
+#include "gtkutils.h"
+
+#include "gaim.h"
 
 #define TIMESTAMP_PLUGIN_ID "gtk-timestamp"
 
--- a/src/about.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/about.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,17 +19,14 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
+#include "internal.h"
+#include "gtkimhtml.h"
+#include "gtkutils.h"
+#include "stock.h"
+#include "ui.h"
 
-#include <gtk/gtk.h>
+/* XXX For WEBSITE */
 #include "gaim.h"
-#include "gtkimhtml.h"
 
 static GtkWidget *about = NULL;
 
@@ -40,21 +37,6 @@
 	about = NULL;
 }
 
-char *name()
-{
-	return PACKAGE;
-}
-
-char *description()
-{
-	return WEBSITE;
-}
-
-char *version()
-{
-	return VERSION;
-}
-
 void show_about(GtkWidget *w, void *data)
 {
 	GtkWidget *vbox;
--- a/src/account.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/account.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,23 +20,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <glib.h>
-
+#include "internal.h"
 #include "account.h"
 #include "debug.h"
 #include "prefs.h"
 #include "prpl.h"
+#include "server.h"
 #include "util.h"
-#include "gaim.h"
 
 typedef enum
 {
--- a/src/account.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/account.h	Sat Jun 14 23:21:02 2003 +0000
@@ -29,6 +29,14 @@
 #include "proxy.h"
 #include "prpl.h"
 
+enum
+{
+	PERMIT_ALL  = 1,
+	PERMIT_NONE,
+	PERMIT_SOME,
+	DENY_SOME
+};
+
 struct _GaimAccount
 {
 	char *username;             /**< The username.               */
--- a/src/away.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/away.c	Sat Jun 14 23:21:02 2003 +0000
@@ -16,24 +16,25 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-  *
+ *
  */
+#include "internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <gtk/gtk.h>
-#include "gaim.h"
-#include "prpl.h"
-#include "gtkimhtml.h"
-#include "gtkblist.h"
+#include "conversation.h"
+#include "debug.h"
 #include "plugin.h"
 #include "prefs.h"
+#include "prpl.h"
+#include "util.h"
+
+/* XXX Until we can get rid of the message queue stuff... */
+#include "gaim.h"
+
+#include "gtkblist.h"
+#include "gtkimhtml.h"
+#include "gtkprefs.h"
+#include "gtkutils.h"
+#include "ui.h"
 
 GtkWidget *imaway = NULL;
 
--- a/src/blist.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/blist.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,29 +19,16 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <direct.h>
-#endif
-#include <ctype.h>
-#include "gaim.h"
-#include "prpl.h"
+#include "internal.h"
 #include "blist.h"
+#include "conversation.h"
+#include "debug.h"
 #include "notify.h"
 #include "prefs.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "privacy.h"
+#include "prpl.h"
+#include "server.h"
+#include "util.h"
 
 #define PATHSIZE 1024
 
--- a/src/browser.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/browser.c	Sat Jun 14 23:21:02 2003 +0000
@@ -25,42 +25,19 @@
  * their protocol.  Nifty.
  *
  */
-
+#include "internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#ifdef _WIN32
-#include <gdk/gdkwin32.h>
-#else
-#include <unistd.h>
-#ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 255
-#endif
-#include <gdk/gdkx.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <gdk/gdkprivate.h>
 
-
-
-
-#include <gtk/gtk.h>
-#include <gdk/gdkprivate.h>
-#include "gaim.h"
+#include "debug.h"
 #include "notify.h"
 #include "prefs.h"
+#include "util.h"
 
 #ifndef _WIN32
-
-
-
-
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 
-
 static const char *progname = "gaim";
 static const char *expected_mozilla_version = "1.1";
 
--- a/src/buddy_chat.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/buddy_chat.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,26 +18,20 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
+#include "debug.h"
+#include "multi.h"
+#include "notify.h"
+#include "prpl.h"
+#include "server.h"
+
 #include "gtkimhtml.h"
-
-#include "prpl.h"
-#include "notify.h"
-#include "gaim.h"
-#include "multi.h"
+#include "gtkutils.h"
+#include "ui.h"
 
 #ifdef _WIN32
-#include "wspell.h"
+# include "wspell.h"
 #endif
 
 static GList *chatentries = NULL;
--- a/src/connection.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/connection.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,15 +20,25 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
+#include "internal.h"
+#include "blist.h"
 #include "connection.h"
 #include "debug.h"
-#include "gaim.h"
+#include "log.h"
+#include "notify.h"
+#include "prefs.h"
+#include "request.h"
+#include "server.h"
+#include "sound.h"
+
+/* XXX UI stuff! */
+#include "ui.h"
 
 static GList *connections = NULL;
 static GList *connections_connecting = NULL;
 static GaimConnectionUiOps *connection_ui_ops = NULL;
 
+
 GaimConnection *
 gaim_connection_new(GaimAccount *account)
 {
@@ -144,6 +154,7 @@
 		gaim_request_close_with_handle(gc);
 		gaim_notify_close_with_handle(gc);
 
+		/* XXX UI stuff! */
 		update_privacy_connections();
 	}
 
@@ -153,10 +164,11 @@
 	if (connections != NULL)
 		return;
 
-	destroy_all_dialogs();
+	/* XXX destroy_all_dialogs(); */
+
 	gaim_blist_destroy();
 
-	show_login();
+	/* XXX show_login(); */
 }
 
 /*
@@ -196,7 +208,7 @@
 		gaim_blist_show();
 		gaim_blist_add_account(gc->account);
 
-		/* I hate this. -- ChipX86 */
+		/* XXX I hate this. UI code. -- ChipX86 */
 		gaim_setup(gc);
 
 		/*
--- a/src/connection.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/connection.h	Sat Jun 14 23:21:02 2003 +0000
@@ -31,6 +31,10 @@
 #include "account.h"
 #include "plugin.h"
 
+#define OPT_CONN_HTML		0x00000001
+/* set this flag on a gc if you want serv_got_im to autoreply when away */
+#define OPT_CONN_AUTO_RESP	0x00000002
+
 typedef enum
 {
 	GAIM_DISCONNECTED = 0, /**< Disconnected. */
--- a/src/conversation.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/conversation.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,26 +18,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <ctype.h>
+#include "internal.h"
+#include "blist.h"
 #include "conversation.h"
-#include "gaim.h"
-#include "multi.h"
-#include "prpl.h"
+#include "debug.h"
 #include "notify.h"
 #include "prefs.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "prpl.h"
+#include "util.h"
+
+/* XXX */
+#include "ui.h"
 
 typedef struct
 {
@@ -148,7 +139,7 @@
 
 	im = GAIM_IM(c);
 
-	gaim_im_set_typing_state(im, NOT_TYPING);
+	gaim_im_set_typing_state(im, GAIM_NOT_TYPING);
 	gaim_im_update_typing(im);
 	gaim_im_stop_typing_timeout(im);
 
@@ -169,7 +160,7 @@
 		gaim_im_set_type_again(GAIM_IM(conv), TRUE);
 
 		/* XXX Somebody add const stuff! */
-		serv_send_typing(gc, (char *)name, TYPED);
+		serv_send_typing(gc, (char *)name, GAIM_TYPED);
 
 		gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n");
 	}
@@ -962,7 +953,7 @@
 
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 			if (gaim_prefs_get_bool("/core/conversations/im/send_typing"))
-				serv_send_typing(gc, (char *)name, NOT_TYPING);
+				serv_send_typing(gc, (char *)name, GAIM_NOT_TYPING);
 
 			if (gc && prpl_info->convo_closed != NULL)
 				prpl_info->convo_closed(gc, (char *)name);
@@ -1483,7 +1474,7 @@
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 		if ((flags & WFLAG_RECV) == WFLAG_RECV)
-			gaim_im_set_typing_state(GAIM_IM(conv), NOT_TYPING);
+			gaim_im_set_typing_state(GAIM_IM(conv), GAIM_NOT_TYPING);
 	}
 
 	if (gaim_window_get_active_conversation(win) != conv) {
--- a/src/conversation.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/conversation.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,8 +24,6 @@
 #ifndef _GAIM_CONVERSATION_H_
 #define _GAIM_CONVERSATION_H_
 
-#include "account.h"
-
 /**************************************************************************/
 /** Data Structures                                                       */
 /**************************************************************************/
@@ -33,6 +31,7 @@
 typedef enum   _GaimConversationType  GaimConversationType;
 typedef enum   _GaimUnseenState       GaimUnseenState;
 typedef enum   _GaimConvUpdateType    GaimConvUpdateType;
+typedef enum   _GaimTypingState       GaimTypingState;
 typedef struct _GaimWindowUiOps       GaimWindowUiOps;
 typedef struct _GaimWindow            GaimWindow;
 typedef struct _GaimConversationUiOps GaimConversationUiOps;
@@ -87,6 +86,21 @@
 };
 
 /**
+ * The typing state of a user.
+ */
+enum _GaimTypingState
+{
+	GAIM_NOT_TYPING = 0,  /**< Not typing.                 */
+	GAIM_TYPING,          /**< Currently typing.           */
+	GAIM_TYPED            /**< Stopped typing momentarily. */
+};
+
+
+#include "account.h"
+#include "server.h"
+
+
+/**
  * Conversation window operations.
  *
  * Any UI representing a window must assign a filled-out gaim_window_ops
@@ -161,7 +175,7 @@
 {
 	GaimConversation *conv;            /**< The parent conversation.     */
 
-	int    typing_state;               /**< The current typing state.    */
+	GaimTypingState typing_state;      /**< The current typing state.    */
 	guint  typing_timeout;             /**< The typing timer handle.     */
 	time_t type_again;                 /**< The type again time.         */
 	guint  type_again_timeout;         /**< The type again timer handle. */
@@ -1157,6 +1171,11 @@
  */
 GaimWindowUiOps *gaim_get_win_ui_ops(void);
 
+/**
+ * Initializes the conversation subsystem.
+ */
+void gaim_conversation_init(void);
+
 /*@}*/
 
 #endif /* _GAIM_CONVERSATION_H_ */
--- a/src/core.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/core.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,13 +18,8 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/*
+ * NOTE - I'd like to see this entire file just go away! -- ChipX86
+ */
 
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
+/* DONE! */
--- a/src/core.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/core.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,96 +24,6 @@
 #ifndef _CORE_H_
 #define _CORE_H_
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#ifdef HAVE_ICONV
-#include <iconv.h>
-#endif
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-#include <stdio.h>
-#include <time.h>
-#include <glib.h>
-#include <gmodule.h>
-
-struct group;
-struct buddy;
-
-
-#include "debug.h"
-#include "conversation.h"
-#include "ft.h"
-#include "privacy.h"
-#include "plugin.h"
-#include "event.h"
-#include "notify.h"
-#include "request.h"
-
-/* XXX Temporary! */
-#define OPT_LOG_BUDDY_SIGNON    0x00000004
-#define OPT_LOG_BUDDY_IDLE		0x00000008
-#define OPT_LOG_BUDDY_AWAY		0x00000010
-#define OPT_LOG_MY_SIGNON		0x00000020
-
-/* Really user states are controlled by the PRPLs now. We just use this for event_away */
-#define UC_UNAVAILABLE  1
-
-/* This is far too long to be practical, but MSN users are probably used to long aliases */
-#define SELF_ALIAS_LEN 400
-
-#if 0
-GaimAccount {
-	char username[64];
-	char alias[SELF_ALIAS_LEN]; 
-	char password[32];
-	char user_info[2048];
-	int options;
-	int protocol;
-	/* prpls can use this to save information about the user,
-	 * like which server to connect to, etc */
-	char proto_opt[7][256];
-
-	/* buddy icon file */
-	char iconfile[256];
-
-
-	GaimConnection *gc;
-	gboolean connecting;
-
-	GSList *permit;
-	GSList *deny;
-	int permdeny;
-};
-#endif
-
-/* XXX Temporary, until we have better account-specific prefs. */
-#define GAIM_ACCOUNT_CHECK_MAIL(account) \
-	((account)->options & OPT_ACCT_MAIL_CHECK)
-
-/* Functions in gaimrc.c */
-extern void load_prefs();
-extern void load_pounces();
-extern void save_prefs();
-
-/* Functions in server.c */
-extern void serv_got_update(GaimConnection *, const char *, int, int, time_t, time_t, int);
-extern void serv_got_im(GaimConnection *, const char *, const char *, guint32, time_t, gint);
-extern void serv_got_typing(GaimConnection *, const char *, int, int);
-extern void serv_got_typing_stopped(GaimConnection *, const char *);
-extern void serv_got_eviled(GaimConnection *, const char *, int);
-extern void serv_got_chat_invite(GaimConnection *, const char *, const char *, const char *, GHashTable *);
-extern GaimConversation *serv_got_joined_chat(GaimConnection *, int, const char *);
-extern void serv_got_chat_left(GaimConnection *, int);
-extern void serv_got_chat_in(GaimConnection *, int, char *, int, char *, time_t);
-extern void serv_got_alias(GaimConnection *, const char *, const char *);
-extern void serv_finish_login();
-
 #endif /* _CORE_H_ */
 
 /*
--- a/src/dialogs.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/dialogs.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,46 +18,29 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <ctype.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#else
-#include <sys/socket.h>
-#include <time.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#endif
-
-#include <errno.h>
-#include <math.h>
-
-#include <gtk/gtk.h>
-#include "gaim.h"
-#include "gtkimhtml.h"
-#include "prpl.h"
-#include "gtkblist.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "log.h"
+#include "multi.h"
 #include "notify.h"
 #include "prefs.h"
-#include "multi.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
-
-#define PATHSIZE 1024
+#include "privacy.h"
+#include "prpl.h"
+#include "request.h"
+#include "util.h"
+
+#include "gtkblist.h"
+#include "gtkconv.h"
+#include "gtkimhtml.h"
+#include "gtkprefs.h"
+#include "gtkutils.h"
+#include "stock.h"
+
+#include "ui.h"
+
+/* XXX For the soon-to-be-deprecated MultiEntryDlg stuff */
+#include "gaim.h"
 
 static GtkWidget *imdialog = NULL;	/*I only want ONE of these :) */
 static GList *dialogwindows = NULL;
--- a/src/ft.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/ft.c	Sat Jun 14 23:21:02 2003 +0000
@@ -3,7 +3,7 @@
  *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,24 +20,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gtk/gtk.h>
-#include "gaim.h"
+#include "internal.h"
+#include "ft.h"
+#include "notify.h"
 #include "proxy.h"
-#include "notify.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 static struct gaim_xfer_ui_ops *xfer_ui_ops = NULL;
 
--- a/src/ft.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/ft.h	Sat Jun 14 23:21:02 2003 +0000
@@ -28,6 +28,8 @@
 /**************************************************************************/
 struct gaim_xfer;
 
+#include "account.h"
+
 /**
  * Types of file transfers.
  */
--- a/src/gaim-remote.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gaim-remote.c	Sat Jun 14 23:21:02 2003 +0000
@@ -21,10 +21,9 @@
  *
  */
 
-#include "gaim.h"
+#include "internal.h"
+
 #include <getopt.h>
-#include <unistd.h>
-#include <string.h>
 #include <locale.h>
 
 #include <gaim-remote/remote.h>
--- a/src/gaim.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gaim.h	Sat Jun 14 23:21:02 2003 +0000
@@ -22,166 +22,9 @@
 #ifndef _GAIM_H_
 #define _GAIM_H_
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "core.h"
-#include "blist.h"
-#include "ui.h"
-#include "util.h"
-
 #define XPATCH BAD /* Because Kalla Said So */
 
-/* XXX CUI: when this is done being split, the only things below should be things
- * both the core and the uis depend on e.g. the protocol definitions, etc, and
- * it won't include core.h or ui.h (i.e. it'll mostly be #define's) */
-
-/* this is the basis of the CUI protocol. */
-#define CUI_TYPE_META		1
-#define CUI_TYPE_PLUGIN		2
-#define CUI_TYPE_USER		3
-#define CUI_TYPE_CONN		4
-#define CUI_TYPE_BUDDY		5	/* BUDDY_LIST, i.e., both groups and buddies */
-#define CUI_TYPE_MESSAGE	6
-#define CUI_TYPE_CHAT		7
-#define CUI_TYPE_REMOTE         8       
-					/* This is used to send commands to other UI's, 
-					 * like "Open new conversation" or "send IM".
-					 * Even though there's much redundancy with the
-					 * other CUI_TYPES, we're better keeping this stuff
-					 * seperate because it's intended use is so different */
-
-#define CUI_META_LIST		1	
-					/* 1 is always list; this is ignored by the core.
-					   If we move to TCP this can be a keepalive */
-#define CUI_META_QUIT		2
-#define CUI_META_DETACH		3	
-					/* you don't need to send this, you can just close
-					   the socket. the core will understand. */
-#define CUI_META_PING           4
-#define CUI_META_ACK            5
-
-#define CUI_PLUGIN_LIST		1
-#define CUI_PLUGIN_LOAD		2
-#define CUI_PLUGIN_UNLOAD	3
-
-#define CUI_USER_LIST		1
-#define CUI_USER_ADD		2
-#define CUI_USER_REMOVE		3
-#define CUI_USER_MODIFY		4	/* this handles moving them in the list too */
-#define CUI_USER_SIGNON		5
-
-#define CUI_CONN_LIST		1
-#define CUI_CONN_PROGRESS	2
-#define CUI_CONN_ONLINE		3
-#define CUI_CONN_OFFLINE	4	/* this may send a "reason" for why it was killed */
-
-#define CUI_BUDDY_LIST		1
-#define CUI_BUDDY_STATE		2	
-					/* notifies the UI of state changes; UI can use it to
-					   request the current status from the core */
-#define CUI_BUDDY_ADD		3
-#define CUI_BUDDY_REMOVE	4
-#define CUI_BUDDY_MODIFY	5
-
-#define CUI_MESSAGE_LIST	1	/* no idea */
-#define CUI_MESSAGE_SEND	2
-#define CUI_MESSAGE_RECV	3
-
-#define CUI_CHAT_LIST		1
-#define CUI_CHAT_HISTORY	2	/* is this necessary? should we have one for IMs? */
-#define CUI_CHAT_JOIN		3	/* handles other people joining/parting too */
-#define CUI_CHAT_PART		4
-#define CUI_CHAT_SEND		5
-#define CUI_CHAT_RECV		6
-
-#define CUI_REMOTE_CONNECTIONS  2       /* Get a list of gaim_connections */
-#define CUI_REMOTE_URI          3       /* Have the core handle aim:// URI's */
-#define CUI_REMOTE_BLIST        4       /* Return a copy of the buddy list */
-#define CUI_REMOTE_STATE        5       /* Given a buddy, return his presence. */
-#define CUI_REMOTE_NEW_CONVO    6       /* Must give a user, can give an optional message */
-#define CUI_REMOTE_SEND         7       /* Sends a message, a 'quiet' flag determines whether
-					 * a convo window is displayed or not. */
-#define CUI_REMOTE_ADD_BUDDY    8       /* Adds buddy to list */
-#define CUI_REMOTE_REMOVE_BUDDY 9       /* Removes buddy from list */
-#define CUI_REMOTE_JOIN_CHAT    10       /* Joins a chat. */
-                              /* What else?? */
-
-
-#define IM_FLAG_AWAY     0x01
-#define IM_FLAG_CHECKBOX 0x02
-#define IM_FLAG_GAIMUSER 0x04
-
-#define PERMIT_ALL	1
-#define PERMIT_NONE	2
-#define PERMIT_SOME	3
-#define DENY_SOME	4
-
-#define NOT_TYPING 0
-#define TYPING     1
-#define TYPED      2
-
-#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 AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
-
-#define WEBSITE "http://gaim.sourceforge.net/"
-
-#ifdef ENABLE_NLS
-#  include <libintl.h>
-#  define _(x) gettext(x)
-#  ifdef gettext_noop
-#    define N_(String) gettext_noop (String)
-#  else
-#    define N_(String) (String)
-#  endif
-#else
-#  define N_(String) (String)
-#  define _(x) (x)
-#endif
-
-#define DEFAULT_INFO "Visit the Gaim website at <A HREF=\"http://gaim.sourceforge.net/\">http://gaim.sourceforge.net/</A>."
-
-enum log_event {
-	log_signon = 0,
-	log_signoff,
-	log_away,
-	log_back,
-	log_idle,
-	log_unidle,
-	log_quit
-};
-
-#define OPT_POUNCE_POPUP	0x001
-#define OPT_POUNCE_SEND_IM	0x002
-#define OPT_POUNCE_COMMAND	0x004
-#define OPT_POUNCE_SOUND	0x008
-
-#define OPT_POUNCE_SIGNON	0x010
-#define OPT_POUNCE_UNAWAY	0x020
-#define OPT_POUNCE_UNIDLE	0x040
-#define OPT_POUNCE_TYPING       0x080
-#define OPT_POUNCE_SAVE		0x100
-
-#define OPT_POUNCE_NOTIFY	0x200
-
-/* These should all be runtime selectable */
-
-#define MSG_LEN 2048
-/* The above should normally be the same as BUF_LEN,
- * but just so we're explictly asking for the max message
- * length. */
-#define BUF_LEN MSG_LEN
-#define BUF_LONG BUF_LEN * 2
+#include "connection.h"
 
 /* Globals in main.c */
 extern int opt_away;
@@ -225,52 +68,6 @@
 /* Functions in idle.c */
 extern gint check_idle(gpointer);
 
-/* Functions in server.c */
-/* input to serv */
-extern void serv_login(GaimAccount *);
-extern void serv_close(GaimConnection *);
-extern void serv_touch_idle(GaimConnection *);
-extern int  serv_send_im(GaimConnection *, char *, char *, int, int);
-extern void serv_get_info(GaimConnection *, char *);
-extern void serv_get_dir(GaimConnection *, char *);
-extern void serv_set_idle(GaimConnection *, int);
-extern void serv_set_info(GaimConnection *, char *);
-extern void serv_set_away(GaimConnection *, char *, char *);
-extern void serv_set_away_all(char *);
-extern int  serv_send_typing(GaimConnection *, char *, int);
-extern void serv_change_passwd(GaimConnection *, const char *, const char *);
-extern void serv_add_buddy(GaimConnection *, const char *);
-extern void serv_add_buddies(GaimConnection *, GList *);
-extern void serv_remove_buddy(GaimConnection *, char *, char *);
-extern void serv_remove_buddies(GaimConnection *, GList *, char *);
-extern void serv_add_permit(GaimConnection *, const char *);
-extern void serv_add_deny(GaimConnection *, const char *);
-extern void serv_rem_permit(GaimConnection *, const char *);
-extern void serv_rem_deny(GaimConnection *, const char *);
-extern void serv_set_permit_deny(GaimConnection *);
-extern void serv_warn(GaimConnection *, char *, int);
-extern void serv_set_dir(GaimConnection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int);
-extern void serv_dir_search(GaimConnection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
-extern void serv_join_chat(GaimConnection *, GHashTable *);
-extern void serv_chat_invite(GaimConnection *, int, const char *, const char *);
-extern void serv_chat_leave(GaimConnection *, int);
-extern void serv_chat_whisper(GaimConnection *, int, char *, char *);
-extern int  serv_chat_send(GaimConnection *, int, char *);
-extern void serv_got_popup(char *, char *, int, int);
-extern void serv_get_away(GaimConnection *, const char *);
-extern void serv_alias_buddy(struct buddy *);
-extern void serv_move_buddy(struct buddy *, struct group *, struct group *);
-extern void serv_rename_group(GaimConnection *, struct group *, const char *);
-extern void serv_set_buddyicon(GaimConnection *, const char *);
-
-/* Functions in log.h */
-extern FILE *open_log_file (const char *, int);
-extern void system_log(enum log_event, GaimConnection *, struct buddy *, int);
-extern void rm_log(struct log_conversation *);
-extern struct log_conversation *find_log_info(const char *);
-extern void update_log_convs();
-extern void save_convo(GtkWidget *save, GaimConversation *c);
-extern char *html_logize(const char *p);
 
 /*------------------------------------------------------------------------*/
 /*  Multi-Entry dialog and vCard dialog support                           */
--- a/src/gaimrc.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gaimrc.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,36 +18,24 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
+#include "internal.h"
 
-#ifndef _WIN32
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gaim.h"
-#include "prpl.h"
+#include "account.h"
+#include "debug.h"
+#include "log.h"
+#include "notify.h"
+#include "pounce.h"
 #include "prefs.h"
 #include "proxy.h"
+#include "prpl.h"
 #include "sound.h"
-#include "gtksound.h"
-#include "pounce.h"
+#include "ui.h"
+#include "util.h"
+
+#include "gaim.h"
+
 #include "gtkpounce.h"
-#include "notify.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gtksound.h"
 
 /* for people like myself, who are too lazy to add an away msg :) */
 #define BORING_DEFAULT_AWAY_MSG _("sorry, i ran out for a while. bbl")
--- a/src/gtkaccount.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkaccount.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,32 +20,27 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include "internal.h"
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <gtk/gtk.h>
-
-#include "gtkaccount.h"
 #include "account.h"
 #include "accountopt.h"
+#include "debug.h"
 #include "event.h"
-#include "prefs.h"
 #include "plugin.h"
-#include "stock.h"
-#include "gtkblist.h"
-#include "gaim-disclosure.h"
-#include "gaim.h"
+#include "prefs.h"
+#include "request.h"
+#include "util.h"
 
-#ifdef _WIN32
-# include <gdk/gdkwin32.h>
-#else
-# include <unistd.h>
-# include <gdk/gdkx.h>
-#endif
+#include "gaim-disclosure.h"
+#include "gtkaccount.h"
+#include "gtkblist.h"
+#include "gtkutils.h"
+#include "stock.h"
 
-#include <string.h>
+#include "ui.h"
+
+/* XXX for do_quit() */
+#include "gaim.h"
 
 enum
 {
--- a/src/gtkblist.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkblist.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,6 +24,8 @@
 #ifndef _GAIM_GTK_LIST_H_
 #define _GAIM_GTK_LIST_H_
 
+#include "blist.h"
+
 enum {
 	STATUS_ICON_COLUMN,
 	STATUS_ICON_VISIBLE_COLUMN,
--- a/src/gtkconn.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkconn.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,17 +18,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#include <string.h>
-#include <gtk/gtk.h>
+#include "internal.h"
 
 #include "account.h"
-#include "gtkblist.h"
-#include "gaim.h"
+#include "debug.h"
+#include "notify.h"
+#include "util.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gtkblist.h"
+#include "gtkutils.h"
+
+#include "ui.h"
 
 struct signon_meter {
 	GaimAccount *account;
@@ -281,7 +281,7 @@
 	return;
 }
 
-
+#if 0
 struct kick_dlg {
 	GaimAccount *account;
 	GtkWidget *dlg;
@@ -372,4 +372,4 @@
 			   gaim_account_get_username(account));
 	hide_login_progress_common(gc, why, _("Connection Error"), buf);
 }
-
+#endif
--- a/src/gtkconv.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkconv.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,7 +1,8 @@
-/*
- * gaim
+/**
+ * @file gtkconv.h GTK+ Conversation API
+ * @ingroup gtkui
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,45 +19,45 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
+#include "internal.h"
+
 #ifndef _WIN32
-#include <sys/time.h>
-#include <unistd.h>
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
-#endif /*_WIN32*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <gtk/gtk.h>
+# include <X11/Xlib.h>
+#endif
+
 #ifdef USE_GTKSPELL
-#include <gtkspell/gtkspell.h>
+# include <gtkspell/gtkspell.h>
 #endif
+
 #include <gdk/gdkkeysyms.h>
-#include "prpl.h"
-#include "gtkimhtml.h"
-#include "dnd-hints.h"
-#include "sound.h"
-#include "gtkblist.h"
+
+#include "debug.h"
+#include "log.h"
+#include "multi.h"
 #include "notify.h"
 #include "prefs.h"
+#include "prpl.h"
+#include "sound.h"
+#include "util.h"
+
+#include "dnd-hints.h"
+#include "gtkblist.h"
 #include "gtkconv.h"
-#include "gaim.h"
+#include "gtkimhtml.h"
+#include "gtkutils.h"
+#include "stock.h"
+
 #include "ui.h"
-#include "debug.h"
-#include "multi.h"
+
+/* XXX */
+#include "gaim.h"
 
 #ifdef _WIN32
-#include "win32dep.h"
-#include "wspell.h"
+# include "wspell.h"
 #endif
 
+#define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
+
 static char nick_colors[][8] = {
 	"#ba55d3",              /* Medium Orchid */
 	"#ee82ee",              /* Violet */
@@ -1325,7 +1326,7 @@
 		/* XXX The (char *) should go away! Somebody add consts to stuff! */
 		serv_send_typing(gaim_conversation_get_gc(conv),
 						 (char *)gaim_conversation_get_name(conv),
-						 NOT_TYPING);
+						 GAIM_NOT_TYPING);
 	}
 	else {
 		/* We're deleting, but not all of it, so it counts as typing. */
@@ -1936,7 +1937,7 @@
 
 	/*
 	 * We know we got something, so we at least have to make sure we don't
-	 * send TYPED any time soon.
+	 * send GAIM_TYPED any time soon.
 	 */
 
 	im = GAIM_IM(conv);
@@ -1951,7 +1952,7 @@
 
 		int timeout = serv_send_typing(gaim_conversation_get_gc(conv),
 									   (char *)gaim_conversation_get_name(conv),
-									   TYPING);
+									   GAIM_TYPING);
 
 		if (timeout)
 			gaim_im_set_type_again(im, time(NULL) + timeout);
@@ -1976,7 +1977,7 @@
 		gtk_widget_destroy(gtkwin->menu.typing_icon);
 		gtkwin->menu.typing_icon = NULL;
 	}
-	if(im && gaim_im_get_typing_state(im) == TYPING) {
+	if(im && gaim_im_get_typing_state(im) == GAIM_TYPING) {
 		gtkwin->menu.typing_icon = gtk_image_menu_item_new();
 		gtk_image_menu_item_set_image(
 				GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon),
@@ -1984,7 +1985,7 @@
 					GTK_ICON_SIZE_MENU));
 		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
 				_("User is typing..."), NULL);
-	} else if(im && gaim_im_get_typing_state(im) == TYPED) {
+	} else if(im && gaim_im_get_typing_state(im) == GAIM_TYPED) {
 		gtkwin->menu.typing_icon = gtk_image_menu_item_new();
 		gtk_image_menu_item_set_image(
 				GTK_IMAGE_MENU_ITEM(gtkwin->menu.typing_icon),
@@ -4456,13 +4457,13 @@
 		style->font_desc = pango_font_description_copy(
 				gtk_widget_get_style(gtkconv->tab_label)->font_desc);
 
-		if (im != NULL && gaim_im_get_typing_state(im) == TYPING) {
+		if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPING) {
 			style->fg[GTK_STATE_NORMAL].red   = 0x4646;
 			style->fg[GTK_STATE_NORMAL].green = 0xA0A0;
 			style->fg[GTK_STATE_NORMAL].blue  = 0x4646;
 			style->fg[GTK_STATE_ACTIVE] = style->fg[GTK_STATE_NORMAL];
 		}
-		else if (im != NULL && gaim_im_get_typing_state(im) == TYPED) {
+		else if (im != NULL && gaim_im_get_typing_state(im) == GAIM_TYPED) {
 			style->fg[GTK_STATE_NORMAL].red   = 0xD1D1;
 			style->fg[GTK_STATE_NORMAL].green = 0x9494;
 			style->fg[GTK_STATE_NORMAL].blue  = 0x0C0C;
--- a/src/gtkconv.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkconv.h	Sat Jun 14 23:21:02 2003 +0000
@@ -4,7 +4,7 @@
  *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2002-2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/src/gtkdebug.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkdebug.c	Sat Jun 14 23:21:02 2003 +0000
@@ -4,7 +4,7 @@
  *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,11 +20,17 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include "internal.h"
+
+#include "prefs.h"
+#include "util.h"
+
 #include "gtkdebug.h"
-#include "gaim.h"
 #include "gtkimhtml.h"
-#include "prefs.h"
-#include <gtk/gtk.h>
+
+#include "ui.h"
+
+extern int opt_debug;
 
 typedef struct
 {
--- a/src/gtkdebug.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkdebug.h	Sat Jun 14 23:21:02 2003 +0000
@@ -4,7 +4,7 @@
  *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/src/gtkft.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkft.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,9 +1,10 @@
 /**
- * @file gtkft.c The GTK+ file transfer UI
+ * @file gtkft.c GTK+ file transfer UI
+ * @ingroup gtkui
  *
  * gaim
  *
- * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,18 +19,20 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
  */
-#include "gaim.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "notify.h"
+#include "ft.h"
 #include "prpl.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
+#include "request.h"
+#include "util.h"
+
+#include "gaim-disclosure.h"
 #include "gtkcellrendererprogress.h"
-#include "gaim-disclosure.h"
-#include "notify.h"
-#include "request.h"
+#include "gtkft.h"
+#include "stock.h"
 
 #define GAIM_GTKXFER(xfer) \
 	(struct gaim_gtkxfer_ui_data *)(xfer)->ui_data
--- a/src/gtkft.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkft.h	Sat Jun 14 23:21:02 2003 +0000
@@ -4,7 +4,7 @@
  *
  * gaim
  *
- * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
--- a/src/gtknotify.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtknotify.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,12 +20,15 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include "gtknotify.h"
+#include "internal.h"
+
+#include "debug.h"
+#include "connection.h"
 #include "stock.h"
-#include <gtk/gtk.h>
 
-/* XXX For ngettext :/ */
-#include "gaim.h"
+#include "gtknotify.h"
+
+#include "ui.h"
 
 typedef struct
 {
--- a/src/gtkpounce.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkpounce.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,5 +1,6 @@
 /**
  * @file gtkpounce.c GTK+ Buddy Pounce API
+ * @ingroup gtkui
  *
  * gaim
  *
@@ -20,14 +21,20 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#include <unistd.h>
-#include <string.h>
-#include "gaim.h"
+#include "internal.h"
+
+#include "conversation.h"
+#include "debug.h"
+#include "notify.h"
+#include "prpl.h"
+#include "server.h"
+#include "sound.h"
+
+#include "gtkblist.h"
 #include "gtkpounce.h"
-#include "gtkblist.h"
-#include "prpl.h"
-#include "sound.h"
-#include "notify.h"
+#include "gtkutils.h"
+
+#include "ui.h"
 
 typedef struct
 {
--- a/src/gtkprefs.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkprefs.c	Sat Jun 14 23:21:02 2003 +0000
@@ -21,38 +21,30 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <sys/time.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <gtk/gtk.h>
+#include "internal.h"
+
+#include "debug.h"
+#include "notify.h"
+#include "prefs.h"
+#include "proxy.h"
+#include "prpl.h"
+#include "sound.h"
+#include "util.h"
+
+#include "gtkblist.h"
+#include "gtkconv.h"
+#include "gtkdebug.h"
 #include "gtkimhtml.h"
-#include "gaim.h"
-#include "gtkblist.h"
-#include "gtkdebug.h"
 #include "gtkplugin.h"
 #include "gtkprefs.h"
-#include "prpl.h"
-#include "prefs.h"
-#include "proxy.h"
-#include "sound.h"
 #include "gtksound.h"
-#include "notify.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gtkutils.h"
+#include "stock.h"
+
+#include "ui.h"
+
+/* XXX for grab_url */
+#include "gaim.h"
 
 #define PROXYHOST 0
 #define PROXYPORT 1
--- a/src/gtkrequest.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkrequest.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,13 +20,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include "internal.h"
+
+#include "debug.h"
+
 #include "gtkrequest.h"
+#include "gtkutils.h"
 #include "stock.h"
-#include <gtk/gtk.h>
-#include <string.h>
-
-/* XXX For _(..) */
-#include "gaim.h"
 
 typedef struct
 {
--- a/src/gtksound.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtksound.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,44 +19,29 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "internal.h"
 
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
+#ifdef _WIN32
 #include <windows.h>
 #include <mmsystem.h>
 #endif
 
 #ifdef USE_AO
-#include <ao/ao.h>
-#include <audiofile.h>
+# include <ao/ao.h>
+# include <audiofile.h>
 #endif /* USE_AO */
 
 #ifdef USE_NAS_AUDIO
-#include <audio/audiolib.h>
-#include <audio/soundlib.h>
+# include <audio/audiolib.h>
+# include <audio/soundlib.h>
 #endif /* USE_NAS_AUDIO */
 
-#include "gaim.h" /* for gettext stuff */
-#include "sound.h"
-#include "gtksound.h"
+#include "debug.h"
+#include "notify.h"
 #include "prefs.h"
+#include "sound.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gtksound.h"
 
 
 struct gaim_sound_event {
--- a/src/gtkutils.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkutils.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,7 +1,10 @@
-/*
+/**
+ * @file gtkutils.h GTK+ utility functions
+ * @ingroup gtkui
+ *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,43 +19,36 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
+#include "internal.h"
+
 #ifndef _WIN32
-#include <sys/time.h>
-#include <unistd.h>
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
+# include <X11/Xlib.h>
 #else
-#ifdef small
-#undef small
-#endif
+# ifdef small
+#  undef small
+# endif
 #endif /*_WIN32*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <gtk/gtk.h>
+
 #ifdef USE_GTKSPELL
-#include <gtkspell/gtkspell.h>
+# include <gtkspell/gtkspell.h>
 #endif
-#include "gtkimhtml.h"
+
 #include <gdk/gdkkeysyms.h>
+
+#include "debug.h"
+#include "notify.h"
 #include "prefs.h"
 #include "prpl.h"
-#include "gaim.h"
+#include "util.h"
+
+#include "gtkconv.h"
+#include "gtkimhtml.h"
+#include "gtkutils.h"
 #include "ui.h"
-#include "notify.h"
 
 #ifdef _WIN32
 #include "wspell.h"
-#include "win32dep.h"
 #endif
 
 void
--- a/src/gtkutils.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/gtkutils.h	Sat Jun 14 23:21:02 2003 +0000
@@ -4,7 +4,7 @@
  *
  * gaim
  *
- * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,12 +20,11 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
 #ifndef _GAIM_GTK_UTILS_H_
 #define _GAIM_GTK_UTILS_H_
 
-#include "gaim.h"
-#include "conversation.h"
+#include <gtk/gtk.h>
+#include "gtkconv.h"
 #include "prpl.h"
 
 /**
--- a/src/html.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/html.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,31 +19,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include "internal.h"
 
-#ifndef _WIN32
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "gaim.h"
+#include "debug.h"
 #include "proxy.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gaim.h"
 
 gchar *strip_html(const gchar *text)
 {
--- a/src/idle.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/idle.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,31 +18,32 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <time.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
+#include "internal.h"
 
 #ifdef USE_SCREENSAVER
-#ifndef _WIN32
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/scrnsaver.h>
-#include <gdk/gdkx.h>
-#else
-#include "idletrack.h"
-#endif
+# ifndef _WIN32
+#  include <X11/Xlib.h>
+#  include <X11/Xutil.h>
+#  include <X11/extensions/scrnsaver.h>
+#  include <gdk/gdkx.h>
+# else
+#  include "idletrack.h"
+# endif
 #endif /* USE_SCREENSAVER */
 
-#include "gaim.h"
 #include "connection.h"
+#include "debug.h"
+#include "log.h"
 #include "multi.h"
+#include "prefs.h"
 #include "prpl.h"
-#include "prefs.h"
+
+#include "ui.h"
+
+#include "gtkprefs.h"
+
+/* XXX For the away stuff */
+#include "gaim.h"
 
 #define IDLEMARK 600   	/* 10 minutes! */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internal.h	Sat Jun 14 23:21:02 2003 +0000
@@ -0,0 +1,116 @@
+/**
+ * @file internal.h Internal definitions and includes
+ * @ingroup gtkui
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _GAIM_INTERNAL_H_
+#define _GAIM_INTERNAL_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef ENABLE_NLS
+#  include <libintl.h>
+#  define _(x) gettext(x)
+#  ifdef gettext_noop
+#    define N_(String) gettext_noop (String)
+#  else
+#    define N_(String) (String)
+#  endif
+#else
+#  define N_(String) (String)
+#  define _(x) (x)
+#endif
+
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+
+#define MSG_LEN 2048
+/* The above should normally be the same as BUF_LEN,
+ * but just so we're explictly asking for the max message
+ * length. */
+#define BUF_LEN MSG_LEN
+#define BUF_LONG BUF_LEN * 2
+
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef HAVE_ICONV
+#include <iconv.h>
+#endif
+
+#ifdef HAVE_LANGINFO_CODESET
+#include <langinfo.h>
+#endif
+
+#ifdef GAIM_PLUGINS
+# include <gmodule.h>
+# ifndef _WIN32
+#  include <dlfcn.h>
+# endif
+#endif
+
+#ifdef _WIN32
+# include <gdk/gdkwin32.h>
+# include <winsock.h>
+# include "win32dep.h"
+# include <direct.h>
+# include <winsock.h>
+# include <io.h>
+#else
+# include <arpa/inet.h>
+# include <netinet/in.h>
+# include <sys/socket.h>
+# include <sys/un.h>
+# include <sys/utsname.h>
+# include <gdk/gdkx.h>
+# include <netdb.h>
+# include <signal.h>
+# include <unistd.h>
+#endif
+
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+#endif
+
+#ifndef HOST_NAME_MAX
+# define HOST_NAME_MAX 255
+#endif
+
+#define PATHSIZE 1024
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#define WEBSITE "http://gaim.sourceforge.net/"
+
+#endif /* _GAIM_INTERNAL_H_ */
--- a/src/log.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/log.c	Sat Jun 14 23:21:02 2003 +0000
@@ -2,28 +2,22 @@
  * Function to remove a log file entry
  * ---------------------------------------------------
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <string.h>
+#include "internal.h"
 
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-#include "gaim.h"
-#include "core.h"
+#include "conversation.h"
+#include "debug.h"
+#include "log.h"
 #include "multi.h"
+#include "notify.h"
 #include "prefs.h"
 #include "prpl.h"
-#include "notify.h"
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#include "util.h"
+
+#include "gtkconv.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "ui.h"
+
+GList *log_conversations = NULL;
 
 void rm_log(struct log_conversation *a)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/log.h	Sat Jun 14 23:21:02 2003 +0000
@@ -0,0 +1,63 @@
+/**
+ * @file log.h Logging API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _GAIM_LOG_H_
+#define _GAIM_LOG_H_
+
+#include "blist.h"
+#include "connection.h"
+#include "conversation.h"
+
+/* XXX Temporary! */
+#define OPT_LOG_BUDDY_SIGNON    0x00000004
+#define OPT_LOG_BUDDY_IDLE		0x00000008
+#define OPT_LOG_BUDDY_AWAY		0x00000010
+#define OPT_LOG_MY_SIGNON		0x00000020
+
+
+enum log_event {
+	log_signon = 0,
+	log_signoff,
+	log_away,
+	log_back,
+	log_idle,
+	log_unidle,
+	log_quit
+};
+
+struct log_conversation {
+	char name[80];
+	char filename[512];
+        struct log_conversation *next;
+};
+
+extern GList *log_conversations;
+
+FILE *open_log_file (const char *, int);
+void system_log(enum log_event, GaimConnection *, struct buddy *, int);
+void rm_log(struct log_conversation *);
+struct log_conversation *find_log_info(const char *);
+void update_log_convs();
+void save_convo(GtkWidget *save, GaimConversation *c);
+char *html_logize(const char *p);
+
+#endif /* _GAIM_LOG_H_ */
--- a/src/main.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/main.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,14 +19,50 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "internal.h"
+
+#include "account.h"
+#include "conversation.h"
+#include "debug.h"
+#include "ft.h"
+#include "log.h"
+#include "notify.h"
+#include "prefs.h"
+#include "prpl.h"
+#include "pounce.h"
+#include "sound.h"
+#include "util.h"
+
+//#include "gaim.h"
+
+#include "gtkaccount.h"
+#include "gtkblist.h"
+#include "gtkconn.h"
+#include "gtkconv.h"
+#include "gtkdebug.h"
+#include "gtkft.h"
+#include "gtknotify.h"
+#include "gtkprefs.h"
+#include "gtkrequest.h"
+#include "gtksound.h"
+#include "stock.h"
+
+#include "ui.h"
+
+#if HAVE_SIGNAL_H
+# include <signal.h>
 #endif
+
+#include "locale.h"
+#include <getopt.h>
+
+#if 0
 #ifdef GAIM_PLUGINS
-#ifndef _WIN32
-#include <dlfcn.h>
-#endif
+# ifndef _WIN32
+#  include <dlfcn.h>
+# endif
 #endif /* GAIM_PLUGINS */
+
 #include <gtk/gtk.h>
 #ifndef _WIN32
 #include <gdk/gdkx.h>
@@ -69,11 +105,14 @@
 #ifdef _WIN32
 #include "win32dep.h"
 #endif
+#endif
+
+extern void load_prefs();
+extern void load_pounces();
 
 static GtkWidget *name;
 static GtkWidget *pass;
 
-GList *log_conversations = NULL;
 GSList *away_messages = NULL;
 GSList *message_queue = NULL;
 GSList *unread_message_queue = NULL;
@@ -149,6 +188,7 @@
 	gtk_main_quit();
 }
 
+
 static guint snd_tmout = 0;
 static gboolean sound_timeout(gpointer data)
 {
--- a/src/multi.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/multi.h	Sat Jun 14 23:21:02 2003 +0000
@@ -23,13 +23,8 @@
 #define _MULTI_H_
 
 #include "account.h"
-#include "core.h"
 #include "plugin.h"
 
-#define OPT_CONN_HTML		0x00000001
-/* set this flag on a gc if you want serv_got_im to autoreply when away */
-#define OPT_CONN_AUTO_RESP	0x00000002
-
 struct proto_actions_menu {
 	char *label;
 	void (*callback)(GaimConnection *);
--- a/src/plugin.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/plugin.c	Sat Jun 14 23:21:02 2003 +0000
@@ -34,29 +34,15 @@
  * Yeah, well now I'm re-writing a good portion of it! The perl stuff was
  * a hack. Tsk tsk! -- Christian <chipx86@gnupdate.org>
  */
+#include "internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gaim.h"
 #include "accountopt.h"
-#include "prpl.h"
+#include "debug.h"
 #include "event.h"
 #include "notify.h"
-
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "prefs.h"
+#include "prpl.h"
+#include "request.h"
 
 #ifdef _WIN32
 # define PLUGIN_EXT ".dll"
--- a/src/pounce.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/pounce.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,12 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <glib.h>
+#include "internal.h"
+#include "debug.h"
+#include "pounce.h"
 
 #include "debug.h"
 #include "pounce.h"
--- a/src/privacy.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/privacy.h	Sat Jun 14 23:21:02 2003 +0000
@@ -19,7 +19,6 @@
  *
  */
 
-#include "gaim.h"
 gboolean gaim_privacy_permit_add(GaimAccount *account, const char *name);
 gboolean gaim_privacy_deny_add(GaimAccount *account, const char *name);
 gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name);
--- a/src/protocols/gg/gg.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/gg/gg.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 6100 2003-06-03 02:00:33Z chipx86 $
+ * $Id: gg.c 6304 2003-06-14 23:21:02Z chipx86 $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  * 
@@ -19,41 +19,23 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "internal.h"
 
-#ifndef _WIN32
-#include <netdb.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <ctype.h>
 /* Library from EKG (Eksperymentalny Klient Gadu-Gadu) */
 #include "libgg.h"
-#include "gaim.h"
+
+#include "account.h"
 #include "accountopt.h"
+#include "debug.h"
 #include "multi.h"
-#include "core.h"
+#include "notify.h"
+#include "proxy.h"
 #include "prpl.h"
-#include "proxy.h"
+#include "server.h"
+#include "util.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX for g_show_info_text(), WEBSITE, and stuff */
+#include "gaim.h"
 
 #define GG_CONNECT_STEPS 5
 
@@ -292,7 +274,7 @@
 	struct agg_data *gd = gc->proto_data;
 	struct gg_event *e;
 
-	debug_printf("main_callback enter: begin\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "main_callback enter: begin\n");
 
 	if (gd->sess->fd != source)
 		gd->sess->fd = source;
@@ -303,7 +285,8 @@
 	}
 
 	if (!(e = gg_watch_fd(gd->sess))) {
-		debug_printf("main_callback: gg_watch_fd failed - CRITICAL!\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "main_callback: gg_watch_fd failed - CRITICAL!\n");
 		gaim_connection_error(gc, _("Unable to read socket"));
 		return;
 	}
@@ -313,7 +296,8 @@
 		/* do nothing */
 		break;
 	case GG_EVENT_CONN_SUCCESS:
-		debug_printf("main_callback: CONNECTED AGAIN!?\n");
+		gaim_debug(GAIM_DEBUG_WARNING, "gg",
+				   "main_callback: CONNECTED AGAIN!?\n");
 		break;
 	case GG_EVENT_CONN_FAILED:
 		if (gc->inpa)
@@ -388,11 +372,13 @@
 		}
 		break;
 	case GG_EVENT_ACK:
-		debug_printf("main_callback: message %d to %lu sent with status %d\n",
+		gaim_debug(GAIM_DEBUG_MISC, "gg",
+				   "main_callback: message %d to %lu sent with status %d\n",
 			     e->event.ack.seq, e->event.ack.recipient, e->event.ack.status);
 		break;
 	default:
-		debug_printf("main_callback: unsupported event %d\n", e->type);
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "main_callback: unsupported event %d\n", e->type);
 		break;
 	}
 	gg_free_event(e);
@@ -404,12 +390,13 @@
 	struct agg_data *gd = gc->proto_data;
 	struct gg_event *e;
 
-	debug_printf("GG login_callback...\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "login_callback...\n");
 	if (!g_list_find(gaim_connections_get_all(), gc)) {
 		close(source);
 		return;
 	}
-	debug_printf("Found GG connection\n");
+
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "Found GG connection\n");
 
 	if (source == 0) {
 		gaim_connection_error(gc, _("Unable to connect."));
@@ -418,13 +405,14 @@
 
 	gd->sess->fd = source;
 
-	debug_printf("Source is valid.\n");
+	gaim_debug(GAIM_DEBUG_MISC, "gg", "Source is valid.\n");
 	if (gc->inpa == 0) {
-		debug_printf("login_callback.. checking gc->inpa .. is 0.. setting fd watch\n");
+		gaim_debug(GAIM_DEBUG_MISC, "gg",
+				   "login_callback.. checking gc->inpa .. is 0.. setting fd watch\n");
 		gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc);
-		debug_printf("Adding watch on fd\n"); 
+		gaim_debug(GAIM_DEBUG_INFO, "gg", "Adding watch on fd\n"); 
 	}
-	debug_printf("Checking State.\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "Checking State.\n");
 	switch (gd->sess->state) {
 	case GG_STATE_READING_DATA:
 		gaim_connection_update_progress(gc, _("Reading data"), 2, GG_CONNECT_STEPS);
@@ -439,12 +427,13 @@
 		gaim_connection_update_progress(gc, _("Exchanging key hash"), 5, GG_CONNECT_STEPS);
 		break;
 	default:
-		debug_printf("No State found\n");
+		gaim_debug(GAIM_DEBUG_INFO, "gg", "No State found\n");
 		break;
 	}
-	debug_printf("gg_watch_fd\n");
+	gaim_debug(GAIM_DEBUG_MISC, "gg", "gg_watch_fd\n");
 	if (!(e = gg_watch_fd(gd->sess))) {
-		debug_printf("login_callback: gg_watch_fd failed - CRITICAL!\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "login_callback: gg_watch_fd failed - CRITICAL!\n");
 		gaim_connection_error(gc, _("Critical error in GG library\n"));
 		return;
 	}
@@ -473,11 +462,12 @@
 		/* Set new watch on login server ip */
 		if(gc->inpa)
 			gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc);
-		debug_printf("Setting watch on connection with login server.\n"); 
+		gaim_debug(GAIM_DEBUG_INFO, "gg",
+				   "Setting watch on connection with login server.\n"); 
 		break;
 	}/* end switch() */
 
-	debug_printf("checking gg_event\n");
+	gaim_debug(GAIM_DEBUG_MISC, "gg", "checking gg_event\n");
 	switch (e->type) {
 	case GG_EVENT_NONE:
 		/* nothing */
@@ -499,10 +489,10 @@
 		handle_errcode(gc, e->event.failure);
 		break;
 	default:
-		debug_printf("no gg_event\n");
+		gaim_debug(GAIM_DEBUG_MISC, "gg", "no gg_event\n");
 		break;
 	}
-	debug_printf("Returning from login_callback\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "Returning from login_callback\n");
 	gg_free_event(e);
 }
 
@@ -538,7 +528,7 @@
 
 	/*
 	   if (gg_login(gd->sess, strtol(user->username, (char **)NULL, 10), user->password, 1) < 0) {
-	   debug_printf("uin=%u, pass=%s", strtol(user->username, (char **)NULL, 10), user->password); 
+	   gaim_debug(GAIM_DEBUG_MISC, "gg", "uin=%u, pass=%s", strtol(user->username, (char **)NULL, 10), user->password); 
 	   hide_login_progress(gc, "Unable to connect.");
 	   signoff(gc);
 	   return;
@@ -639,7 +629,7 @@
 	int i, j;
 
 	if ((ptr = strstr(webdata, "query_results:")) == NULL || (ptr = strchr(ptr, '\n')) == NULL) {
-		debug_printf("search_callback: pubdir result [%s]\n", webdata);
+		gaim_debug(GAIM_DEBUG_MISC, "gg", "search_callback: pubdir result [%s]\n", webdata);
 		gaim_notify_error(gc, NULL, _("Couldn't get search results"), NULL);
 		return;
 	}
@@ -751,7 +741,7 @@
 	}
 
 	if ((ptr = strstr(webdata, "get_results:")) == NULL || (ptr = strchr(ptr, ':')) == NULL) {
-		debug_printf("import_buddies_server_results: import buddies result [%s]\n", webdata);
+		gaim_debug(GAIM_DEBUG_MISC, "gg", "import_buddies_server_results: import buddies result [%s]\n", webdata);
 		gaim_notify_error(gc, NULL,
 						  _("Couldn't Import Buddy List from Server"), NULL);
 		return;
@@ -766,7 +756,8 @@
 		gchar *name, *show;
 
 		if (strlen(users_tbl[i])==0) {
-			debug_printf("import_buddies_server_results: users_tbl[i] is empty\n");
+			gaim_debug(GAIM_DEBUG_MISC, "gg",
+					   "import_buddies_server_results: users_tbl[i] is empty\n");
 			continue;
 		}
 
@@ -780,7 +771,8 @@
 			continue;
 		}
 
-		debug_printf("import_buddies_server_results: uin: %s\n", name);
+		gaim_debug(GAIM_DEBUG_MISC, "gg",
+				   "import_buddies_server_results: uin: %s\n", name);
 		if (!gaim_find_buddy(gc->account, name)) {
 			struct buddy *b;
 			struct group *g;
@@ -819,7 +811,8 @@
 		return;
 	}
 
-	debug_printf("export_buddies_server_results: webdata [%s]\n", webdata);
+	gaim_debug(GAIM_DEBUG_MISC, "gg",
+			   "export_buddies_server_results: webdata [%s]\n", webdata);
 	gaim_notify_error(gc, NULL,
 					  _("Couldn't transfer Buddy List to Gadu-Gadu server"),
 					  NULL);
@@ -834,7 +827,8 @@
 		return;
 	}
 
-	debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata);
+	gaim_debug(GAIM_DEBUG_MISC, "gg",
+			   "delete_buddies_server_results: webdata [%s]\n", webdata);
 	gaim_notify_error(gc, NULL,
 					  _("Couldn't delete Buddy List from Gadu-Gadu server"),
 					  NULL);
@@ -848,7 +842,8 @@
 		return;
 	}
 
-	debug_printf("password_change_server_results: webdata [%s]\n", webdata);
+	gaim_debug(GAIM_DEBUG_MISC, "gg",
+			   "password_change_server_results: webdata [%s]\n", webdata);
 	gaim_notify_error(gc, NULL,
 					  _("Password couldn't be changed"), NULL);
 }
@@ -861,10 +856,11 @@
 	int len;
 	char read_data;
 
-	debug_printf("http_results: begin\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "http_results: begin\n");
 
 	if (!g_list_find(gaim_connections_get_all(), gc)) {
-		debug_printf("search_callback: g_slist_find error\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "search_callback: g_slist_find error\n");
 		gaim_input_remove(hdata->inpa);
 		g_free(hdata);
 		close(source);
@@ -894,7 +890,8 @@
 	gaim_input_remove(hdata->inpa);
 	close(source);
 
-	debug_printf("http_results: type %d, webdata [%s]\n", hdata->type, webdata);
+	gaim_debug(GAIM_DEBUG_MISC, "gg",
+			   "http_results: type %d, webdata [%s]\n", hdata->type, webdata);
 
 	switch (hdata->type) {
 	case AGG_HTTP_SEARCH:
@@ -914,7 +911,8 @@
 		break;
 	case AGG_HTTP_NONE:
 	default:
-		debug_printf("http_results: unsupported type %d\n", hdata->type);
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "http_results: unsupported type %d\n", hdata->type);
 		break;
 	}
 
@@ -929,10 +927,11 @@
 	gchar *request = hdata->request;
 	gchar *buf;
 
-	debug_printf("http_req_callback: begin\n");
+	gaim_debug(GAIM_DEBUG_INFO, "gg", "http_req_callback: begin\n");
 
 	if (!g_list_find(gaim_connections_get_all(), gc)) {
-		debug_printf("http_req_callback: g_slist_find error\n");
+		gaim_debug(GAIM_DEBUG_ERROR, "gg",
+				   "http_req_callback: g_slist_find error\n");
 		g_free(request);
 		g_free(hdata);
 		close(source);
@@ -945,7 +944,8 @@
 		return;
 	}
 
-	debug_printf("http_req_callback: http request [%s]\n", request);
+	gaim_debug(GAIM_DEBUG_MISC, "gg",
+			   "http_req_callback: http request [%s]\n", request);
 
 	buf = g_strdup_printf("POST %s HTTP/1.0\r\n"
 			      "Host: %s\r\n"
--- a/src/protocols/gg/libgg.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/gg/libgg.c	Sat Jun 14 23:21:02 2003 +0000
@@ -1,4 +1,4 @@
-/* $Id: libgg.c 6100 2003-06-03 02:00:33Z chipx86 $ */
+/* $Id: libgg.c 6304 2003-06-14 23:21:02Z chipx86 $ */
 
 /*
  *  (C) Copyright 2001 Wojtek Kaniewski <wojtekka@irc.pl>,
@@ -50,9 +50,10 @@
 #  define WORDS_BIGENDIAN 1
 #endif
 #include "libgg.h"
-#include "config.h"
-#include "gaim.h"
+
+#include "internal.h"
 #include "proxy.h"
+#include "debug.h"
 
 #ifdef _WIN32
 #include "win32dep.h"
@@ -72,7 +73,7 @@
 #ifdef __GNUC__
 __attribute__ ((unused))
 #endif
-= "$Id: libgg.c 6100 2003-06-03 02:00:33Z chipx86 $";
+= "$Id: libgg.c 6304 2003-06-14 23:21:02Z chipx86 $";
 
 #endif 
 
@@ -581,7 +582,8 @@
 	gg_debug(GG_DEBUG_FUNCTION, "** gg_ping(...);\n");
 	
 	if(ping_outstanding) {
-		debug_printf("Trying to send ping, when we havn't been ponged on last ping\n");
+		gaim_debug(GAIM_DEBUG_INFO, "gg",
+				   "Trying to send ping, when we havn't been ponged on last ping\n");
 		return 1;
 	}
 	else {
--- a/src/protocols/irc/irc.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/irc/irc.c	Sat Jun 14 23:21:02 2003 +0000
@@ -22,34 +22,23 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#include <config.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <ctype.h>
+#include "internal.h"
+
+#include "account.h"
+#include "accountopt.h"
+#include "conversation.h"
+#include "debug.h"
+#include "ft.h"
+#include "multi.h"
+#include "notify.h"
+#include "proxy.h"
+#include "prpl.h"
+#include "request.h"
+#include "server.h"
+#include "util.h"
+
+/* XXX for g_show_info_text(), WEBSITE, etc. */
 #include "gaim.h"
-#include "accountopt.h"
-#include "multi.h"
-#include "core.h"
-#include "prpl.h"
-#include "proxy.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 #define IRC_BUF_LEN 4096
 #define PDIWORDS 32
--- a/src/protocols/jabber/jabber.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,47 +19,36 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "internal.h"
+
+#ifdef _WIN32
+# include "utsname.h"
 #endif
 
-#include <sys/types.h>
-/*this must happen before sys/socket.h or freebsd won't compile*/
-
-#ifndef _WIN32
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-#else
-#include "utsname.h"
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
+#include "account.h"
+#include "accountopt.h"
+#include "conversation.h"
+#include "debug.h"
+#include "ft.h"
+#include "multi.h"
+#include "notify.h"
+#include "prpl.h"
+#include "request.h"
+#include "util.h"
+
+/* XXX */
 #include "gaim.h"
-#include "accountopt.h"
-#include "multi.h"
-#include "prpl.h"
+
 #ifdef MAX
-#undef MAX
+# undef MAX
 #endif
 #ifdef MIN
-#undef MIN
+# undef MIN
 #endif
+
 #include "jabber.h"
 #include "proxy.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
-
 static GaimPlugin *my_protocol = NULL;
 
 /* The priv member of gjconn's is a gaim_connection for now. */
@@ -1093,6 +1082,7 @@
 	return jri;
 }
 
+#if 0
 static gboolean jabber_is_default_resource(GaimConnection *gc, const char *who)
 {
 	jab_res_info jri = jabber_find_resource(gc, who);
@@ -1107,6 +1097,7 @@
 	g_free(buddy);
 	return FALSE;
 }
+#endif
 
 /*
  * if the resource doesn't exist, create it.  otherwise, just update the priority
@@ -1413,7 +1404,7 @@
 			/* a non-message message! */
 			from = g_strdup_printf("%s@%s", p->from->user, p->from->server);
 			if(typing)
-				serv_got_typing(GJ_GC(gjc), from, 0, TYPING);
+				serv_got_typing(GJ_GC(gjc), from, 0, GAIM_TYPING);
 			else
 				serv_got_typing_stopped(GJ_GC(gjc), from);
 			g_free(from);
@@ -2484,7 +2475,7 @@
 	y = xmlnode_insert_tag(x, "x");
 	xmlnode_put_attrib(y, "xmlns", "jabber:x:event");
 
-	if(typing == TYPING)
+	if(typing == GAIM_TYPING)
 		xmlnode_insert_tag(y, "composing");
 
 	gjab_send(((struct jabber_data *)gc->proto_data)->gjc, x);
--- a/src/protocols/msn/msn.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/msn/msn.c	Sat Jun 14 23:21:02 2003 +0000
@@ -507,7 +507,7 @@
 
 	if (!g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
 		/* We'll just fake it, since we're sending to ourself. */
-		serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, TYPING);
+		serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, GAIM_TYPING);
 
 		return MSN_TYPING_SEND_TIMEOUT;
 	}
--- a/src/protocols/msn/msn.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/msn/msn.h	Sat Jun 14 23:21:02 2003 +0000
@@ -22,35 +22,27 @@
 #ifndef _MSN_H_
 #define _MSN_H_
 
-#include "config.h"
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <winsock.h>
-#include <io.h>
-#endif
-
+#include "internal.h"
 
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <ctype.h>
-#ifndef _WIN32
-#include <netdb.h>
-#endif
-
-#include "gaim.h"
 #include "account.h"
+#include "accountopt.h"
 #include "blist.h"
+#include "connection.h"
 #include "conversation.h"
-#include "connection.h"
 #include "debug.h"
 #include "md5.h"
+#include "notify.h"
+#include "privacy.h"
 #include "proxy.h"
 #include "prpl.h"
+#include "request.h"
+#include "server.h"
+#include "util.h"
+
+#include "ui.h"
+
+/* XXX */
+#include "gaim.h"
 
 #ifdef _WIN32
 #include "win32dep.h"
--- a/src/protocols/msn/switchboard.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Sat Jun 14 23:21:02 2003 +0000
@@ -327,7 +327,7 @@
 		(value = msn_message_get_attr(msg, "TypingUser")) != NULL) {
 
 		serv_got_typing(gc, servconn->msg_passport, MSN_TYPING_RECV_TIMEOUT,
-						TYPING);
+						GAIM_TYPING);
 	}
 
 	return TRUE;
--- a/src/protocols/napster/napster.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/napster/napster.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,35 +18,20 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#include <config.h>
+#include "internal.h"
 
-#ifndef _WIN32
-#include <netdb.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
-#include "gaim.h"
+#include "account.h"
 #include "accountopt.h"
+#include "conversation.h"
+#include "debug.h"
 #include "multi.h"
+#include "notify.h"
 #include "prpl.h"
 #include "proxy.h"
+#include "util.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX */
+#include "gaim.h"
 
 #define NAP_SERVER "64.124.41.187"
 #define NAP_PORT 8888
--- a/src/protocols/oscar/oscar.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,43 +19,27 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-/* this must happen before sys/socket.h or freebsd won't compile */
-
-#ifndef _WIN32
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#endif
-
-#include <errno.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <signal.h>
-
-#include "gaim.h"
+#include "internal.h"
+
+#include "account.h"
 #include "accountopt.h"
+#include "conversation.h"
+#include "debug.h"
+#include "ft.h"
 #include "multi.h"
+#include "notify.h"
+#include "privacy.h"
 #include "prpl.h"
-#include "core.h"
 #include "proxy.h"
+#include "request.h"
+#include "util.h"
+
 #include "aim.h"
 #include "md5.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX */
+#include "gaim.h"
+#include "ui.h"
 
 
 #define UC_AOL		0x02
@@ -3016,11 +3000,11 @@
 		} break;
 
 		case 0x0001: { /* Paused typing */
-			serv_got_typing(gc, sn, 0, TYPED);
+			serv_got_typing(gc, sn, 0, GAIM_TYPED);
 		} break;
 
 		case 0x0002: { /* Typing */
-			serv_got_typing(gc, sn, 0, TYPING);
+			serv_got_typing(gc, sn, 0, GAIM_TYPING);
 		} break;
 
 		default: {
@@ -4222,9 +4206,9 @@
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim = find_direct_im(od, name);
 	if (dim)
-		if (typing == TYPING)
+		if (typing == GAIM_TYPING)
 			aim_odc_send_typing(od->sess, dim->conn, 0x0002);
-		else if (typing == TYPED)
+		else if (typing == GAIM_TYPED)
 			aim_odc_send_typing(od->sess, dim->conn, 0x0001);
 		else
 			aim_odc_send_typing(od->sess, dim->conn, 0x0000);
@@ -4235,9 +4219,9 @@
 		if (!list) {
 			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name));
 			if (bi && bi->typingnot) {
-				if (typing == TYPING)
+				if (typing == GAIM_TYPING)
 					aim_im_sendmtn(od->sess, 0x0001, name, 0x0002);
-				else if (typing == TYPED)
+				else if (typing == GAIM_TYPED)
 					aim_im_sendmtn(od->sess, 0x0001, name, 0x0001);
 				else
 					aim_im_sendmtn(od->sess, 0x0001, name, 0x0000);
@@ -5627,9 +5611,9 @@
 		/* I had to leave this. It's just too funny. It reminds me of my sister. */
 		gaim_debug(GAIM_DEBUG_INFO, "oscar",
 				   "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn);
-		serv_got_typing(gc, sn, 0, TYPING);
+		serv_got_typing(gc, sn, 0, GAIM_TYPING);
 	} else if (typing == 0x0001)
-		serv_got_typing(gc, sn, 0, TYPED);
+		serv_got_typing(gc, sn, 0, GAIM_TYPED);
 	else
 		serv_got_typing_stopped(gc, sn);
 	return 1;
--- a/src/protocols/toc/toc.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/toc/toc.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,40 +18,22 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <netdb.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#else
-#include <winsock.h>
-#endif
+#include "internal.h"
 
-#include <gtk/gtk.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include "account.h"
+#include "accountopt.h"
+#include "conversation.h"
+#include "debug.h"
 #include "prpl.h"
-#include "accountopt.h"
 #include "multi.h"
-#include "gaim.h"
+#include "notify.h"
 #include "proxy.h"
+#include "request.h"
+#include "util.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX */
+#include "gaim.h"
+#include "ui.h"
 
 static GaimPlugin *my_protocol = NULL;
 
--- a/src/protocols/trepia/trepia.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/trepia/trepia.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,17 +19,21 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include "gaim.h"
+#include "internal.h"
+
 #include "account.h"
 #include "accountopt.h"
+#include "debug.h"
+#include "notify.h"
+#include "request.h"
+#include "server.h"
+#include "util.h"
+
 #include "md5.h"
 #include "profile.h"
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
 
 /* XXX */
+#include "gaim.h"
 #include "multi.h"
 
 #ifndef _WIN32
--- a/src/protocols/yahoo/yahoo.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,38 +19,24 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "internal.h"
 
-#ifndef _WIN32
-#include <netdb.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include "gaim.h"
+#include "account.h"
 #include "accountopt.h"
+#include "debug.h"
 #include "multi.h"
+#include "notify.h"
 #include "prpl.h"
 #include "proxy.h"
+#include "request.h"
+#include "server.h"
+#include "util.h"
+
 #include "md5.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX */
+#include "gaim.h"
+#include "ui.h"
 
 extern char *yahoo_crypt(const char *, const char *);
 
@@ -529,7 +515,7 @@
 	
 	if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))) {
 		if (*stat == '1')
-			serv_got_typing(gc, from, 0, TYPING);
+			serv_got_typing(gc, from, 0, GAIM_TYPING);
 		else
 			serv_got_typing_stopped(gc, from);
 	} else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) {
@@ -1233,7 +1219,7 @@
 	yahoo_packet_hash(pkt, 49, "TYPING");
 	yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
 	yahoo_packet_hash(pkt, 14, " ");
-	yahoo_packet_hash(pkt, 13, typ == TYPING ? "1" : "0");
+	yahoo_packet_hash(pkt, 13, typ == GAIM_TYPING ? "1" : "0");
 	yahoo_packet_hash(pkt, 5, who);
 	yahoo_packet_hash(pkt, 1002, "1");
 
--- a/src/protocols/zephyr/ZVariables.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/zephyr/ZVariables.c	Sat Jun 14 23:21:02 2003 +0000
@@ -5,7 +5,7 @@
  *	Created by:	Robert French
  *
  *	$Source$
- *	$Author: lschiere $
+ *	$Author: chipx86 $
  *
  *	Copyright (c) 1987 by the Massachusetts Institute of Technology.
  *	For copying and distribution information, see the file
@@ -18,7 +18,7 @@
 #endif
 
 #include <internal.h>
-#include "gaim.h"
+#include "util.h"
 
 #include <ctype.h>
 #include <pwd.h>
--- a/src/protocols/zephyr/zephyr.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/protocols/zephyr/zephyr.c	Sat Jun 14 23:21:02 2003 +0000
@@ -22,18 +22,19 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* XXX eww */
+#include "src/internal.h"
 
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
+#include "debug.h"
+#include "multi.h"
+#include "notify.h"
+#include "prpl.h"
+#include "server.h"
+#include "util.h"
+
+#include "zephyr/zephyr.h"
+
 #include "gaim.h"
-#include "prpl.h"
-#include "multi.h"
-#include "zephyr/zephyr.h"
 
 extern Code_t ZGetLocations(ZLocations_t *, int *);
 extern Code_t ZSetLocation(char *);
--- a/src/proxy.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/proxy.c	Sat Jun 14 23:21:02 2003 +0000
@@ -27,35 +27,11 @@
 /* it is intended to : 1st handle http proxy, using the CONNECT command
  , 2nd provide an easy way to add socks support */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <signal.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-#include "gaim.h"
+#include "internal.h"
+#include "debug.h"
+#include "prefs.h"
 #include "proxy.h"
-#include "prefs.h"
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "util.h"
 
 #define GAIM_READ_COND  (G_IO_IN | G_IO_HUP | G_IO_ERR)
 #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
@@ -63,6 +39,8 @@
 static GaimProxyInfo *global_proxy_info = NULL;
 static gboolean global_proxy_info_from_prefs = FALSE;
 
+static int opt_debug = 0;
+
 struct PHB {
 	GaimInputFunction func;
 	gpointer data;
@@ -597,7 +575,7 @@
 					FD_SET(child_in[0], &fds);
 					rc = select(child_in[0]+1, &fds, NULL, NULL, &tv);
 					if(!rc) {
-						if(opt_debug)
+						if (opt_debug)
 							fprintf(stderr,"dns[%d]: nobody needs me... =(\n", getpid());
 						break;
 					}
@@ -1392,7 +1370,7 @@
 	unsigned int len;
 	int error = ETIMEDOUT;
 
-	gaim_debug(GAIM_INFO, "socks5 proxy", "Connected.\n");
+	gaim_debug(GAIM_DEBUG_INFO, "socks5 proxy", "Connected.\n");
 
 	if (phb->inpa > 0)
 		gaim_input_remove(phb->inpa);
--- a/src/proxy.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/proxy.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,21 +24,8 @@
 #ifndef _GAIM_PROXY_H_
 #define _GAIM_PROXY_H_
 
-#include <sys/types.h>
-/*this must happen before sys/socket.h or freebsd won't compile*/
-
-#ifndef _WIN32
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-#else
-# include <winsock.h>
-#endif
-
 #include <glib.h>
 
-#include "account.h"
-
 /**
  * A type of proxy connection.
  */
@@ -78,6 +65,9 @@
 
 typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);
 
+
+#include "account.h"
+
 /**************************************************************************/
 /** @name Proxy structure API                                             */
 /**************************************************************************/
--- a/src/prpl.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/prpl.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,22 +18,16 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#include "gaim.h"
+#include "internal.h"
+#include "debug.h"
 #include "gtkutils.h"
 #include "gtkblist.h"
 #include "multi.h"
+#include "notify.h"
 #include "prpl.h"
-#include "notify.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "request.h"
+#include "ui.h"
+#include "util.h"
 
 GtkWidget *protomenu = NULL;
 
--- a/src/prpl.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/prpl.h	Sat Jun 14 23:21:02 2003 +0000
@@ -65,6 +65,7 @@
 
 } GaimProtocol;
 
+
 #include "blist.h"
 #include "proxy.h"
 #include "plugin.h"
--- a/src/server.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/server.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,27 +18,26 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "internal.h"
+#include "conversation.h"
+#include "debug.h"
+#include "log.h"
+#include "multi.h"
+#include "notify.h"
+#include "pounce.h"
+#include "prefs.h"
+#include "prpl.h"
+#include "request.h"
+#include "server.h"
+#include "sound.h"
+#include "util.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
+/* XXX UI Stuff */
+#include "gaim.h"
 #include "gtkimhtml.h"
-#include "prpl.h"
-#include "multi.h"
-#include "gaim.h"
-#include "sound.h"
-#include "pounce.h"
-#include "notify.h"
-#include "prefs.h"
+#include "gtkconv.h"
+#include "gtkutils.h"
+#include "ui.h"
 
 void serv_login(GaimAccount *account)
 {
@@ -1193,7 +1192,7 @@
 }
 
 void serv_got_typing(GaimConnection *gc, const char *name, int timeout,
-					 int state) {
+					 GaimTypingState state) {
 
 	struct buddy *b;
 	GaimConversation *cnv = gaim_find_conversation(name);
@@ -1230,11 +1229,11 @@
 
 	im = GAIM_IM(c);
 
-	if (im->typing_state == NOT_TYPING)
+	if (im->typing_state == GAIM_NOT_TYPING)
 		return;
 
 	gaim_im_stop_typing_timeout(im);
-	gaim_im_set_typing_state(im, NOT_TYPING);
+	gaim_im_set_typing_state(im, GAIM_NOT_TYPING);
 	gaim_im_update_typing(im);
 
 	b = gaim_find_buddy(gc->account, name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/server.h	Sat Jun 14 23:21:02 2003 +0000
@@ -0,0 +1,107 @@
+/**
+ * @file server.h Server API
+ * @ingroup core
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#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
+
+/*
+ * Really user states are controlled by the PRPLs now. We just
+ * use this for event_away
+ */
+#define UC_UNAVAILABLE  1
+
+#include "account.h"
+#include "conversation.h"
+
+void serv_login(GaimAccount *);
+void serv_close(GaimConnection *);
+void serv_touch_idle(GaimConnection *);
+int  serv_send_im(GaimConnection *, char *, char *, int, int);
+void serv_get_info(GaimConnection *, char *);
+void serv_get_dir(GaimConnection *, char *);
+void serv_set_idle(GaimConnection *, int);
+void serv_set_info(GaimConnection *, char *);
+void serv_set_away(GaimConnection *, char *, char *);
+void serv_set_away_all(char *);
+int  serv_send_typing(GaimConnection *, char *, int);
+void serv_change_passwd(GaimConnection *, const char *, const char *);
+void serv_add_buddy(GaimConnection *, const char *);
+void serv_add_buddies(GaimConnection *, GList *);
+void serv_remove_buddy(GaimConnection *, char *, char *);
+void serv_remove_buddies(GaimConnection *, GList *, char *);
+void serv_add_permit(GaimConnection *, const char *);
+void serv_add_deny(GaimConnection *, const char *);
+void serv_rem_permit(GaimConnection *, const char *);
+void serv_rem_deny(GaimConnection *, const char *);
+void serv_set_permit_deny(GaimConnection *);
+void serv_warn(GaimConnection *, char *, int);
+void serv_set_dir(GaimConnection *, const char *, const char *,
+				  const char *, const char *, const char *,
+				  const char *, const char *, int);
+void serv_dir_search(GaimConnection *, const char *, const char *,
+					 const char *, const char *, const char *, const char *,
+					 const char *, const char *);
+void serv_join_chat(GaimConnection *, GHashTable *);
+void serv_chat_invite(GaimConnection *, int, const char *, const char *);
+void serv_chat_leave(GaimConnection *, int);
+void serv_chat_whisper(GaimConnection *, int, char *, char *);
+int  serv_chat_send(GaimConnection *, int, char *);
+void serv_got_popup(char *, char *, int, int);
+void serv_get_away(GaimConnection *, const char *);
+void serv_alias_buddy(struct buddy *);
+void serv_got_alias(GaimConnection *gc, const char *who, const char *alias);
+void serv_move_buddy(struct buddy *, struct group *, struct group *);
+void serv_rename_group(GaimConnection *, struct group *, const char *);
+void serv_got_eviled(GaimConnection *gc, const char *name, int lev);
+void serv_got_typing(GaimConnection *gc, const char *name, int timeout,
+					 GaimTypingState state);
+void serv_set_buddyicon(GaimConnection *gc, const char *filename);
+void serv_got_typing_stopped(GaimConnection *gc, const char *name);
+void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
+				 guint32 flags, time_t mtime, gint len);
+void serv_got_update(GaimConnection *gc, const char *name, int loggedin,
+					 int evil, time_t signon, time_t idle, int type);
+void serv_finish_login(GaimConnection *gc);
+void serv_got_chat_invite(GaimConnection *gc, const char *name,
+						  const char *who, const char *message,
+						  GHashTable *data);
+GaimConversation *serv_got_joined_chat(GaimConnection *gc,
+									   int id, const char *name);
+void serv_got_chat_left(GaimConnection *g, int id);
+void serv_got_chat_in(GaimConnection *g, int id, char *who,
+					  int whisper, char *message, time_t mtime);
+
+#endif /* _GAIM_SERVER_H_ */
--- a/src/session.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/session.c	Sat Jun 14 23:21:02 2003 +0000
@@ -22,14 +22,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "internal.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "debug.h"
 
-#include <string.h>
+/* XXX */
+extern void do_quit();
 
-#include "gaim.h"
+extern char *opt_rcfile_arg;
 
 #ifdef USE_SM
 
@@ -37,6 +37,7 @@
 #include <X11/SM/SMlib.h>
 #include <unistd.h>
 #include <fcntl.h>
+
 #define ERROR_LENGTH 512
 
 static IceIOErrorHandler ice_installed_io_error_handler;
--- a/src/sound.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/sound.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,18 +18,14 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "internal.h"
 
 #include "sound.h"
 #include "prefs.h"
-#include "gaim.h" /* XXX: this goes away when away messages become sane */
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+/* XXX: this goes away when away messages become sane */
+#include "ui.h"
+
 
 static GaimSoundUiOps *sound_ui_ops = NULL;
 
--- a/src/stock.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/stock.c	Sat Jun 14 23:21:02 2003 +0000
@@ -20,14 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "internal.h"
+
 #include "stock.h"
-#include "core.h"
-#include <gtk/gtk.h>
-#include <string.h>
-
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
 
 static struct StockIcon
 {
--- a/src/themes.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/themes.c	Sat Jun 14 23:21:02 2003 +0000
@@ -18,19 +18,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "internal.h"
 
-#include "gaim.h"
-#include "ui.h"
-#include "gtkimhtml.h"
+#include "conversation.h"
+#include "debug.h"
 #include "prpl.h"
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
+#include "util.h"
 
-#ifdef _WIN32
-#include "win32dep.h"
-#endif
+#include "gtkconv.h"
+#include "gtkimhtml.h"
+
+#include "ui.h"
 
 struct smiley_list {
 	char *sml;
--- a/src/ui.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/ui.h	Sat Jun 14 23:21:02 2003 +0000
@@ -24,6 +24,7 @@
 #ifndef _UI_H_
 #define _UI_H_
 
+#if 0
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -38,7 +39,10 @@
 #include "gtkprefs.h"
 #include "gtkutils.h"
 #include "stock.h"
+#endif
 
+#include "account.h"
+#include "conversation.h"
 
 /**
  * Our UI's identifier.
@@ -99,27 +103,6 @@
 
 } GaimButtonStyle;
 
-/* XXX CUI: save_pos and window_size are used by gaimrc.c which is core.
- * Need to figure out options saving. Same goes for several global variables as well. */
-struct save_pos {
-        int x;
-        int y;
-        int width;
-        int height;
-};
-
-struct window_size {
-	int width;
-	int height;
-	int entry_height;
-};
-
-struct log_conversation {
-	char name[80];
-	char filename[512];
-        struct log_conversation *next;
-};
-
 /* XXX CUI: away messages aren't really anything more than char* but we need two char*'s
  * for the UI so that people can name their away messages when they save them. So these
  * are really a UI function and struct away_message should be removed from the core. */
@@ -158,7 +141,6 @@
 #define EDIT_BUDDY 2
 
 /* Globals in aim.c */
-extern GList *log_conversations; /* this should be moved to conversations.c */
 extern GSList *away_messages; /* this should be moved to away.c */
 extern GtkWidget *mainwindow;
 extern int docklet_count;
@@ -193,9 +175,9 @@
 extern void show_about(GtkWidget *, void *);
 extern void gaim_help(GtkWidget *, void *);
 
-/* Functions in aim.c */
+/* Functions in main.c */
 extern void show_login();
-extern void gaim_setup(GaimConnection *gc);
+extern void gaim_setup(GaimConnection *);
 
 /* Functions in away.c */
 extern void rem_away_mess(GtkWidget *, struct away_message *);
--- a/src/util.c	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/util.c	Sat Jun 14 23:21:02 2003 +0000
@@ -19,45 +19,13 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#else
-#include <direct.h>
-#include <io.h>
-#endif
+#include "internal.h"
 
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef HAVE_ICONV
-#include <iconv.h>
-#endif
-#include <math.h>
-#include "gaim.h"
+#include "conversation.h"
+#include "debug.h"
 #include "prpl.h"
 #include "prefs.h"
 
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#else
-#include "win32dep.h"
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
-#endif
-
 static char home_dir[MAXPATHLEN];
 
 char *full_date()
@@ -1007,144 +975,6 @@
 	return fp;
 }
 
-/* AIM URI's ARE FUN :-D */
-const char *
-handle_uri(char *uri)
-{
-	const char *username;
-	GString *str;
-	GList *conn;
-	GaimConnection *gc = NULL;
-	GaimAccount *account;
-
-	gaim_debug(GAIM_DEBUG_INFO, "handle_uri", "Handling URI: %s\n", uri);
-
-	/* Well, we'd better check to make sure we have at least one
-	   AIM account connected. */
-	for (conn = gaim_connections_get_all(); conn != NULL; conn = conn->next) {
-		gc = conn->data;
-		account = gaim_connection_get_account(gc);
-		username = gaim_account_get_username(account);
-
-		if (gaim_account_get_protocol(account) == GAIM_PROTO_OSCAR &&
-			username != NULL && isalpha(*username)) {
-
-			break;
-		}
-	}
-
-	if (gc == NULL)
-		return _("Not connected to AIM");
-
- 	/* aim:goim?screenname=screenname&message=message */
-	if (!g_ascii_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) {
-		char *who, *what;
-		GaimConversation *c;
-		uri = uri + strlen("aim:goim?");
-		
-		if (!(who = strstr(uri, "screenname="))) {
-			return _("No screenname given.");
-		}
-		/* spaces are encoded as +'s */
-		who = who + strlen("screenname=");
-		str = g_string_new(NULL);
-		while (*who && (*who != '&')) {
-			g_string_append_c(str, *who == '+' ? ' ' : *who);
-			who++;
-		}
-		who = g_strdup(str->str);
-		g_string_free(str, TRUE);
-		
-		what = strstr(uri, "message=");
-		if (what) {
-			what = what + strlen("message=");
-			str = g_string_new(NULL);
-			while (*what && (*what != '&' || !g_ascii_strncasecmp(what, "&amp;", 5))) {
-				g_string_append_c(str, *what == '+' ? ' ' : *what);
-				what++;
-			}
-			what = g_strdup(str->str);
-			g_string_free(str, TRUE);
-		}
-
-		c = gaim_conversation_new(GAIM_CONV_IM, gc->account, who);
-		g_free(who);
-
-		if (what) {
-			GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(c);
-
-			gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, what, -1);
-			g_free(what);
-		}
-	} else if (!g_ascii_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) {
-		char *who, *group;
-		uri = uri + strlen("aim:addbuddy?");
-		/* spaces are encoded as +'s */
-
-		if (!(who = strstr(uri, "screenname="))) {
-			return _("No screenname given.");
-		}
-		who = who + strlen("screenname=");
-		str = g_string_new(NULL);
-		while (*who && (*who != '&')) {
-			g_string_append_c(str, *who == '+' ? ' ' : *who);
-			who++;
-		}
-		who = g_strdup(str->str);
-		g_string_free(str, TRUE);
-
-		group = strstr(uri, "group=");
-		if (group) {
-			group = group + strlen("group=");
-			str = g_string_new(NULL);
-			while (*group && (*group != '&' || !g_ascii_strncasecmp(group, "&amp;", 5))) {
-				g_string_append_c(str, *group == '+' ? ' ' : *group);
-				group++;
-			}
-			group = g_strdup(str->str);
-			g_string_free(str, TRUE);
-		}
-
-		gaim_debug(GAIM_DEBUG_MISC, "handle_uri", "who: %s\n", who);
-		show_add_buddy(gc, who, group, NULL);
-		g_free(who);
-		if (group)
-			g_free(group);
-	} else if (!g_ascii_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) {
-		char *room;
-		GHashTable *components;
-		int exch = 5;
-		
-		uri = uri + strlen("aim:gochat?");
-		/* spaces are encoded as +'s */
-		
-		if (!(room = strstr(uri, "roomname="))) {
-			return _("No roomname given.");
-		}
-		room = room + strlen("roomname=");
-		str = g_string_new(NULL);
-		while (*room && (*room != '&')) {
-			g_string_append_c(str, *room == '+' ? ' ' : *room);
-			room++;
-		}
-		room = g_strdup(str->str);
-		g_string_free(str, TRUE);
-		components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
-				g_free);
-		g_hash_table_replace(components, g_strdup("room"), room);
-		g_hash_table_replace(components, g_strdup("exchange"),
-				g_strdup_printf("%d", exch));
-
-		serv_join_chat(gc, components);
-		g_hash_table_destroy(components);
-	} else {
-		return _("Invalid AIM URI");
-	}
-	
-	
-	return NULL;
-}
-
 char *gaim_try_conv_to_utf8(const char *str)
 {
 	int converted;
--- a/src/util.h	Sat Jun 14 21:34:31 2003 +0000
+++ b/src/util.h	Sat Jun 14 23:21:02 2003 +0000
@@ -289,19 +289,6 @@
 FILE *gaim_mkstemp(gchar **path);
 
 /**
- * Acts upon an aim: URI.
- *
- * @param uri The URI.
- *
- * @return The response based off the action in the URI.
- */
-const char *handle_uri(char *uri);
-
-/* This guy does its best to convert a string to UTF-8 from an unknown
- * encoding by checking the locale and trying some sane defaults ...
- * if everything fails it returns NULL. */
-
-/**
  * Attempts to convert a string to UTF-8 from an unknown encoding.
  *
  * This function checks the locale and tries sane defaults.