changeset 7107:9220c7490cd1

[gaim-migrate @ 7672] This is a big one: normalize() -> gaim_normalize, linkify_text() -> gaim_markup_linkify(), gaim_get_size_string() -> gaim_str_size_to_units(), and moved clean_pid() to main.c. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 01 Oct 2003 06:17:28 +0000
parents db6bd3e794d8
children 6faeeecab0dc
files plugins/history.c src/account.c src/blist.c src/conversation.c src/dialogs.c src/gtkaccount.c src/gtkconv.c src/gtkft.c src/log.c src/main.c src/pounce.c src/privacy.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/yahoo/yahoo.c src/server.c src/util.c src/util.h
diffstat 18 files changed, 331 insertions(+), 331 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/history.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/plugins/history.c	Wed Oct 01 06:17:28 2003 +0000
@@ -24,7 +24,7 @@
 	struct stat st;
 	FILE *fd;
 	char *userdir = g_strdup(gaim_user_dir());
-	char *logfile = g_strdup_printf("%s.log", normalize(name));
+	char *logfile = g_strdup_printf("%s.log", gaim_normalize(name));
 	char *path = g_build_filename(userdir, "logs", logfile, NULL);
 	char buf[HISTORY_SIZE+1];
 	char *tmp, *tmp2;
@@ -55,7 +55,7 @@
 		options |= GTK_IMHTML_NO_NEWLINE;
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links"))
-		tmp2 = linkify_text(tmp);
+		tmp2 = gaim_markup_linkify(tmp);
 	else
 		tmp2 = g_strdup(tmp);
 
--- a/src/account.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/account.c	Wed Oct 01 06:17:28 2003 +0000
@@ -1526,12 +1526,12 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
-	who = g_strdup(normalize(name));
+	who = g_strdup(gaim_normalize(name));
 
 	for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
 		account = (GaimAccount *)l->data;
 
