changeset 1443:336fc98b7f90

[gaim-migrate @ 1453] ha! take that, foul knave committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 29 Jan 2001 02:53:40 +0000
parents 2f4e6269b001
children 55f67ef24683
files plugins/icq/gaim_icq.c plugins/irc.c plugins/jabber/jabber.c plugins/msn/msn.c plugins/napster.c plugins/yay/yay.c src/prpl.c src/prpl.h
diffstat 8 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/icq/gaim_icq.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/icq/gaim_icq.c	Mon Jan 29 02:53:40 2001 +0000
@@ -481,7 +481,7 @@
 }
 
 char *gaim_plugin_init(GModule *handle) {
-	load_protocol(icq_init);
+	load_protocol(icq_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/plugins/irc.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/irc.c	Mon Jan 29 02:53:40 2001 +0000
@@ -1131,7 +1131,7 @@
 
 char *gaim_plugin_init(GModule * handle)
 {
-	load_protocol(irc_init);
+	load_protocol(irc_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/plugins/jabber/jabber.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/jabber/jabber.c	Mon Jan 29 02:53:40 2001 +0000
@@ -883,7 +883,7 @@
 
 char *gaim_plugin_init(GModule *handle)
 {
-	load_protocol(Jabber_init);
+	load_protocol(Jabber_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/plugins/msn/msn.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/msn/msn.c	Mon Jan 29 02:53:40 2001 +0000
@@ -883,7 +883,7 @@
 
 char *gaim_plugin_init(GModule * handle)
 {
-	load_protocol(msn_init);
+	load_protocol(msn_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/plugins/napster.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/napster.c	Mon Jan 29 02:53:40 2001 +0000
@@ -1187,7 +1187,7 @@
 
 char *gaim_plugin_init(GModule * handle)
 {
-	load_protocol(nap_init);
+	load_protocol(nap_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/plugins/yay/yay.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/plugins/yay/yay.c	Mon Jan 29 02:53:40 2001 +0000
@@ -519,7 +519,7 @@
 }
 
 char *gaim_plugin_init(GModule *handle) {
-	load_protocol(Yahoo_init);
+	load_protocol(Yahoo_init, sizeof(struct prpl));
 	return NULL;
 }
 
--- a/src/prpl.c	Mon Jan 29 01:57:37 2001 +0000
+++ b/src/prpl.c	Mon Jan 29 02:53:40 2001 +0000
@@ -55,10 +55,19 @@
 	return a->protocol - b->protocol;
 }
 
-void load_protocol(proto_init pi)
+void load_protocol(proto_init pi, int size)
 {
-	struct prpl *p = g_new0(struct prpl, 1);
+	struct prpl *p;
 	struct prpl *old;
+	if (size != sizeof(struct prpl)) {
+		do_error_dialog(_("You have attempted to load a protocol which was not compiled"
+				" from the same version of the source as this application was."
+				" Unfortunately, because it is not the same version I cannot"
+				" safely tell you which one it was. Needless to say, it was not"
+				" successfully loaded."), _("Protocol Error"));
+		return;
+	}
+	p = g_new0(struct prpl, 1);
 	pi(p);
 	if ((old = find_prpl(p->protocol)) == NULL)
 		unload_protocol(old);
@@ -90,8 +99,8 @@
 
 void static_proto_init()
 {
-	load_protocol(toc_init);
-	load_protocol(oscar_init);
+	load_protocol(toc_init, sizeof(struct prpl));
+	load_protocol(oscar_init, sizeof(struct prpl));
 }
 
 static void des_win(GtkWidget *a, GtkWidget *b)
--- a/src/prpl.h	Mon Jan 29 01:57:37 2001 +0000
+++ b/src/prpl.h	Mon Jan 29 02:53:40 2001 +0000
@@ -113,7 +113,7 @@
 void static_proto_init();
 
 /* this is what should actually load the protocol. pass it the protocol's initializer */
-void load_protocol(proto_init);
+void load_protocol(proto_init, int);
 void unload_protocol(struct prpl *);
 
 struct prpl *find_prpl(int);