changeset 1333:b332d8f46b84

[gaim-migrate @ 1343] oo, a fun new register button. oh yeah, and the buddy list stuff got moved back from toc.c to buddy.c. isn't that nice. now you can remove toc.c and rvous.c, comment out one line in prpl.c, and get rid of toc altogether. but you won't do that. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 20 Dec 2000 13:24:48 +0000
parents bec4de31b3ad
children 475106775b1c
files PRPL src/aim.c src/buddy.c src/oscar.c src/prpl.c src/prpl.h src/toc.c
diffstat 7 files changed, 391 insertions(+), 178 deletions(-) [+]
line wrap: on
line diff
--- a/PRPL	Wed Dec 20 11:36:40 2000 +0000
+++ b/PRPL	Wed Dec 20 13:24:48 2000 +0000
@@ -1,45 +1,88 @@
 Protocol Plugins. What EveryBuddy should have been.
 
-Each PRPL needs to have a unique identifier. In the pre-PRPL system TOC was 0 and Oscar was 1.
-This identifier can be found in prpl.h. They are pre-assigned. PROTO_TOC is still 0, PROTO_OSCAR
-is still 1. The protocol_init function is expected to set the struct's protocol member to the
-appropriate value. If you want to write a new PRPL for gaim, please email one of the maintainers
-with the name of the protocol. We'll then reserve a number for it. Please do not use a number
-that has not been assigned to your protocol.
+Each PRPL needs to have a unique identifier. In the pre-PRPL system TOC
+was 0 and Oscar was 1.  This identifier can be found in prpl.h. They
+are pre-assigned. PROTO_TOC is still 0, PROTO_OSCAR is still 1. The
+protocol_init function is expected to set the struct's protocol member to
+the appropriate value. If you want to write a new PRPL for gaim, please
+email one of the maintainers with the name of the protocol. We'll then
+reserve a number for it. Please do not use a number that has not been
+assigned to your protocol.
 
-The addition of PRPL to gaim means that gaim now supports multiple connections and multiple (and
-dynamically loadable) protocols.
+The addition of PRPL to gaim means that gaim now supports multiple
+connections and multiple (and dynamically loadable) protocols.
 
 ======
 
 I guess I should document how to write a PRPL.
 
-The first thing to do is to write your init function. It should be delcared
+The first thing to do is to write your init function. It should be
+delcared
 
 void my_proto_init(struct prpl *p);
 
 You then fill in the members of the struct. See prpl.h for what they are.
 
-If you're going to load your protocol dynamically, put the function gaim_plugin_init(void *) in the
-file, and have it call
+If you're going to load your protocol dynamically, put the function
+gaim_plugin_init(void *) in the file, and have it call
 
 	load_protocol(my_proto_init);
 
-and return NULL. Then compile as a plugin, load the .so file, and you're set. If you're going to
-load it statically, extern the my_proto_init function, and in prpl.c, call load_protocol.
+and return NULL. Then compile as a plugin, load the .so file, and you're
+set. If you're going to load it statically, extern the my_proto_init
+function, and in prpl.c, call load_protocol.
+
+Your PRPL needs to have a login function, which ideally should set up a
+gdk_input watcher. When you want to indicate that the account is online,
+simply call account_online(struct gaim_connection *).  When there is
+information from the server, you should call the appropriate serv_got
+function (see gaim.h for a (partial?) list).
 
-Your PRPL needs to have a login function, which ideally should set up a gdk_input watcher. When you
-want to indicate that the account is online, simply call account_online(struct gaim_connection *).
-When there is information from the server, you should call the appropriate serv_got function (see
-gaim.h for a (partial?) list).
+When the UI wants to send something via the server, it will call the
+appropriate function that you set in your PRPL, if it's non-NULL. The
+only function that is absolutely critical is name. Without name gaim
+will probably crash. You don't even need login, just name. (You need
+login to do anything useful though.)
+
+======
+
+Erg. Now the fun part. The part that you would have never guessed if you
+weren't me. (I know that you wouldn't have guessed this stuff because
+it isn't painfully obvious to me. Use the Source, Luke.)
 