-		if (!strcmp(normalize(gaim_account_get_username(account)), who)) {
+		if (!strcmp(gaim_normalize(gaim_account_get_username(account)), who)) {
 			if (protocol != -1) {
 				if (gaim_account_get_protocol(account) == protocol)
 					break;
@@ -1557,12 +1557,12 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
-	who = g_strdup(normalize(name));
+	who = g_strdup(gaim_normalize(name));
 
 	for (l = gaim_accounts_get_all(); l != NULL; l = l->next) {
 		account = (GaimAccount *)l->data;
 
-		if (!strcmp(normalize(gaim_account_get_username(account)), who) &&
+		if (!strcmp(gaim_normalize(gaim_account_get_username(account)), who) &&
 			!strcmp(account->protocol_id, protocol_id)) {
 
 			break;
--- a/src/blist.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/blist.c	Wed Oct 01 06:17:28 2003 +0000
@@ -680,7 +680,7 @@
 
 		if(bnode->parent->parent != (GaimBlistNode*)g) {
 			hb = g_new(struct _gaim_hbuddy, 1);
-			hb->name = normalize(buddy->name);
+			hb->name = gaim_normalize(buddy->name);
 			hb->account = buddy->account;
 			hb->group = bnode->parent->parent;
 			g_hash_table_remove(gaimbuddylist->buddies, hb);
@@ -725,7 +725,7 @@
 
 
 	hb = g_new(struct _gaim_hbuddy, 1);
-	hb->name = g_strdup(normalize(buddy->name));
+	hb->name = g_strdup(gaim_normalize(buddy->name));
 	hb->account = buddy->account;
 	hb->group = ((GaimBlistNode*)buddy)->parent->parent;
 
@@ -843,7 +843,7 @@
 				GaimBuddy *b = (GaimBuddy*)bnode;
 
 				struct _gaim_hbuddy *hb = g_new(struct _gaim_hbuddy, 1);
-				hb->name = g_strdup(normalize(b->name));
+				hb->name = g_strdup(gaim_normalize(b->name));
 				hb->account = b->account;
 				hb->group = cnode->parent;
 
@@ -1032,7 +1032,7 @@
 	}
 
 
-	hb.name = normalize(buddy->name);
+	hb.name = gaim_normalize(buddy->name);
 	hb.account = buddy->account;
 	hb.group = ((GaimBlistNode*)buddy)->parent->parent;
 	g_hash_table_remove(gaimbuddylist->buddies, &hb);
@@ -1201,7 +1201,7 @@
 	if (!name)
 		return NULL;
 
-	hb.name = normalize(name);
+	hb.name = gaim_normalize(name);
 	hb.account = account;
 
 	for(group = gaimbuddylist->root; group; group = group->next) {
@@ -1224,7 +1224,7 @@
 	if (!name)
 		return NULL;
 
-	hb.name = normalize(name);
+	hb.name = gaim_normalize(name);
 	hb.account = account;
 	hb.group = (GaimBlistNode*)group;
 
@@ -1244,7 +1244,7 @@
 	if (!name)
 		return NULL;
 
-	hb.name = normalize(name);
+	hb.name = gaim_normalize(name);
 	hb.account = account;
 
 	for(group = gaimbuddylist->root; group; group = group->next) {
--- a/src/conversation.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/conversation.c	Wed Oct 01 06:17:28 2003 +0000
@@ -219,7 +219,7 @@
 	if ((gc->flags & GAIM_CONNECTION_HTML) &&
 		gaim_prefs_get_bool("/core/conversations/send_urls_as_links")) {
 
-		buffy = linkify_text(buf);
+		buffy = gaim_markup_linkify(buf);
 	}
 	else
 		buffy = g_strdup(buf);
@@ -1289,12 +1289,12 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
-	cuser = g_strdup(normalize(name));
+	cuser = g_strdup(gaim_normalize(name));
 
 	for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
 		c = (GaimConversation *)cnv->data;
 
-		if (!gaim_utf8_strcasecmp(cuser, normalize(gaim_conversation_get_name(c))))
+		if (!gaim_utf8_strcasecmp(cuser, gaim_normalize(gaim_conversation_get_name(c))))
 			break;
 
 		c = NULL;
@@ -1315,13 +1315,13 @@
 
 	g_return_val_if_fail(name != NULL, NULL);
 
-	cuser = g_strdup(normalize(name));
+	cuser = g_strdup(gaim_normalize(name));
 
 	for (cnv = gaim_get_conversations(); cnv != NULL; cnv = cnv->next) {
 		c = (GaimConversation *)cnv->data;
 
 		if (!gaim_utf8_strcasecmp(cuser,
-								  normalize(gaim_conversation_get_name(c))) &&
+								  gaim_normalize(gaim_conversation_get_name(c))) &&
 			account == gaim_conversation_get_account(c)) {
 
 			break;
@@ -1826,11 +1826,11 @@
 		char *str;
 		const char *disp;
 
-		str = g_strdup(normalize(who));
+		str = g_strdup(gaim_normalize(who));
 		disp = gaim_connection_get_display_name(gc);
 
-		if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) ||
-			(disp && !gaim_utf8_strcasecmp(str, normalize(disp)))) {
+		if (!gaim_utf8_strcasecmp(str, gaim_normalize(gaim_account_get_username(account))) ||
+			(disp && !gaim_utf8_strcasecmp(str, gaim_normalize(disp)))) {
 
 			flags |= GAIM_MESSAGE_SEND;
 		}
--- a/src/dialogs.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/dialogs.c	Wed Oct 01 06:17:28 2003 +0000
@@ -553,7 +553,7 @@
 	char *who;
 
 	if (resp == GTK_RESPONSE_OK) {
-		who = g_strdup(normalize(gtk_entry_get_text(GTK_ENTRY(info->entry))));
+		who = g_strdup(gaim_normalize(gtk_entry_get_text(GTK_ENTRY(info->entry))));
 
 		if (!g_ascii_strcasecmp(who, "")) {
 			g_free(who);
@@ -966,7 +966,7 @@
 			GTK_FILE_SELECTION(gtkconv->dialogs.log));
 
 		g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s.log",
-				   gaim_home_dir(), normalize(c->name));
+				   gaim_home_dir(), gaim_normalize(c->name));
 		g_object_set_data(G_OBJECT(gtkconv->dialogs.log), "dialog_type",
 								 "log dialog");
 		gtk_file_selection_set_filename(GTK_FILE_SELECTION(gtkconv->dialogs.log),
@@ -1876,7 +1876,7 @@
 	name = g_object_get_data(G_OBJECT(filesel), "name");
 	tmp = gaim_user_dir();
 	g_snprintf(filename, PATHSIZE, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp,
-		   name ? normalize(name) : "system", name ? ".log" : "");
+		   name ? gaim_normalize(name) : "system", name ? ".log" : "");
 
 	file = (const char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel));
 	strncpy(path, file, PATHSIZE - 1);
@@ -1914,7 +1914,7 @@
 	gchar buf[BUF_LEN];
 
 	g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S "%s%s", gaim_home_dir(),
-		   name ? normalize(name) : "system", name ? ".log" : "");
+		   name ? gaim_normalize(name) : "system", name ? ".log" : "");
 
 	filesel = gtk_file_selection_new(_("Save Log File"));
 	g_signal_connect(G_OBJECT(filesel), "delete_event",
@@ -1943,7 +1943,7 @@
 
 	tmp = gaim_user_dir();
 	g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp,
-		   name ? normalize(name) : "system", name ? ".log" : "");
+		   name ? gaim_normalize(name) : "system", name ? ".log" : "");
 
 	if ((remove(filename)) == -1) {
 		g_snprintf(buf, 256, _("Couldn't remove file %s." ), filename);
@@ -2012,7 +2012,7 @@
 
 	if (view->name) {
 		char *tmp = gaim_user_dir();
-		g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(view->name));
+		g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, gaim_normalize(view->name));
 	} else {
 		char *tmp = gaim_user_dir();
 		g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "system", tmp);
@@ -2188,7 +2188,7 @@
 
 	if (name) {
 		char *tmp = gaim_user_dir();
-		g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, normalize(name));
+		g_snprintf(filename, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s.log", tmp, gaim_normalize(name));
 		if ((fp = fopen(filename, "r")) == NULL) {
 			g_snprintf(buf, BUF_LONG, _("Couldn't open log file %s."), filename);
 			gaim_notify_error(NULL, NULL, buf, strerror(errno));
--- a/src/gtkaccount.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/gtkaccount.c	Wed Oct 01 06:17:28 2003 +0000
@@ -273,7 +273,7 @@
 	width = gdk_pixbuf_get_width(pixbuf);
 	height = gdk_pixbuf_get_height(pixbuf);
 	basename = g_path_get_basename(filename);
-	size = gaim_get_size_string(st.st_size);
+	size = gaim_str_size_to_units(st.st_size);
 	markup = g_strdup_printf(_("<b>File:</b> %s\n"
 							   "<b>File size:</b> %s\n"
 							   "<b>Image size:</b> %dx%d"),
--- a/src/gtkconv.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/gtkconv.c	Wed Oct 01 06:17:28 2003 +0000
@@ -2781,7 +2781,7 @@
 	window = gtk_file_selection_new(_("Gaim - Save Conversation"));
 
 	g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log",
-			   gaim_home_dir(), normalize(c->name));
+			   gaim_home_dir(), gaim_normalize(c->name));
 	gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
 	g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
 			"gaim_conversation", c);
--- a/src/gtkft.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/gtkft.c	Wed Oct 01 06:17:28 2003 +0000
@@ -758,8 +758,8 @@
 
 	type = gaim_xfer_get_type(xfer);
 
-	size_str      = gaim_get_size_string(gaim_xfer_get_size(xfer));
-	remaining_str = gaim_get_size_string(gaim_xfer_get_bytes_remaining(xfer));
+	size_str      = gaim_str_size_to_units(gaim_xfer_get_size(xfer));
+	remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer));
 
 	pixbuf = gtk_widget_render_icon(dialog->window,
 									(type == GAIM_XFER_RECEIVE
@@ -876,8 +876,8 @@
 	if ((data = GAIM_GTKXFER(xfer)) == NULL)
 		return;
 
-	size_str      = gaim_get_size_string(gaim_xfer_get_size(xfer));
-	remaining_str = gaim_get_size_string(gaim_xfer_get_bytes_remaining(xfer));
+	size_str      = gaim_str_size_to_units(gaim_xfer_get_size(xfer));
+	remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer));
 
 	gtk_list_store_set(xfer_dialog->model, &data->iter,
 					   COLUMN_PROGRESS, gaim_xfer_get_progress(xfer),
@@ -1102,7 +1102,7 @@
 
 	size = gaim_xfer_get_size(xfer);
 
-	size_buf = gaim_get_size_string(size);
+	size_buf = gaim_str_size_to_units(size);
 
 	buf = g_strdup_printf(_("%s wants to send you %s (%s)"),
 						  xfer->who, gaim_xfer_get_filename(xfer), size_buf);
--- a/src/log.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/log.c	Wed Oct 01 06:17:28 2003 +0000
@@ -47,11 +47,11 @@
 	struct log_conversation *l;
 
 
-	strcpy(pname, normalize(name));
+	strcpy(pname, gaim_normalize(name));
 
 	while (lc) {
 		l = (struct log_conversation *)lc->data;
-		if (!gaim_utf8_strcasecmp(pname, normalize(l->name))) {
+		if (!gaim_utf8_strcasecmp(pname, gaim_normalize(l->name))) {
 			g_free(pname);
 			return l;
 		}
@@ -215,7 +215,7 @@
 		return fd;
 	}
 
-	g_snprintf(realname, sizeof(realname), "%s.log", normalize(name));
+	g_snprintf(realname, sizeof(realname), "%s.log", gaim_normalize(name));
 	fd = open_gaim_log_file(realname, &flag);
 
 	if (fd && flag) {	/* is a new file */
--- a/src/main.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/main.c	Wed Oct 01 06:17:28 2003 +0000
@@ -354,6 +354,24 @@
 
 }
 
+static void
+clean_pid(void)
+{
+#ifndef _WIN32
+	int status;
+	pid_t pid;
+
+	do {
+		pid = waitpid(-1, &status, WNOHANG);
+	} while (pid != 0 && pid != (pid_t)-1);
+	if(pid == (pid_t)-1 && errno != ECHILD) {
+		char errmsg[BUFSIZ];
+		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
+		perror(errmsg);
+	}
+#endif
+}
+
 #if HAVE_SIGNAL_H
 void sighandler(int sig)
 {
--- a/src/pounce.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/pounce.c	Wed Oct 01 06:17:28 2003 +0000
@@ -372,7 +372,7 @@
 	g_return_if_fail(pouncee != NULL);
 	g_return_if_fail(events  != GAIM_POUNCE_NONE);
 
-	norm_pouncee = g_strdup(normalize(pouncee));
+	norm_pouncee = g_strdup(gaim_normalize(pouncee));
 
 	for (l = gaim_pounces_get_all(); l != NULL; l = l_next)
 	{
@@ -381,7 +381,7 @@
 
 		if ((gaim_pounce_get_events(pounce) & events) &&
 			(gaim_pounce_get_pouncer(pounce) == pouncer) &&
-			!gaim_utf8_strcasecmp(normalize(gaim_pounce_get_pouncee(pounce)),
+			!gaim_utf8_strcasecmp(gaim_normalize(gaim_pounce_get_pouncee(pounce)),
 								  norm_pouncee))
 		{
 			handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type);
@@ -419,7 +419,7 @@
 
 		if ((gaim_pounce_get_events(pounce) & events) &&
 			(gaim_pounce_get_pouncer(pounce) == pouncer) &&
-			!gaim_utf8_strcasecmp(normalize(gaim_pounce_get_pouncee(pounce)),
+			!gaim_utf8_strcasecmp(gaim_normalize(gaim_pounce_get_pouncee(pounce)),
 								  norm_pouncee))
 		{
 			break;
--- a/src/privacy.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/privacy.c	Wed Oct 01 06:17:28 2003 +0000
@@ -37,10 +37,10 @@
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	name = g_strdup(normalize(who));
+	name = g_strdup(gaim_normalize(who));
 
 	for (l = account->permit; l != NULL; l = l->next) {
-		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
+		if (!gaim_utf8_strcasecmp(name, gaim_normalize((char *)l->data)))
 			break;
 	}
 
@@ -72,10 +72,10 @@
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	name = g_strdup(normalize(who));
+	name = g_strdup(gaim_normalize(who));
 
 	for (l = account->permit; l != NULL; l = l->next) {
-		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
+		if (!gaim_utf8_strcasecmp(name, gaim_normalize((char *)l->data)))
 			break;
 	}
 
@@ -108,10 +108,10 @@
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	name = g_strdup(normalize(who));
+	name = g_strdup(gaim_normalize(who));
 
 	for (l = account->deny; l != NULL; l = l->next) {
-		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
+		if (!gaim_utf8_strcasecmp(name, gaim_normalize((char *)l->data)))
 			break;
 	}
 
@@ -143,10 +143,10 @@
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	name = g_strdup(normalize(who));
+	name = g_strdup(gaim_normalize(who));
 
 	for (l = account->deny; l != NULL; l = l->next) {
-		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
+		if (!gaim_utf8_strcasecmp(name, gaim_normalize((char *)l->data)))
 			break;
 	}
 
--- a/src/protocols/oscar/oscar.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Oct 01 06:17:28 2003 +0000
@@ -1792,10 +1792,10 @@
 	if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn))
 		gaim_connection_set_display_name(gc, info->sn);
 
-	bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn));
+	bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(info->sn));
 	if (!bi) {
 		bi = g_new0(struct buddyinfo, 1);
-		g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi);
+		g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(info->sn)), bi);
 	}
 	bi->typingnot = FALSE;
 	bi->ico_informed = FALSE;
