Fixed typo introduced after 0.9.3claws92 that prevented compilation; Updated Makefile...
[claws.git] / src / plugins / demo / demo.c
index fd4665593124d2c2eeddbdc08bccea594373b76c..862a42fa466df2fad73aad18f8acc40836d24eba 100644 (file)
@@ -17,6 +17,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "intl.h"
+#include "version.h"
+#include "sylpheed.h"
 #include "plugin.h"
 #include "utils.h"
 #include "hooks.h"
@@ -35,6 +38,16 @@ static guint hook_id;
 
 gint plugin_init(gchar **error)
 {
+       if ((sylpheed_get_version() > VERSION_NUMERIC)) {
+               *error = g_strdup("Your sylpheed version is newer than the version the plugin was built with");
+               return -1;
+       }
+
+       if ((sylpheed_get_version() < MAKE_NUMERIC_VERSION(0, 8, 11, 39))) {
+               *error = g_strdup("Your sylpheed version is too old");
+               return -1;
+       }
+
        hook_id = hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, my_log_hook, NULL);
        if (hook_id == -1) {
                *error = g_strdup("Failed to register log text hook");
@@ -46,19 +59,27 @@ gint plugin_init(gchar **error)
        return 0;
 }
 
-void plugin_done()
+void plugin_done(void)
 {
        hooks_unregister_hook(LOG_APPEND_TEXT_HOOKLIST, hook_id);
 
        printf("Demo plugin unloaded\n");
 }
 
-const gchar *plugin_name()
+const gchar *plugin_name(void)
+{
+       return _("Demo");
+}
+
+const gchar *plugin_desc(void)
 {
-       return "Dummy plugin";
+       return _("This Plugin is only a demo of how to write plugins for Sylpheed. "
+                "It installs a hook for new log output and writes it to stdout."
+                "\n\n"
+                "It is not really useful");
 }
 
-const gchar *plugin_desc()
+const gchar *plugin_type(void)
 {
-       return "Plugin that does nothing and never loads";
+       return "Common";
 }