-When the UI wants to send something via the server, it will call the appropriate function that you set
-in your PRPL, if it's non-NULL. The only function that is absolutely critical is name. Without name
-gaim will probably crash. You don't even need login, just name. (You need login to do anything useful
-though.)
+Let's start with the basics. PRPLs shouldn't use GTK at all. That said,
+they have to in no fewer than three functions: action_menu, user_opts, and
+draw_new_user (probably do_new_user too). Fortunately, all of these are
+optional. Unfortunatly, all of these are so incredibly useful that they
+probably aren't optional.  If you use GTK (other than gdk_input_add/remove
+for the connections) in any function other than these three I will hunt
+you down like the dog you are and kill you. (Oscar and TOC are excused
+temporarily because they existed long before all the other PRPLs.)
+
+You're probably wondering how you can do certain things without GTK. Well,
+you're just going to have to make do. Rely on the UI, that's why it's
+there.	A PRPL should have absolutely ZERO interaction with the user,
+it should all be handled by the UI. So far, about the only thing that's
+been added to gaim to aid in this goal is do_ask_dialog. But at least
+it's a start.
 
-The best example to copy is probably Rob's IRC plugin, in plugins/irc.c. The most important functions
-for gaim interaction are at the bottom (irc_init, gaim_plugin_init, and gaim_plugin_remove). The
-rest of it is the protocol implementation.
+do_ask_dialogs is one of the worst creations ever to come from my ass. It
+must have been very late in the morning, just before I went to sleep,
+when I coded it. That's my excuse.
+
+You pass it the question you want to ask, what to do on Yes, what to
+do on No, and optional data. The logic actually isn't like that at
+all. Given you call do_ask_dialog("Wanna?", mydata, yes_func, no_func),
+the logic is:
 
-Sorry for the formatting. My Eterm is 105 characters wide.
+if (clicked_yes)
+	yes_func();
+no_func();
+
+i.e. no_func() gets called regardless of what's clicked. So
+it's best to use it for freeing mydata, and not freeing mydata in
+yes_func. To be quite honest, I'm not sure no_func is needed. (I
+also seem to think that yes_func isn't entirely necessary either,
+except for the little part about it being the point of do_ask_dialog.)
+
+Um. So that was interesting.
--- a/src/aim.c	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/aim.c	Wed Dec 20 13:24:48 2000 +0000
@@ -294,8 +294,7 @@
 
 	/* Register opens the right URL */
 	gtk_signal_connect(GTK_OBJECT(reg), "clicked",
-			   GTK_SIGNAL_FUNC(open_url),
-			   "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no");
+			   GTK_SIGNAL_FUNC(register_user), NULL);
 	/* Enter in the username clears the password and sets
 	   the pointer in the password field */
 	gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate",
--- a/src/buddy.c	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/buddy.c	Wed Dec 20 13:24:48 2000 +0000
@@ -2396,3 +2396,143 @@
         gtk_widget_show(blist);
 }
 
