MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws1
+EXTRA_VERSION=claws2
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}", PACKAGE_DATA_DIR)
fi
-dnl Checks for libraries.
+AC_CHECK_LIB(xpg4, setlocale)
+
+dnl for GThread support (currently disabled)
+dnl AC_ARG_ENABLE(threads,
+dnl [ --enable-threads Enable multithread support [default=no]],
+dnl [use_threads=$enableval], [use_threads=no])
+
+AC_MSG_CHECKING([whether to use threads])
+if test x"$use_threads" = xyes ; then
+ AC_MSG_RESULT(yes)
+ if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
+ CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
+ LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
+ AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
+ else
+ AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
+ sys/param.h sys/utsname.h sys/select.h \
+ wchar.h wctype.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+
+dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
+dnl may be defined only in wchar.h (this happens with gcc-2.96).
+dnl So we need to use this extended macro.
+SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
+[
+#if HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
+
+GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
+AC_CHECK_SIZEOF(unsigned short, 2)
+AC_CHECK_SIZEOF(unsigned int, 4)
+AC_CHECK_SIZEOF(unsigned long, 4)
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
+ wcsstr wcswcs iswalnum iswspace towlower \
+ wcslen wcscpy wcsncpy \
+ uname flock lockf inet_aton inet_addr \
+ fchmod mkstemp)
+
+dnl *****************
+dnl ** common code **
+dnl *****************
+
+dnl check for glib
AM_PATH_GLIB(1.2.6,,
AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
gthread)
+
+dnl check for IPv6 option
+AC_ARG_ENABLE(ipv6,
+ [ --enable-ipv6 Enable IPv6 support [default=no]],
+ [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
+
+dnl automated checks for IPv6 support.
+AC_MSG_CHECKING([whether to use IPv6])
+if test x"$ac_cv_enable_ipv6" = xyes; then
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING([for IPv6 support])
+ AC_CACHE_VAL(ac_cv_ipv6,[
+ AC_TRY_COMPILE([#define INET6
+ #include <sys/types.h>
+ #include <netinet/in.h>],
+ [int x = IPPROTO_IPV6; struct in6_addr a;],
+ ac_cv_ipv6=yes, ac_cv_ipv6=no)
+ ])
+ AC_MSG_RESULT($ac_cv_ipv6)
+ if test $ac_cv_ipv6 = yes; then
+ AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
+ else
+ AC_MSG_WARN(*** IPv6 will not be supported ***)
+ ac_cv_enable_ipv6=no
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+
+dnl Check for OpenSSL
+AM_PATH_OPENSSL
+
+dnl Check for libjconv
+AC_ARG_ENABLE(jconv,
+ [ --disable-jconv Do not use libjconv],
+ [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
+if test "$ac_cv_enable_jconv" = yes; then
+ AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
+fi
+
+dnl ************************
+dnl ** GTK user interface **
+dnl ************************
+
+dnl Checks for GTK
AM_PATH_GTK(1.2.6,,
AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
CFLAGS="$CFLAGS_SAVE"
LDFLAGS="$LDFLAGS_SAVE"
-dnl Check for built-in image view support
-AC_ARG_ENABLE(gdk-pixbuf,
- [ --disable-gdk-pixbuf Do not use gdk-pixbuf],
- [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
-AC_ARG_ENABLE(imlib,
- [ --disable-imlib Do not use imlib],
- [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
-
-if test "$ac_cv_enable_gdk_pixbuf" = yes; then
- AM_PATH_GDK_PIXBUF(0.8.0,
- [AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image view)
- ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
-fi
-if test "$ac_cv_enable_imlib" = yes; then
- AM_PATH_GDK_IMLIB(1.9,
- AC_DEFINE(HAVE_GDK_IMLIB, 1, Define if you use gdk_imlib to support image view),
- [ac_cv_enable_imlib=no])
-fi
-if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
- AC_MSG_WARN(*** Built-in image view will not be supported ***)
-fi
-
-dnl GPGME is used to support OpenPGP
-AC_ARG_ENABLE(gpgme,
- [ --enable-gpgme Enable GnuPG support using GPGME [default=no]],
- [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
-AC_MSG_CHECKING([whether to use GPGME])
-if test $ac_cv_enable_gpgme = yes; then
+dnl GNU/Aspell is used for spell checking
+AC_ARG_ENABLE(aspell,
+ [ --enable-aspell Enable GNU/aspell support [default=no]],
+ [ac_cv_enable_aspell=$enableval], [ac_cv_enable_aspell=no])
+AC_MSG_CHECKING([whether to use GNU/aspell])
+if test $ac_cv_enable_aspell = yes; then
AC_MSG_RESULT(yes)
- AM_PATH_GPGME(0.3.10, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
- [use_gpgme=no
- ac_cv_enable_gpgme=no])
+ AM_PATH_ASPELL(0.50, AC_DEFINE(USE_ASPELL, 1, Define if you use ASPELL to support spell checking),
+ [use_aspell=no ac_cv_enable_aspell=no])
else
AC_MSG_RESULT(no)
fi
-dnl for JPilot support in addressbook
-dnl no check for libraries; these are dynamically loaded
-AC_ARG_ENABLE(jpilot,
- [ --enable-jpilot Enable JPilot support [default=no]],
- [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
-AC_MSG_CHECKING([whether to use JPilot])
-if test "$ac_cv_enable_jpilot" = yes; then
- AC_MSG_RESULT(yes)
- AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
- [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
- [ ac_cv_enable_jpilot=no ])
- if test "$ac_cv_enable_jpilot" = no; then
- AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
- [ ac_cv_enable_jpilot=yes
- AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
+dnl want crash dialog
+AC_ARG_ENABLE(crash-dialog,
+ [ --enable-crash-dialog Enable crash dialog [default=no]],
+ [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
+if test $ac_cv_enable_crash_dialog = yes; then
+dnl check if GDB is somewhere
+ AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
+ AC_MSG_CHECKING([whether to use crash dialog])
+ if test $ac_cv_enable_crash_dialog = yes; then
+ AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
fi
- AC_MSG_CHECKING([whether jpilot is available])
- AC_MSG_RESULT($ac_cv_enable_jpilot)
+ AC_MSG_RESULT($ac_cv_enable_crash_dialog)
+fi
- if test "$ac_cv_enable_jpilot" = yes; then
- LIBS="$LIBS -lpisock"
- fi
-else
- AC_MSG_RESULT(no)
+dnl Check for X-Face support
+AC_ARG_ENABLE(compface,
+ [ --disable-compface Do not use compface (X-Face)],
+ [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
+if test "$ac_cv_enable_compface" = yes; then
+ AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
fi
dnl for LDAP support in addressbook
AC_MSG_RESULT(no)
fi
-dnl Check for OpenSSL
-AM_PATH_OPENSSL
-
-dnl Check for X-Face support
-AC_ARG_ENABLE(compface,
- [ --disable-compface Do not use compface (X-Face)],
- [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
-if test "$ac_cv_enable_compface" = yes; then
- AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
-fi
-
-dnl Check for libjconv
-AC_ARG_ENABLE(jconv,
- [ --disable-jconv Do not use libjconv],
- [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
-if test "$ac_cv_enable_jconv" = yes; then
- AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
-fi
-
-AC_CHECK_LIB(xpg4, setlocale)
-
-dnl for GThread support (currently disabled)
-dnl AC_ARG_ENABLE(threads,
-dnl [ --enable-threads Enable multithread support [default=no]],
-dnl [use_threads=$enableval], [use_threads=no])
-
-AC_MSG_CHECKING([whether to use threads])
-if test x"$use_threads" = xyes ; then
+dnl for JPilot support in addressbook
+dnl no check for libraries; these are dynamically loaded
+AC_ARG_ENABLE(jpilot,
+ [ --enable-jpilot Enable JPilot support [default=no]],
+ [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
+AC_MSG_CHECKING([whether to use JPilot])
+if test "$ac_cv_enable_jpilot" = yes; then
AC_MSG_RESULT(yes)
- if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
- CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
- LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
- AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
- else
- AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
+ AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
+ [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
+ [ ac_cv_enable_jpilot=no ])
+ if test "$ac_cv_enable_jpilot" = no; then
+ AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
+ [ ac_cv_enable_jpilot=yes
+ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
+ fi
+ AC_MSG_CHECKING([whether jpilot is available])
+ AC_MSG_RESULT($ac_cv_enable_jpilot)
+
+ if test "$ac_cv_enable_jpilot" = yes; then
+ LIBS="$LIBS -lpisock"
fi
else
AC_MSG_RESULT(no)
fi
-dnl check for IPv6 option
-AC_ARG_ENABLE(ipv6,
- [ --enable-ipv6 Enable IPv6 support [default=no]],
- [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
+dnl Check for built-in image view support
+AC_ARG_ENABLE(gdk-pixbuf,
+ [ --disable-gdk-pixbuf Do not use gdk-pixbuf],
+ [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
+AC_ARG_ENABLE(imlib,
+ [ --disable-imlib Do not use imlib],
+ [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
-dnl automated checks for IPv6 support.
-AC_MSG_CHECKING([whether to use IPv6])
-if test x"$ac_cv_enable_ipv6" = xyes; then
- AC_MSG_RESULT(yes)
- AC_MSG_CHECKING([for IPv6 support])
- AC_CACHE_VAL(ac_cv_ipv6,[
- AC_TRY_COMPILE([#define INET6
- #include <sys/types.h>
- #include <netinet/in.h>],
- [int x = IPPROTO_IPV6; struct in6_addr a;],
- ac_cv_ipv6=yes, ac_cv_ipv6=no)
- ])
- AC_MSG_RESULT($ac_cv_ipv6)
- if test $ac_cv_ipv6 = yes; then
- AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
- else
- AC_MSG_WARN(*** IPv6 will not be supported ***)
- ac_cv_enable_ipv6=no
- fi
-else
- AC_MSG_RESULT(no)
+if test "$ac_cv_enable_gdk_pixbuf" = yes; then
+ AM_PATH_GDK_PIXBUF(0.8.0,
+ [AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image view)
+ ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
+fi
+if test "$ac_cv_enable_imlib" = yes; then
+ AM_PATH_GDK_IMLIB(1.9,
+ AC_DEFINE(HAVE_GDK_IMLIB, 1, Define if you use gdk_imlib to support image view),
+ [ac_cv_enable_imlib=no])
+fi
+if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
+ AC_MSG_WARN(*** Built-in image view will not be supported ***)
fi
-dnl GNU/Aspell is used for spell checking
-AC_ARG_ENABLE(aspell,
- [ --enable-aspell Enable GNU/aspell support [default=no]],
- [ac_cv_enable_aspell=$enableval], [ac_cv_enable_aspell=no])
-AC_MSG_CHECKING([whether to use GNU/aspell])
-if test $ac_cv_enable_aspell = yes; then
+dnl GPGME is used to support OpenPGP
+AC_ARG_ENABLE(gpgme,
+ [ --enable-gpgme Enable GnuPG support using GPGME [default=no]],
+ [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
+AC_MSG_CHECKING([whether to use GPGME])
+if test $ac_cv_enable_gpgme = yes; then
AC_MSG_RESULT(yes)
- AM_PATH_ASPELL(0.50, AC_DEFINE(USE_ASPELL, 1, Define if you use ASPELL to support spell checking),
- [use_aspell=no ac_cv_enable_aspell=no])
+ AM_PATH_GPGME(0.3.10, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
+ [use_gpgme=no
+ ac_cv_enable_gpgme=no])
else
AC_MSG_RESULT(no)
fi
-dnl want crash dialog
-AC_ARG_ENABLE(crash-dialog,
- [ --enable-crash-dialog Enable crash dialog [default=no]],
- [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
-if test $ac_cv_enable_crash_dialog = yes; then
-dnl check if GDB is somewhere
- AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
- AC_MSG_CHECKING([whether to use crash dialog])
- if test $ac_cv_enable_crash_dialog = yes; then
- AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
- fi
- AC_MSG_RESULT($ac_cv_enable_crash_dialog)
-fi
+dnl *************************
+dnl ** section for plugins **
+dnl *************************
-dnl Checks for header files.
-AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
- sys/param.h sys/utsname.h sys/select.h \
- wchar.h wctype.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_OFF_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_STRUCT_TM
+PLUGINS=""
+PLUGINDIR=${prefix}/${DATADIRNAME}/${PACKAGE}/plugins
-dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
-dnl may be defined only in wchar.h (this happens with gcc-2.96).
-dnl So we need to use this extended macro.
-SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
-[
-#if HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
+AC_ARG_ENABLE(demo-plugin,
+ [ --enable-demo-plugin Build demo plugin [default=no]],
+ [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
+if test x"$ac_cv_enable_demo_plugin" = xyes; then
+ PLUGINS="demo $PLUGINS"
+fi
-GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
-AC_CHECK_SIZEOF(unsigned short, 2)
-AC_CHECK_SIZEOF(unsigned int, 4)
-AC_CHECK_SIZEOF(unsigned long, 4)
+AC_SUBST(PLUGINS)
+AC_SUBST(PLUGINDIR)
+AC_DEFINE(PLUGINDIR, "$PLUGINDIR", Path where plugins will be installed)
-dnl Checks for library functions.
-AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
- wcsstr wcswcs iswalnum iswspace towlower \
- wcslen wcscpy wcsncpy \
- uname flock lockf inet_aton inet_addr \
- fchmod mkstemp)
+dnl ****************************
+dnl ** Final configure output **
+dnl ****************************
AC_OUTPUT([
Makefile
src/Makefile
src/common/Makefile
src/gtk/Makefile
+src/plugins/Makefile
+src/plugins/demo/Makefile
faq/Makefile
faq/de/Makefile
faq/en/Makefile
echo "IPv6 : $ac_cv_enable_ipv6"
echo "GNU/aspell : $ac_cv_enable_aspell"
echo "Crash dialog : $ac_cv_enable_crash_dialog"
+echo "Plugins : $PLUGINS"
echo ""
echo "The binary will be installed in $prefix/bin"
echo ""
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto and the Sylpheed-Claws Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ */
+
+#include <stdio.h>
+
+#include <glib.h>
+#include <gmodule.h>
+
+#include "intl.h"
+#include "defs.h"
+#include "utils.h"
+#include "plugin.h"
+#include "prefs.h"
+
+struct _Plugin
+{
+ gchar *filename;
+ gchar *name;
+ GModule *module;
+ gchar *desc;
+};
+
+/**
+ * List of all loaded plugins
+ */
+GSList *plugins = NULL;
+
+void plugin_save_list()
+{
+ gchar *rcpath;
+ PrefFile *pfile;
+ GSList *cur;
+ Plugin *plugin;
+
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "pluginsrc", NULL);
+ if ((pfile = prefs_write_open(rcpath)) == NULL) {
+ g_warning("failed to write plugin list\n");
+ g_free(rcpath);
+ return;
+ }
+
+ for (cur = plugins; cur != NULL; cur = g_slist_next(cur)) {
+ plugin = (Plugin *)cur->data;
+
+ fprintf(pfile->fp, "%s\n", plugin->filename);
+ }
+
+ if (prefs_write_close(pfile) < 0)
+ g_warning("failed to write plugin list\n");
+
+ g_free(rcpath);
+}
+
+/**
+ * Loads a plugin
+ *
+ * \param filename The filename of the plugin to load
+ * \param error The location where an error string can be stored
+ * \return 0 on success, -1 otherwise
+ */
+gint plugin_load(const gchar *filename, gchar **error)
+{
+ Plugin *plugin;
+ gint (*plugin_init) (gchar **error);
+ gint ok;
+
+ g_return_val_if_fail(filename != NULL, -1);
+ g_return_val_if_fail(error != NULL, -1);
+
+ plugin = g_new0(Plugin, 1);
+ if (plugin == NULL) {
+ *error = g_strdup(_("Failed to allocate memory for Plugin"));
+ return -1;
+ }
+
+ plugin->module = g_module_open(filename, 0);
+ if (plugin->module == NULL) {
+ *error = g_strdup(g_module_error());
+ g_free(plugin);
+ return -1;
+ }
+
+ if (!g_module_symbol(plugin->module, "plugin_name", (gpointer *)&plugin->name) ||
+ !g_module_symbol(plugin->module, "plugin_desc", (gpointer *)&plugin->desc) ||
+ !g_module_symbol(plugin->module, "plugin_init", (gpointer *)&plugin_init)) {
+ *error = g_strdup(g_module_error());
+ g_module_close(plugin->module);
+ g_free(plugin);
+ return -1;
+ }
+
+ if ((ok = plugin_init(error)) < 0) {
+ g_module_close(plugin->module);
+ g_free(plugin);
+ return ok;
+ }
+
+ plugins = g_slist_append(plugins, plugin);
+
+ return 0;
+}
+
+void plugin_unload(Plugin *plugin)
+{
+ void (*plugin_done) ();
+
+ if (g_module_symbol(plugin->module, "plugin_done", (gpointer *)&plugin_done)) {
+ plugin_done();
+ }
+
+ g_module_close(plugin->module);
+ g_free(plugin);
+}
+
+void plugin_load_all()
+{
+ gchar *rcpath;
+ gchar buf[BUFFSIZE];
+ FILE *fp;
+
+ rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "pluginsrc", NULL);
+ if ((fp = fopen(rcpath, "rb")) != NULL) {
+ gchar *error;
+
+ while(fgets(buf, sizeof(buf), fp) != NULL) {
+ g_strstrip(buf);
+
+ if (plugin_load(buf, &error) < 0) {
+ debug_print("plugin loading error: %s\n", error);
+ g_free(error);
+ }
+ }
+
+ fclose(fp);
+ }
+
+ g_free(rcpath);
+}
+
+void plugin_unload_all()
+{
+ GSList *cur;
+
+ for (cur = plugins; cur != NULL; cur = g_slist_next(cur)) {
+ plugin_unload((Plugin *)cur->data);
+ }
+ g_slist_free(plugins);
+ plugins = NULL;
+}
+
+GSList *plugin_get_list()
+{
+ return g_slist_copy(plugins);
+}
+
+const gchar *plugin_get_name(Plugin *plugin)
+{
+ return plugin->name;
+}
+
+const gchar *plugin_get_desc(Plugin *plugin)
+{
+ return plugin->desc;
+}