/soc/2013/ankitkv/gobjectification: 972b9fbb3690: Added checks t...

Ankit Vani a at nevitus.org
Sat Aug 31 19:11:30 EDT 2013


Changeset: 972b9fbb3690ab41134a0affbb880e8b8c947ac1
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-01 03:17 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/972b9fbb3690

Description:

Added checks to ensure protocol inherits PurpleProtocol and implements PurpleProtocolInterface

diffstat:

 libpurple/protocols.c |  16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diffs (26 lines):

diff --git a/libpurple/protocols.c b/libpurple/protocols.c
--- a/libpurple/protocols.c
+++ b/libpurple/protocols.c
@@ -752,6 +752,22 @@ purple_protocols_add(GType protocol_type
 
 	protocol = g_object_new(protocol_type, NULL);
 
+	if (!PURPLE_IS_PROTOCOL(protocol)) {
+		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
+		            _("Protocol type does not inherit PurpleProtocol"));
+
+		g_object_unref(protocol);
+		return NULL;
+	}
+
+	if (!PURPLE_IS_PROTOCOL_INTERFACE(protocol)) {
+		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
+		            _("Protocol does not implement PurpleProtocolInterface"));
+
+		g_object_unref(protocol);
+		return NULL;
+	}
+
 	if (!purple_protocol_get_id(protocol)) {
 		g_set_error(error, PURPLE_PROTOCOLS_DOMAIN, 0,
 		            _("Protocol does not provide an ID"));



More information about the Commits mailing list