+void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import)
+{
+	char *c;
+	char current[256];
+	char *name;
+	GList *bud;
+	int how_many = 0;
+
+	bud = NULL;
+
+	if (config != NULL) {
+
+		/* skip "CONFIG:" (if it exists) */
+		c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */, "CONFIG:", strlen("CONFIG:")) ?
+		    strtok(config, "\n") :
+		    strtok(config + 6 /* sizeof(struct sflap_hdr) */ + strlen("CONFIG:"), "\n");
+		do {
+			if (c == NULL)
+				break;
+			if (*c == 'g') {
+				strncpy(current, c + 2, sizeof(current));
+				add_group(gc, current);
+				how_many++;
+			} else if (*c == 'b' && !find_buddy(gc, c + 2)) {
+				char nm[80], sw[80], *tmp = c + 2;
+				int i = 0;
+				while (*tmp != ':' && *tmp)
+					nm[i++] = *tmp++;
+				if (*tmp == ':')
+					*tmp++ = '\0';
+				nm[i] = '\0';
+				i = 0;
+				while (*tmp)
+					sw[i++] = *tmp++;
+				sw[i] = '\0';
+				if (!find_buddy(gc, nm))
+					add_buddy(gc, current, nm, sw);
+				how_many++;
+
+				bud = g_list_append(bud, c + 2);
+			} else if (*c == 'p') {
+				GSList *d = gc->permit;
+				char *n;
+				name = g_malloc(strlen(c + 2) + 2);
+				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
+				n = g_strdup(normalize(name));
+				while (d) {
+					if (!strcasecmp(n, normalize(d->data)))
+						break;
+					d = d->next;
+				}
+				g_free(n);
+				if (!d)
+					gc->permit = g_slist_append(gc->permit, name);
+			} else if (*c == 'd') {
+				GSList *d = gc->deny;
+				char *n;
+				name = g_malloc(strlen(c + 2) + 2);
+				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
+				n = g_strdup(normalize(name));
+				while (d) {
+					if (!strcasecmp(n, normalize(d->data)))
+						break;
+					d = d->next;
+				}
+				g_free(n);
+				if (!d)
+					gc->deny = g_slist_append(gc->deny, name);
+			} else if (!strncmp("toc", c, 3)) {
+				sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
+				debug_printf("permdeny: %d\n", gc->permdeny);
+				if (gc->permdeny == 0)
+					gc->permdeny = 1;
+			} else if (*c == 'm') {
+				sscanf(c + 2, "%d", &gc->permdeny);
+				debug_printf("permdeny: %d\n", gc->permdeny);
+				if (gc->permdeny == 0)
+					gc->permdeny = 1;
+			}
+		} while ((c = strtok(NULL, "\n")));
+#if 0
+		fprintf(stdout, "Sending message '%s'\n", buf);
+#endif
+
+		if (bud != NULL)
+			serv_add_buddies(gc, bud);
+		serv_set_permit_deny(gc);
+		if (blist) {
+			build_edit_tree();
+		}
+	}
+
+	/* perhaps the server dropped the buddy list, try importing from
+	   cache */
+
+	if (how_many == 0 && !from_do_import) {
+		do_import((GtkWidget *)NULL, gc);
+	} else if (gc && (bud_list_cache_exists(gc) == FALSE)) {
+		do_export((GtkWidget *)NULL, 0);
+	}
+}
+
+void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show)
+{
+	GSList *grp = gc->groups;
+	GSList *mem;
+	struct group *g;
+	struct buddy *b;
+	GSList *plist = gc->permit;
+	GSList *dlist = gc->deny;
+
+	int pos = 0;
+
+	if (!gc->permdeny)
+		gc->permdeny = 1;
+
+	pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny);
+	while (grp) {
+		g = (struct group *)grp->data;
+		pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
+		mem = g->members;
+		while (mem) {
+			b = (struct buddy *)mem->data;
+			pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name,
+					  show ? ":" : "", show ? b->show : "");
+			mem = mem->next;
+		}
+		grp = g_slist_next(grp);
+	}
+
+	while (plist) {
+		pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data);
+		plist = plist->next;
+	}
+
+	while (dlist) {
+		pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data);
+		dlist = dlist->next;
+	}
+}
--- a/src/oscar.c	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/oscar.c	Wed Dec 20 13:24:48 2000 +0000
@@ -2239,12 +2239,31 @@
 	}
 }
 
+static void oscar_draw_new_user(GtkWidget *box)
+{
+	GtkWidget *label;
+
+	label = gtk_label_new(_("Unfortunately, currently Oscar only allows new user registration by "
+				"going to http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"
+				". Clicking the Register button will open the URL for you."));
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+}
+
+static void oscar_do_new_user()
+{
+	open_url(NULL, "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no");
+}
+
 void oscar_init(struct prpl *ret) {
 	ret->protocol = PROTO_OSCAR;
 	ret->name = oscar_name;
 	ret->list_icon = oscar_list_icon;
 	ret->action_menu = oscar_action_menu;
 	ret->user_opts = oscar_user_opts;
+	ret->draw_new_user = oscar_draw_new_user;
+	ret->do_new_user = oscar_do_new_user;
 	ret->login = oscar_login;
 	ret->close = oscar_close;
 	ret->send_im = oscar_send_im;
--- a/src/prpl.c	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/prpl.c	Wed Dec 20 13:24:48 2000 +0000
@@ -23,12 +23,18 @@
 
 #include "pixmaps/ok.xpm"
 #include "pixmaps/cancel.xpm"
+#include "pixmaps/close.xpm"
+#include "pixmaps/register.xpm"
 
 extern void toc_init(struct prpl *);
 extern void oscar_init(struct prpl *);
 
 GSList *protocols = NULL;
 
+static GtkWidget *regdialog = NULL;
+static GtkWidget *regbox = NULL;
+static struct prpl *regprpl = NULL;
+
 struct prpl *find_prpl(int prot)
 {
 	GSList *e = protocols;
@@ -58,6 +64,8 @@
 	if ((old = find_prpl(p->protocol)) == NULL)
 		unload_protocol(old);
 	protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
+	if (regdialog)
+		gtk_widget_destroy(regdialog);
 }
 
 void unload_protocol(struct prpl *p)
@@ -84,9 +92,7 @@
 void static_proto_init()
 {
 	load_protocol(toc_init);
-#ifndef DYNAMIC_OSCAR
 	load_protocol(oscar_init);
-#endif
 }
 
 static void des_win(GtkWidget *a, GtkWidget *b)
@@ -94,12 +100,12 @@
 	gtk_widget_destroy(b);
 }
 
