2005-12-09 [cleroy] 1.9.100cvs78
[claws.git] / src / common / plugin.c
index 633bb24a5914e8ccbdc8d25eb2877b96c6b3ff8d..34d4115bb3d740e3888204b6fa7a03457ee5b38b 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <stdio.h>
@@ -35,6 +35,7 @@ struct _Plugin
        const gchar *(*name) (void);
        const gchar *(*desc) (void);
        const gchar *(*type) (void);
+       const gchar *(*licence) (void);
        GSList *rdeps;
 };
 
@@ -192,6 +193,7 @@ Plugin *plugin_load(const gchar *filename, gchar **error)
        gint (*plugin_init) (gchar **error);
        gpointer plugin_name, plugin_desc;
        const gchar *(*plugin_type)(void);
+       const gchar *(*plugin_licence)(void);
        gint ok;
 
        g_return_val_if_fail(filename != NULL, NULL);
@@ -221,6 +223,7 @@ Plugin *plugin_load(const gchar *filename, gchar **error)
        if (!g_module_symbol(plugin->module, "plugin_name", &plugin_name) ||
            !g_module_symbol(plugin->module, "plugin_desc", &plugin_desc) ||
            !g_module_symbol(plugin->module, "plugin_type", (gpointer)&plugin_type) ||
+           !g_module_symbol(plugin->module, "plugin_licence", (gpointer)&plugin_licence) ||
            !g_module_symbol(plugin->module, "plugin_init", (gpointer)&plugin_init)) {
                *error = g_strdup(g_module_error());
                g_module_close(plugin->module);
@@ -228,6 +231,14 @@ Plugin *plugin_load(const gchar *filename, gchar **error)
                return NULL;
        }
        
+       if (strcmp(plugin_licence(), "GPL")
+       &&  strncmp(plugin_licence(), "GPL-compatible", strlen("GPL-compatible"))) {
+               *error = g_strdup(_("This module is not licenced under a GPL compatible licence."));
+               g_module_close(plugin->module);
+               g_free(plugin);
+               return NULL;
+       }
+
        if (!strcmp(plugin_type(), "GTK")) {
                *error = g_strdup(_("This module is for Sylpheed-Claws GTK1."));
                g_module_close(plugin->module);
@@ -244,6 +255,7 @@ Plugin *plugin_load(const gchar *filename, gchar **error)
        plugin->name = plugin_name;
        plugin->desc = plugin_desc;
        plugin->type = plugin_type;
+       plugin->licence = plugin_licence;
        plugin->filename = g_strdup(filename);
 
        plugins = g_slist_append(plugins, plugin);