diff plugins/irc.c @ 1047:ece2d1543b20

[gaim-migrate @ 1057] Plugins now use GModule. Protocol plugins can be dynamically updated. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 01 Nov 2000 22:30:36 +0000
parents 4593605da0e2
children 49799527aebf
line wrap: on
line diff
--- a/plugins/irc.c	Wed Nov 01 11:34:56 2000 +0000
+++ b/plugins/irc.c	Wed Nov 01 22:30:36 2000 +0000
@@ -892,9 +892,9 @@
 	irc_request_buddy_update(gc);
 }
 
-struct prpl *irc_init() {
-	struct prpl *ret = g_new0(struct prpl, 1);
+static struct prpl *my_protocol = NULL;
 
+void irc_init(struct prpl *ret) {
 	ret->protocol = PROTO_IRC;
 	ret->name = irc_name;
 	ret->login = irc_login;
@@ -922,11 +922,17 @@
 	ret->chat_whisper = NULL;
 	ret->chat_send = irc_chat_send;
 	ret->keepalive = NULL;
-	
-	return ret;
+
+	my_protocol = ret;
 }
 
-int gaim_plugin_init(void *handle) {
-	load_protocl(irc_init);
-	return 0;
+char *gaim_plugin_init(GModule *handle) {
+	load_protocol(irc_init);
+	return NULL;
 }
+
+void gaim_plugin_remove() {
+	struct prpl *p = find_prpl(PROTO_IRC);
+	if (p == my_protocol)
+		unload_protocol(p);
+}