@@ -1839,7 +1839,7 @@
 			while (cur && aim_sncmp((char *)cur->data, info->sn))
 				cur = cur->next;
 			if (!cur) {
-				od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn)));
+				od->requesticon = g_slist_append(od->requesticon, strdup(gaim_normalize(info->sn)));
 				if (od->icontimer)
 					g_source_remove(od->icontimer);
 				od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc);
@@ -1866,7 +1866,7 @@
 
 	serv_got_update(gc, info->sn, 0, 0, 0, 0, 0);
 
-	g_hash_table_remove(od->buddyinfo, normalize(info->sn));
+	g_hash_table_remove(od->buddyinfo, gaim_normalize(info->sn));
 
 	return 1;
 }
@@ -2162,10 +2162,10 @@
 	struct buddyinfo *bi;
 	const char *iconfile;
 
-	bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn));
+	bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(userinfo->sn));
 	if (!bi) {
 		bi = g_new0(struct buddyinfo, 1);
-		g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi);
+		g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(userinfo->sn)), bi);
 	}
 
 	if (args->icbmflags & AIM_IMFLAGS_AWAY)
@@ -4190,7 +4190,7 @@
 		GSList *list;
 		for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next);
 		if (!list) {
-			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name));
+			struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(name));
 			if (bi && bi->typingnot) {
 				if (typing == GAIM_TYPING)
 					aim_im_sendmtn(od->sess, 0x0001, name, 0x0002);
@@ -4227,10 +4227,10 @@
 		struct stat st;
 		gsize len;
 
-		bi = g_hash_table_lookup(od->buddyinfo, normalize(name));
+		bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(name));
 		if (!bi) {
 			bi = g_new0(struct buddyinfo, 1);
-			g_hash_table_insert(od->buddyinfo, g_strdup(normalize(name)), bi);
+			g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(name)), bi);
 		}
 
 		args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