-static int rem_win(GtkObject * a, GtkWidget *b)
+static void rem_win(GtkWidget *a, GtkWidget *b)
 {
-	gpointer d = gtk_object_get_user_data(a);
-	gtk_signal_disconnect_by_data(GTK_OBJECT(b), d);
+	void *d = gtk_object_get_user_data(GTK_OBJECT(a));
+	if (d)
+		gtk_signal_disconnect_by_data(GTK_OBJECT(b), d);
 	gtk_widget_destroy(b);
-	return TRUE;
 }
 
 void do_ask_dialog(const char *text, void *data, void *doit, void *dont)
@@ -142,3 +148,126 @@
 
 	gtk_widget_show_all(window);
 }
+
+static void delete_reg(gpointer a, gpointer b)
+{
+	GtkWidget *tmp = regdialog;
+	if (regdialog) {
+		regdialog = NULL;
+		gtk_widget_destroy(tmp);
+	}
+}
+
+static void reg_prpl(gpointer a, struct prpl *p)
+{
+	while (GTK_BOX(regbox)->children)
+		gtk_container_remove(GTK_CONTAINER(regbox),
+				     ((GtkBoxChild *)GTK_BOX(regbox)->children->data)->widget);
+	regprpl = p;
+	(*regprpl->draw_new_user)(regbox);
+}
+
+static void do_reg(gpointer a, gpointer b)
+{
+	if (regprpl->do_new_user)
+		(*regprpl->do_new_user)();
+}
+
+void register_user(gpointer a, gpointer b)
+{
+	GSList *pr = protocols;
+	struct prpl *p = NULL, *q;
+	GtkWidget *box;
+	GtkWidget *frame;
+	GtkWidget *vbox;
+	GtkWidget *hbox;
+	GtkWidget *label;
+	GtkWidget *optmenu;
+	GtkWidget *menu;
+	GtkWidget *opt;
+	GtkWidget *button;
+
+	if (regdialog)
+		return;
+
+	while (pr) {
+		p = pr->data;
+		if (p->draw_new_user)
+			break;
+		pr = pr->next;
+		p = NULL;
+	}
+	if (p == NULL)
+		/* this should never happen because I said so. Hi mom. */
+		return;
+	pr = protocols;
+
+	regdialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+	gtk_window_set_wmclass(GTK_WINDOW(regdialog), "registration", "Gaim");
+	gtk_container_set_border_width(GTK_CONTAINER(regdialog), 5);
+	gtk_window_set_title(GTK_WINDOW(regdialog), _("Gaim - New User Registration"));
+	gtk_signal_connect(GTK_OBJECT(regdialog), "destroy", GTK_SIGNAL_FUNC(delete_reg), NULL);
+	gtk_widget_realize(regdialog);
+	aol_icon(regdialog->window);
+
+	box = gtk_vbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(regdialog), box);
+	gtk_widget_show(box);
+
+	frame = gtk_frame_new(_("New User Registration"));
+	gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5);
+	gtk_widget_show(frame);
+
+	vbox = gtk_vbox_new(FALSE, 5);
+	gtk_container_add(GTK_CONTAINER(frame), vbox);
+	gtk_widget_show(vbox);
+
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	label = gtk_label_new(_("Register new user for"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	optmenu = gtk_option_menu_new();
+	gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 5);
+	gtk_widget_show(optmenu);
+
+	menu = gtk_menu_new();
+
+	while (pr) {
+		q = pr->data;
+		if (q->draw_new_user) {
+			opt = gtk_menu_item_new_with_label((*q->name)());
+			gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(reg_prpl), q);
+			gtk_menu_append(GTK_MENU(menu), opt);
+			gtk_widget_show(opt);
+		}
+		pr = pr->next;
+	}
+
+	gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
+	gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), 0);
+	regprpl = p;
+
+	regbox = gtk_vbox_new(FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(vbox), regbox, FALSE, FALSE, 5);
+	gtk_widget_show(regbox);
+
+	(*regprpl->draw_new_user)(regbox);
+
+	hbox = gtk_hbox_new(FALSE, 5);
+	gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	button = picture_button(regdialog, _("Close"), close_xpm);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(delete_reg), NULL);
+
+	button = picture_button(regdialog, _("Register"), register_xpm);
+	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(do_reg), NULL);
+
+	gtk_widget_show(regdialog);
+}
--- a/src/prpl.h	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/prpl.h	Wed Dec 20 13:24:48 2000 +0000
@@ -43,11 +43,15 @@
 
 	/* returns the XPM associated with the given user class */
 	char **(* list_icon)(int);
