diff src/prpl.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 1528d05b3e6b
children d50d3abb9eb7
line wrap: on
line diff
--- a/src/prpl.c	Wed Nov 01 11:34:56 2000 +0000
+++ b/src/prpl.c	Wed Nov 01 22:30:36 2000 +0000
@@ -52,26 +52,29 @@
 	struct prpl *old;
 	GSList *n = protocols;
 	pi(p);
-	if (old = find_prpl(p->protocol)) {
-		GSList *c = connections;
-		struct gaim_connection *g;
-		while (c) {
-			g = (struct gaim_connection *)c->data;
-			if (g->prpl == old) {
-				char buf[256];
-				g_snprintf(buf, sizeof buf, _("%s was using %s, which got replaced."
-								" %s is now offline."), g->username,
-								(*p->name)(), g->username);
-				do_error_dialog(buf, _("Disconnect"));
-				signoff(g);
-				c = connections;
-			} else
-				c = c->next;
-		}
-		protocols = g_slist_remove(protocols, old);
-		g_free(old);
+	if (old = find_prpl(p->protocol))
+		unload_protocol(old);
+	protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
+}
+
+void unload_protocol(struct prpl *p) {
+	GSList *c = connections;
+	struct gaim_connection *g;
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		if (g->prpl == p) {
+			char buf[256];
+			g_snprintf(buf, sizeof buf, _("%s was using %s, which got removed."
+							" %s is now offline."), g->username,
+							(*p->name)(), g->username);
+			do_error_dialog(buf, _("Disconnect"));
+			signoff(g);
+			c = connections;
+		} else
+			c = c->next;
 	}
-	protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
+	protocols = g_slist_remove(protocols, p);
+	g_free(p);
 }
 
 void static_proto_init()