@@ -5362,7 +5362,7 @@
 static char *oscar_tooltip_text(GaimBuddy *b) {
 	GaimConnection *gc = b->account->gc;
 	struct oscar_data *od = gc->proto_data;
-	struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
+	struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->name));
 	aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name);
 	gchar *tmp = NULL, *ret = g_strdup("");
 
@@ -5458,7 +5458,7 @@
 		else
 			ret = g_strdup(_("Away"));
 	} else if (GAIM_BUDDY_IS_ONLINE(b)) {
-		struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name));
+		struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->name));
 		if (bi->availmsg)
 			ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
 	} else {
--- a/src/protocols/toc/toc.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/protocols/toc/toc.c	Wed Oct 01 06:17:28 2003 +0000
@@ -634,7 +634,7 @@
 		else
 			password = g_strdup(gaim_account_get_password(gc->account));
 		g_snprintf(snd, sizeof snd, "toc_signon %s %d  %s %s %s \"%s\"",
-			   AUTH_HOST, AUTH_PORT, normalize(username),
+			   AUTH_HOST, AUTH_PORT, gaim_normalize(username),
 			   roast_password(password), LANGUAGE, REVISION);
 		g_free(password);
 		if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
@@ -702,7 +702,7 @@
 			tdt->state = STATE_ONLINE;
 			g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
 				   AUTH_HOST, AUTH_PORT,
-				   normalize(gaim_account_get_username(gc->account)),
+				   gaim_normalize(gaim_account_get_username(gc->account)),
 				   roast_password(gaim_account_get_password(gc->account)),
 				   LANGUAGE, REVISION);
 			if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