-	/* returns a GtkMenu * for use in the buddy list */
+
+	/* when UI plugins come, these will have to be reconciled by returning
+	 * structs indicating what kinds of information they want displayed. */
 	void (* action_menu)(GtkWidget *, struct gaim_connection *, char *);
-	/* fuck UI plugins */
 	void (* user_opts)(GtkWidget *, struct aim_user *);
+	void (* draw_new_user)(GtkWidget *);
+	void (* do_new_user)();
 
+	/* all the server-related functions */
 	void (* login)		(struct aim_user *);
 	void (* close)		(struct gaim_connection *);
 	void (* send_im)	(struct gaim_connection *, char *who, char *message, int away);
@@ -89,7 +93,6 @@
 	void (* chat_leave)	(struct gaim_connection *, int id);
 	void (* chat_whisper)	(struct gaim_connection *, int id, char *who, char *message);
 	void (* chat_send)	(struct gaim_connection *, int id, char *message);
-
 	void (* keepalive)	(struct gaim_connection *);
 };
 
@@ -104,5 +107,7 @@
 
 struct prpl *find_prpl(int);
 
+void register_user(gpointer, gpointer);
+
 void do_ask_dialog(const char *, void *, void *, void *);
 #endif
--- a/src/toc.c	Wed Dec 20 11:36:40 2000 +0000
+++ b/src/toc.c	Wed Dec 20 13:24:48 2000 +0000
@@ -46,7 +46,7 @@
 #include "pixmaps/dt_icon.xpm"
 #include "pixmaps/free_icon.xpm"
 
-#define REVISION "gaim:$Revision: 1320 $"
+#define REVISION "gaim:$Revision: 1343 $"
 
 #define TYPE_SIGNON    1
 #define TYPE_DATA      2
@@ -654,147 +654,6 @@
 	}
 }
 