@@ -779,8 +779,8 @@
 		} else
 			time_idle = 0;
 
-		tmp = g_strdup(normalize(gaim_account_get_username(gc->account)));
-		if (!strcmp(tmp, normalize(c)))
+		tmp = g_strdup(gaim_normalize(gaim_account_get_username(gc->account)));
+		if (!strcmp(tmp, gaim_normalize(c)))
 			gaim_connection_set_display_name(gc, c);
 		g_free(tmp);
 
@@ -1067,7 +1067,7 @@
 		g_free(buf1);
 		return -E2BIG;
 	}
-	buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", normalize(name), buf1, 
+	buf2 = g_strdup_printf("toc_send_im %s \"%s\"%s", gaim_normalize(name), buf1, 
 						   ((flags & GAIM_IM_AUTO_RESP) ? " auto" : ""));
 	g_free(buf1);
 #else
@@ -1091,7 +1091,7 @@
 		return -E2BIG;
 	}
 
-	buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", normalize(name), buf1, 
+	buf2 = g_strdup_printf("toc2_send_im_enc %s F U en \"%s\" %s", gaim_normalize(name), buf1, 
 						   ((flags & GAIM_IM_AUTO_RESP) ? "auto" : ""));
 	g_free(buf1);
 #endif
@@ -1114,14 +1114,14 @@
 static void toc_get_info(GaimConnection *g, const char *name)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
+	g_snprintf(buf, MSG_LEN, "toc_get_info %s", gaim_normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
 static void toc_get_dir(GaimConnection *g, const char *name)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
+	g_snprintf(buf, MSG_LEN, "toc_get_dir %s", gaim_normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
@@ -1187,7 +1187,7 @@
 static void toc_add_buddy(GaimConnection *g, const char *name, GaimGroup *group)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
+	g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", gaim_normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 	toc_set_config(g);
 }
@@ -1199,11 +1199,11 @@
 
 	n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
 	while (buddies) {
-		if (strlen(normalize(buddies->data)) + n + 32 > MSG_LEN) {
+		if (strlen(gaim_normalize(buddies->data)) + n + 32 > MSG_LEN) {
 			sflap_send(g, buf, -1, TYPE_DATA);
 			n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
 		}
-		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
+		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(buddies->data));
 		buddies = buddies->next;
 	}
 	sflap_send(g, buf, -1, TYPE_DATA);
@@ -1212,7 +1212,7 @@
 static void toc_remove_buddy(GaimConnection *g, const char *name, const char *group)
 {
 	char buf[BUF_LEN * 2];
-	g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
+	g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", gaim_normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 	toc_set_config(g);
 }
@@ -1224,11 +1224,11 @@
 
 	n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy");
 	while (buddies) {
-		if (strlen(normalize(buddies->data)) + n + 32 > MSG_LEN) {
+		if (strlen(gaim_normalize(buddies->data)) + n + 32 > MSG_LEN) {
 			sflap_send(g, buf, -1, TYPE_DATA);
 			n = g_snprintf(buf, sizeof(buf), "toc_remove_buddy");
 		}
-		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
+		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", gaim_normalize(buddies->data));
 		buddies = buddies->next;
 	}
 	sflap_send(g, buf, -1, TYPE_DATA);
@@ -1293,7 +1293,7 @@
 {
 	char buf[BUF_LONG];
 	g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id,
-			message ? message : "", normalize(name));
+			message ? message : "", gaim_normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
@@ -1328,7 +1328,7 @@
 {
 	char *buf1, *buf2;
 	buf1 = escape_text(message);
-	buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, normalize(who), buf1);
+	buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, gaim_normalize(who), buf1);
 	g_free(buf1);
 	sflap_send(g, buf2, -1, TYPE_DATA);
 	g_free(buf2);
@@ -1411,7 +1411,7 @@
 	char buf2[BUF_LEN * 2];
 	if (gc->account->perm_deny != 3)
 		return;
-	g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who));
+	g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", gaim_normalize(who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1421,7 +1421,7 @@
 	char buf2[BUF_LEN * 2];
 	if (gc->account->perm_deny != 4)
 		return;
-	g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", normalize(who));
+	g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", gaim_normalize(who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 	toc_set_config(gc);
 }
@@ -1458,7 +1458,7 @@
 		at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
 		list = gc->account->permit;
 		while (list) {
-			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
+			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", gaim_normalize(list->data));
 			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
@@ -1476,7 +1476,7 @@
 		at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
 		list = gc->account->deny;
 		while (list) {
-			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
+			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", gaim_normalize(list->data));
 			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
--- a/src/protocols/yahoo/yahoo.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Wed Oct 01 06:17:28 2003 +0000
@@ -848,7 +848,7 @@
 {
 	struct yahoo_packet *pack;
 	GaimAccount *account = gaim_connection_get_account(gc);
-	const char *name = normalize(gaim_account_get_username(account));
+	const char *name = gaim_normalize(gaim_account_get_username(account));
 	const char *pass = gaim_account_get_password(account);
 	struct yahoo_data *yd = gc->proto_data;
 
@@ -966,7 +966,7 @@
 {
 	struct yahoo_packet *pack = NULL;
 	GaimAccount *account = gaim_connection_get_account(gc);
-	const char *name = normalize(gaim_account_get_username(account));
+	const char *name = gaim_normalize(gaim_account_get_username(account));
 	const char *pass = gaim_account_get_password(account);
 	struct yahoo_data *yd = gc->proto_data;
 
@@ -1732,7 +1732,7 @@
 
 	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0);
 
-	yahoo_packet_hash(pkt, 1, normalize(gaim_account_get_username(gaim_connection_get_account(gc))));
+	yahoo_packet_hash(pkt, 1, gaim_normalize(gaim_account_get_username(gaim_connection_get_account(gc))));
 	yahoo_send_packet(yd, pkt);
 
 	yahoo_packet_free(pkt);
--- a/src/server.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/server.c	Wed Oct 01 06:17:28 2003 +0000
@@ -878,7 +878,7 @@
 	 * "We're not worthy! We're not worthy!"
 	 */
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links")) {
-		buffy = linkify_text(message);
+		buffy = gaim_markup_linkify(message);
 		g_free(message);
 		message = buffy;
 	}
@@ -1093,9 +1093,9 @@
 	if (signon && (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->options &
 				   OPT_PROTO_CORRECT_TIME)) {
 
-		char *tmp = g_strdup(normalize(name));
+		char *tmp = g_strdup(gaim_normalize(name));
 		if (!gaim_utf8_strcasecmp(tmp,
-				normalize(gaim_account_get_username(account)))) {
+				gaim_normalize(gaim_account_get_username(account)))) {
 
 			gc->evil = evil;
 			gc->login_time_official = signon;
@@ -1485,7 +1485,7 @@
 
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_urls_as_links"))
-		buf = linkify_text(message);
+		buf = gaim_markup_linkify(message);
 	else
 		buf = g_strdup(message);
 
--- a/src/util.c	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/util.c	Wed Oct 01 06:17:28 2003 +0000
@@ -138,214 +138,6 @@
 	return ret;
 }
 
-char *linkify_text(const char *text)
-{
-	const char *c, *t, *q = NULL;
-	char *tmp;
-	char url_buf[BUF_LEN * 4];
-	GString *ret = g_string_new("");
-	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
-
-	c = text;
-	while (*c) {
-		if(!q && (*c == '\"' || *c == '\'')) {
-			q = c;
-		} else if(q) {
-			if(*c == *q)
-				q = NULL;
-		} else if (!g_ascii_strncasecmp(c, "<A", 2)) {
-			while (1) {
-				if (!g_ascii_strncasecmp(c, "/A>", 3)) {
-					break;
-				}
-				ret = g_string_append_c(ret, *c);
-				c++;
-				if (!(*c))
-					break;
-			}
-		} else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) ||
-					(!g_ascii_strncasecmp(c, "https://", 8)))) {
-			t = c;
-			while (1) {
-				if (badchar(*t)) {
-
-					if (*(t) == ',' && (*(t + 1) != ' ')) {
-						t++;
-						continue;
-					}
-
-					if (*(t - 1) == '.')
-						t--;
-					strncpy(url_buf, c, t - c);
-					url_buf[t - c] = 0;
-					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
-							url_buf, url_buf);
-					c = t;
-					break;
-				}
-				if (!t)
-					break;
-				t++;
-
-			}
-		} else if (!g_ascii_strncasecmp(c, "www.", 4)) {
-			if (c[4] != '.') {
-				t = c;
-				while (1) {
-					if (badchar(*t)) {
-						if (t - c == 4) {
-							break;
-						}
-
-						if (*(t) == ',' && (*(t + 1) != ' ')) {
-							t++;
-							continue;
-						}
-
-						if (*(t - 1) == '.')
-							t--;
-						strncpy(url_buf, c, t - c);
-						url_buf[t - c] = 0;
-						g_string_append_printf(ret,
-								"<A HREF=\"http://%s\">%s</A>", url_buf,
-								url_buf);
-						c = t;
-						break;
-					}
-					if (!t)
-						break;
-					t++;
-				}
-			}
-		} else if (!g_ascii_strncasecmp(c, "ftp://", 6)) {
-			t = c;
-			while (1) {
-				if (badchar(*t)) {
-					if (*(t - 1) == '.')
-						t--;
-					strncpy(url_buf, c, t - c);
-					url_buf[t - c] = 0;
-					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
-							url_buf, url_buf);
-					c = t;
-					break;
-				}
-				if (!t)
-					break;
-				t++;
-
-			}
-		} else if (!g_ascii_strncasecmp(c, "ftp.", 4)) {
-			if (c[4] != '.') {
-				t = c;
-				while (1) {
-					if (badchar(*t)) {
-						if (t - c == 4) {
-							break;
-						}
-						if (*(t - 1) == '.')
-							t--;
-						strncpy(url_buf, c, t - c);
-						url_buf[t - c] = 0;
-						g_string_append_printf(ret,
-								"<A HREF=\"ftp://%s\">%s</A>", url_buf,
-								url_buf);
-						c = t;
-						break;
-					}
-					if (!t)
-						break;
-					t++;
-				}
-			}
-		} else if (!g_ascii_strncasecmp(c, "mailto:", 7)) {
-			t = c;
-			while (1) {
-				if (badchar(*t)) {
-					if (*(t - 1) == '.')
-						t--;
-					strncpy(url_buf, c, t - c);
-					url_buf[t - c] = 0;
-					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
-							  url_buf, url_buf);
-					c = t;
-					break;
-				}
-				if (!t)
-					break;
-				t++;
-
-			}
-		} else if (c != text && (*c == '@')) {
-			char *tmp;
-			int flag;
-			int len = 0;
-			const char illegal_chars[] = "!@#$%^&*()[]{}/|\\<>\":;\r\n \0";
-			url_buf[0] = 0;
-
-			if (strchr(illegal_chars,*(c - 1)) || strchr(illegal_chars, *(c + 1)))
-				flag = 0;
-			else
-				flag = 1;
-
-			t = c;
-			while (flag) {
-				if (badchar(*t)) {
-					ret = g_string_truncate(ret, ret->len - (len - 1));
-					break;
-				} else {
-					len++;
-					tmp = g_malloc(len + 1);
-					tmp[len] = 0;
-					tmp[0] = *t;
-					strncpy(tmp + 1, url_buf, len - 1);
-					strcpy(url_buf, tmp);
-					url_buf[len] = 0;
-					g_free(tmp);
-					t--;
-					if (t < text) {
-						ret = g_string_assign(ret, "");
-						break;
-					}
-				}
-			}
-
-			t = c + 1;
-
-			while (flag) {
-				if (badchar(*t)) {
-					char *d;
-
-					for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--)
-						*d = '\0';
-
-					g_string_append_printf(ret, "<A HREF=\"mailto:%s\">%s</A>",
-							url_buf, url_buf);
-					c = t;
-
-					break;
-				} else {
-					strncat(url_buf, t, 1);
-					len++;
-					url_buf[len] = 0;
-				}
-
-				t++;
-			}
-		}
-
-		if (*c == 0)
-			break;
-
-		ret = g_string_append_c(ret, *c);
-		c++;
-
-	}
-	tmp = ret->str;
-	g_string_free(ret, FALSE);
-	return tmp;
-}
-
 
 static const char alphabet[] =
 	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@@ -502,7 +294,7 @@
 	return len/2;
 }
 