-void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show)
-{
-	GSList *grp = gc->groups;
-	GSList *mem;
-	struct group *g;
-	struct buddy *b;
-	GSList *plist = gc->permit;
-	GSList *dlist = gc->deny;
-
-	int pos = 0;
-
-	if (!gc->permdeny)
-		gc->permdeny = 1;
-
-	pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny);
-	while (grp) {
-		g = (struct group *)grp->data;
-		pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
-		mem = g->members;
-		while (mem) {
-			b = (struct buddy *)mem->data;
-			pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name,
-					  show ? ":" : "", show ? b->show : "");
-			mem = mem->next;
-		}
-		grp = g_slist_next(grp);
-	}
-
-	while (plist) {
-		pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data);
-		plist = plist->next;
-	}
-
-	while (dlist) {
-		pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data);
-		dlist = dlist->next;
-	}
-}
-
-void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import)
-{
-	char *c;
-	char current[256];
-	char *name;
-	GList *bud;
-	int how_many = 0;
-
-	bud = NULL;
-
-	if (config != NULL) {
-
-		/* skip "CONFIG:" (if it exists) */
-		c = strncmp(config + sizeof(struct sflap_hdr), "CONFIG:", strlen("CONFIG:")) ?
-		    strtok(config, "\n") :
-		    strtok(config + sizeof(struct sflap_hdr) + strlen("CONFIG:"), "\n");
-		do {
-			if (c == NULL)
-				break;
-			if (*c == 'g') {
-				strncpy(current, c + 2, sizeof(current));
-				add_group(gc, current);
-				how_many++;
-			} else if (*c == 'b' && !find_buddy(gc, c + 2)) {
-				char nm[80], sw[80], *tmp = c + 2;
-				int i = 0;
-				while (*tmp != ':' && *tmp)
-					nm[i++] = *tmp++;
-				if (*tmp == ':')
-					*tmp++ = '\0';
-				nm[i] = '\0';
-				i = 0;
-				while (*tmp)
-					sw[i++] = *tmp++;
-				sw[i] = '\0';
-				if (!find_buddy(gc, nm))
-					add_buddy(gc, current, nm, sw);
-				how_many++;
-
-				bud = g_list_append(bud, c + 2);
-			} else if (*c == 'p') {
-				GSList *d = gc->permit;
-				char *n;
-				name = g_malloc(strlen(c + 2) + 2);
-				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
-				n = g_strdup(normalize(name));
-				while (d) {
-					if (!strcasecmp(n, normalize(d->data)))
-						break;
-					d = d->next;
-				}
-				g_free(n);
-				if (!d)
-					gc->permit = g_slist_append(gc->permit, name);
-			} else if (*c == 'd') {
-				GSList *d = gc->deny;
-				char *n;
-				name = g_malloc(strlen(c + 2) + 2);
-				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
-				n = g_strdup(normalize(name));
-				while (d) {
-					if (!strcasecmp(n, normalize(d->data)))
-						break;
-					d = d->next;
-				}
-				g_free(n);
-				if (!d)
-					gc->deny = g_slist_append(gc->deny, name);
-			} else if (!strncmp("toc", c, 3)) {
-				sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
-				debug_printf("permdeny: %d\n", gc->permdeny);
-				if (gc->permdeny == 0)
-					gc->permdeny = 1;
-			} else if (*c == 'm') {
-				sscanf(c + 2, "%d", &gc->permdeny);
-				debug_printf("permdeny: %d\n", gc->permdeny);
-				if (gc->permdeny == 0)
-					gc->permdeny = 1;
-			}
-		} while ((c = strtok(NULL, "\n")));
-#if 0
-		fprintf(stdout, "Sending message '%s'\n", buf);
-#endif
-
-		if (bud != NULL)
-			serv_add_buddies(gc, bud);
-		serv_set_permit_deny(gc);
-		if (blist) {
-			build_edit_tree();
-		}
-	}
-
-	/* perhaps the server dropped the buddy list, try importing from
-	   cache */
-
-	if (how_many == 0 && !from_do_import) {
-		do_import((GtkWidget *)NULL, gc);
-	} else if (gc && (bud_list_cache_exists(gc) == FALSE)) {
-		do_export((GtkWidget *)NULL, 0);
-	}
-}
-
 static char *toc_name()
 {
 	return "TOC";
@@ -1293,6 +1152,23 @@
 	toc_set_permit_deny(gc);
 }
 
+static void toc_draw_new_user(GtkWidget *box)
+{
+	GtkWidget *label;
+
+	label = gtk_label_new(_("Unfortunately, currently TOC only allows new user registration by "
+				"going to http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"
+				". Clicking the Register button will open the URL for you."));
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+}
+
+static void toc_do_new_user()
+{
+	open_url(NULL, "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no");
+}
+
 void toc_init(struct prpl *ret)
 {
 	ret->protocol = PROTO_TOC;
@@ -1300,6 +1176,8 @@
 	ret->list_icon = toc_list_icon;
 	ret->action_menu = toc_action_menu;
 	ret->user_opts = toc_user_opts;
+	ret->draw_new_user = toc_draw_new_user;
+	ret->do_new_user = toc_do_new_user;
 	ret->login = toc_login;
 	ret->close = toc_close;
 	ret->send_im = toc_send_im;