-char *normalize(const char *s)
+char *gaim_normalize(const char *s)
 {
 	static char buf[BUF_LEN];
 	char *tmp;
@@ -537,24 +329,6 @@
 	return date;
 }
 
-void clean_pid(void)
-{
-#ifndef _WIN32
-	int status;
-	pid_t pid;
-
-	do {
-		pid = waitpid(-1, &status, WNOHANG);
-	} while (pid != 0 && pid != (pid_t)-1);
-	if(pid == (pid_t)-1 && errno != ECHILD) {
-		char errmsg[BUFSIZ];
-		snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
-		perror(errmsg);
-	}
-#endif
-}
-
-
 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date,
    or time */
 char *away_subs(const char *msg, const char *name)
@@ -1004,7 +778,8 @@
 	return ret;
 }
 
-char *gaim_get_size_string(size_t size)
+char *
+gaim_str_size_to_units(size_t size)
 {
 	static const char *size_str[4] = { "bytes", "KB", "MB", "GB" };
 	float size_mag;
@@ -1611,6 +1386,215 @@
 	return str2;
 }
 
+char *
+gaim_markup_linkify(const char *text)
+{
+	const char *c, *t, *q = NULL;
+	char *tmp;
+	char url_buf[BUF_LEN * 4];
+	GString *ret = g_string_new("");
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
+
+	c = text;
+	while (*c) {
+		if(!q && (*c == '\"' || *c == '\'')) {
+			q = c;
+		} else if(q) {
+			if(*c == *q)
+				q = NULL;
+		} else if (!g_ascii_strncasecmp(c, "<A", 2)) {
+			while (1) {
+				if (!g_ascii_strncasecmp(c, "/A>", 3)) {
+					break;
+				}
+				ret = g_string_append_c(ret, *c);
+				c++;
+				if (!(*c))
+					break;
+			}
+		} else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) ||
+					(!g_ascii_strncasecmp(c, "https://", 8)))) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
+
+					if (*(t) == ',' && (*(t + 1) != ' ')) {
+						t++;
+						continue;
+					}
+
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
+							url_buf, url_buf);
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
+
+			}
+		} else if (!g_ascii_strncasecmp(c, "www.", 4)) {
+			if (c[4] != '.') {
+				t = c;
+				while (1) {
+					if (badchar(*t)) {
+						if (t - c == 4) {
+							break;
+						}
+
+						if (*(t) == ',' && (*(t + 1) != ' ')) {
+							t++;
+							continue;
+						}
+
+						if (*(t - 1) == '.')
+							t--;
+						strncpy(url_buf, c, t - c);
+						url_buf[t - c] = 0;
+						g_string_append_printf(ret,
+								"<A HREF=\"http://%s\">%s</A>", url_buf,
+								url_buf);
+						c = t;
+						break;
+					}
+					if (!t)
+						break;
+					t++;
+				}
+			}
+		} else if (!g_ascii_strncasecmp(c, "ftp://", 6)) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
+							url_buf, url_buf);
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
+
+			}
+		} else if (!g_ascii_strncasecmp(c, "ftp.", 4)) {
+			if (c[4] != '.') {
+				t = c;
+				while (1) {
+					if (badchar(*t)) {
+						if (t - c == 4) {
+							break;
+						}
+						if (*(t - 1) == '.')
+							t--;
+						strncpy(url_buf, c, t - c);
+						url_buf[t - c] = 0;
+						g_string_append_printf(ret,
+								"<A HREF=\"ftp://%s\">%s</A>", url_buf,
+								url_buf);
+						c = t;
+						break;
+					}
+					if (!t)
+						break;
+					t++;
+				}
+			}
+		} else if (!g_ascii_strncasecmp(c, "mailto:", 7)) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>",
+							  url_buf, url_buf);
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
+
+			}
+		} else if (c != text && (*c == '@')) {
+			char *tmp;
+			int flag;
+			int len = 0;
+			const char illegal_chars[] = "!@#$%^&*()[]{}/|\\<>\":;\r\n \0";
+			url_buf[0] = 0;
+
+			if (strchr(illegal_chars,*(c - 1)) || strchr(illegal_chars, *(c + 1)))
+				flag = 0;
+			else
+				flag = 1;
+
+			t = c;
+			while (flag) {
+				if (badchar(*t)) {
+					ret = g_string_truncate(ret, ret->len - (len - 1));
+					break;
+				} else {
+					len++;
+					tmp = g_malloc(len + 1);
+					tmp[len] = 0;
+					tmp[0] = *t;
+					strncpy(tmp + 1, url_buf, len - 1);
+					strcpy(url_buf, tmp);
+					url_buf[len] = 0;
+					g_free(tmp);
+					t--;
+					if (t < text) {
+						ret = g_string_assign(ret, "");
+						break;
+					}
+				}
+			}
+
+			t = c + 1;
+
+			while (flag) {
+				if (badchar(*t)) {
+					char *d;
+
+					for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--)
+						*d = '\0';
+
+					g_string_append_printf(ret, "<A HREF=\"mailto:%s\">%s</A>",
+							url_buf, url_buf);
+					c = t;
+
+					break;
+				} else {
+					strncat(url_buf, t, 1);
+					len++;
+					url_buf[len] = 0;
+				}
+
+				t++;
+			}
+		}
+
+		if (*c == 0)
+			break;
+
+		ret = g_string_append_c(ret, *c);
+		c++;
+
+	}
+	tmp = ret->str;
+	g_string_free(ret, FALSE);
+	return tmp;
+}
+
 gboolean
 gaim_url_parse(const char *url, char **ret_host, int *ret_port,
 			   char **ret_path)
--- a/src/util.h	Wed Oct 01 05:56:58 2003 +0000
+++ b/src/util.h	Wed Oct 01 06:17:28 2003 +0000
@@ -46,7 +46,7 @@
  *
  * @return A pointer to the normalized version stored in a static buffer.
  */
-char *normalize(const char *str);
+char *gaim_normalize(const char *str);
 
 /**
  * Converts a string to its base-64 equivalent.
@@ -96,11 +96,6 @@
 int gaim_base16_decode(const char *str, unsigned char **ret_str);
 
 /**
- * Waits for all child processes to terminate.
- */
-void clean_pid(void);
-
-/**
  * Returns the current local time in hour:minute:second form.
  *
  * The returned string is stored in a static buffer, so the result
@@ -113,15 +108,6 @@
 char *date(void);
 
 /**
- * Adds the necessary HTML code to turn URIs into HTML links in a string.
- *
- * @param str The string to linkify.
- *
- * @return The linkified text.
- */
-char *linkify_text(const char *str);
-
-/**
  * Converts seconds into a human-readable form.
  *
  * @param sec The seconds.
@@ -319,6 +305,7 @@
  *
  * @param haystack The string to search in.
  * @param needle   The substring to find.
+ *
  * @return the location of the substring if found, or NULL if not
  */
 const char *gaim_strcasestr(const char *haystack, const char *needle);
@@ -328,8 +315,10 @@
  * units (MB, KB, GB, etc.)
  *
  * @param size The size
+ *
+ * @return The string in units form. This must be freed.
  */
-char *gaim_get_size_string(size_t size);
+char *gaim_str_size_to_units(size_t size);
 
 /**
  * Finds a HTML tag matching the given name.
@@ -399,6 +388,15 @@
 char *gaim_markup_strip_html(const char *str);
 
 /**
+ * Adds the necessary HTML code to turn URIs into HTML links in a string.
+ *
+ * @param str The string to linkify.
+ *
+ * @return The linkified text.
+ */
+char *gaim_markup_linkify(const char *str);
+
+/**
  * Parses a URL, returning its host, port, and file path.
  *
  * The returned data must be freed.