2006-05-29 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Mon, 29 May 2006 01:07:14 +0000 (01:07 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Mon, 29 May 2006 01:07:14 +0000 (01:07 +0000)
* Makefile.am (DIST): Add
patches/sylpheed-claws-2.2.0/01-locale-dir.patch,
patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch,
patches/sylpheed-claws-2.2.0/03-std-plugins.patch and
patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch.
* patches/sylpheed-claws-2.2.0/01-locale-dir.patch,
patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch,
patches/sylpheed-claws-2.2.0/03-std-plugins.patch,
patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch: New file.

ChangeLog
Makefile.am
patches/sylpheed-claws-2.2.0/01-locale-dir.patch [new file with mode: 0755]
patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch [new file with mode: 0755]
patches/sylpheed-claws-2.2.0/03-std-plugins.patch [new file with mode: 0755]
patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch [new file with mode: 0755]

index de62310..1a86880 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2006-05-29  Marcus Brinkmann  <marcus@g10code.de>
 
+       * Makefile.am (DIST): Add
+       patches/sylpheed-claws-2.2.0/01-locale-dir.patch,
+       patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch,
+       patches/sylpheed-claws-2.2.0/03-std-plugins.patch and
+       patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch.
+       * patches/sylpheed-claws-2.2.0/01-locale-dir.patch,
+       patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch,
+       patches/sylpheed-claws-2.2.0/03-std-plugins.patch,
+       patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch: New file.
+
        * Makefile.am (EXTRA_DIST): Add
        patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch and
        patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch.
index 4aa0ab6..c4cdb85 100644 (file)
@@ -33,4 +33,8 @@ EXTRA_DIST = autogen.sh README.SVN \
         patches/glib-2.9.2-wk1/03-gspawn-w32-fixup.patch \
         patches/glib-2.9.2-wk1/04-gspawn-w32-buffering.patch \
        patches/sylpheed-claws-1.9.100cvs124/01-fix-plugin-dir.patch \
-       patches/sylpheed-claws-1.9.100cvs124/02-std-plugins.patch
+       patches/sylpheed-claws-1.9.100cvs124/02-std-plugins.patch \
+       patches/sylpheed-claws-2.2.0/01-locale-dir.patch \
+       patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch \
+       patches/sylpheed-claws-2.2.0/03-std-plugins.patch \
+       patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch
diff --git a/patches/sylpheed-claws-2.2.0/01-locale-dir.patch b/patches/sylpheed-claws-2.2.0/01-locale-dir.patch
new file mode 100755 (executable)
index 0000000..4b134dc
--- /dev/null
@@ -0,0 +1,87 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+2006-01-05  Werner Koch  <wk@g10code.com>
+
+        * src/common/utils.c (w32_get_locale_dir, get_locale_dir): New.
+        (get_plugin_dir) [W32]: Use it here.
+        * src/common/sylpheed.c (sylpheed_init): Use it here.
+
+--- sylpheed-claws-2.0.0/src/common/utils.c    2006-01-13 18:11:38.000000000 +0100
++++ sylpheed-claws-2.0.0/src/common/utils.c    2006-01-05 16:36:51.000000000 +0100
+@@ -1979,16 +1979,51 @@
+   else
+     return -1;
+ }
++
++/* Return a malloced string with the locale dir.  Return NULL on
++   error. */
++static char *w32_get_locale_dir(void)
++{
++        char name[MAX_PATH+35];
++        char *p;
++
++        if ( !GetModuleFileNameA (0, name, sizeof (name)-30) )
++                return NULL;
++        p = strrchr (name, '\\');
++        if (!p)
++        {
++                *name = '\\';
++                p = name;
++        }
++        p++;
++        strcpy (p, "\\share\\locale");
++        return g_strdup (name);
++}
++#endif /* G_OS_WIN32 */
++
++/* Return a static string with the locale dir. */
++const gchar *get_locale_dir(void)
++{
++      static gchar *loc_dir;
++
++#ifdef G_OS_WIN32
++      if (!loc_dir)
++                loc_dir = w32_get_locale_dir();
+ #endif
++      if (!loc_dir)
++              loc_dir = LOCALEDIR;
++        
++      return loc_dir;
++}
++
+ const gchar *get_home_dir(void)
+ {
+ #ifdef G_OS_WIN32
+       static char home_dir[MAX_PATH] = "";
+-      if (home_dir[0] == '\0')
+-              {
+-                      if (w32_shgetfolderpath
++      if (home_dir[0] == '\0') {
++                if (w32_shgetfolderpath
+                           (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
+                            NULL, 0, home_dir) < 0)
+                               strcpy (home_dir, "C:\\Sylpheed");
+@@ -2098,7 +2133,7 @@
+       static gchar *plugin_dir = NULL;
+       if (!plugin_dir)
+-                plugin_dir = g_strconcat(sylpheed_get_startup_dir(),
++                plugin_dir = g_strconcat(get_locale_dir(),
+                                          "\\lib\\sylpheed-claws\\plugins\\",
+                                          NULL);
+       return plugin_dir;
+--- sylpheed-claws-2.0.0/src/common/sylpheed.c 2006-01-13 18:11:38.000000000 +0100
++++ sylpheed-claws-2.0.0/src/common/sylpheed.c 2006-01-05 16:32:59.000000000 +0100
+@@ -100,7 +100,7 @@
+       setlocale(LC_ALL, "");
+ #ifdef ENABLE_NLS
+-      bindtextdomain(PACKAGE, LOCALEDIR);
++      bindtextdomain(PACKAGE, get_locale_dir () );
+       bind_textdomain_codeset (PACKAGE, "UTF-8");
+       textdomain(PACKAGE);
+ #endif /*ENABLE_NLS*/
diff --git a/patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch b/patches/sylpheed-claws-2.2.0/02-fix-plugin-dir.patch
new file mode 100755 (executable)
index 0000000..d2eccfb
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+Fix a bug in the W32 plugin directory handling.
+
+2006-01-09  Werner Koch  <wk@g10code.com>
+
+       * src/common/utils.c (w32_get_locale_dir): Removed.
+       (w32_get_module_dir): New.
+       (get_local_dir): Use new function.
+       (get_plugin_dir): Ditto.
+
+
+diff -ru sylpheed-claws.orig/src/common/utils.c sylpheed-claws/src/common/utils.c
+--- sylpheed-claws.orig/src/common/utils.c     2006-01-05 16:36:51.000000000 +0100
++++ sylpheed-claws/src/common/utils.c  2006-01-09 18:59:18.000000000 +0100
+@@ -1980,24 +1980,28 @@
+     return -1;
+ }
+-/* Return a malloced string with the locale dir.  Return NULL on
+-   error. */
+-static char *w32_get_locale_dir(void)
+-{
+-        char name[MAX_PATH+35];
+-        char *p;
+-
+-        if ( !GetModuleFileNameA (0, name, sizeof (name)-30) )
+-                return NULL;
+-        p = strrchr (name, '\\');
+-        if (!p)
+-        {
+-                *name = '\\';
+-                p = name;
++/* Returns a static string with the directroy from which the module
++   has been loaded.  Returns an empty string on error. */
++static char *w32_get_module_dir(void)
++{
++        static char *moddir;
++
++        if (!moddir) {
++                char name[MAX_PATH+10];
++                char *p;
++
++                if ( !GetModuleFileNameA (0, name, sizeof (name)-10) )
++                        *name = 0;
++                else {
++                        p = strrchr (name, '\\');
++                        if (p)
++                                *p = 0;
++                        else
++                                *name = 0;
++                }
++                moddir = g_strdup (name);
+         }
+-        p++;
+-        strcpy (p, "\\share\\locale");
+-        return g_strdup (name);
++        return moddir;
+ }
+ #endif /* G_OS_WIN32 */
+@@ -2008,7 +2012,8 @@
+ #ifdef G_OS_WIN32
+       if (!loc_dir)
+-                loc_dir = w32_get_locale_dir();
++              loc_dir = g_strconcat(w32_get_module_dir(), G_DIR_SEPARATOR_S,
++                                      "\\share\\locale", NULL);
+ #endif
+       if (!loc_dir)
+               loc_dir = LOCALEDIR;
+@@ -2133,7 +2138,7 @@
+       static gchar *plugin_dir = NULL;
+       if (!plugin_dir)
+-                plugin_dir = g_strconcat(get_locale_dir(),
++                plugin_dir = g_strconcat(w32_get_module_dir(),
+                                          "\\lib\\sylpheed-claws\\plugins\\",
+                                          NULL);
+       return plugin_dir;
+
+
diff --git a/patches/sylpheed-claws-2.2.0/03-std-plugins.patch b/patches/sylpheed-claws-2.2.0/03-std-plugins.patch
new file mode 100755 (executable)
index 0000000..c7b8052
--- /dev/null
@@ -0,0 +1,110 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+Force loading of the PGP plugins.
+
+
+2006-01-13  Werner Koch  <wk@g10code.com>
+
+       * src/common/plugin.c (plugin_load_standard_plugins): New.
+       (plugin_load_deps): Made more robust.
+       * src/main.c (main): Call it here.
+
+diff -rup sylpheed-claws-2.2.0/src/common/plugin.c sylpheed-claws-2.2.0-new/src/common/plugin.c
+--- sylpheed-claws-2.2.0/src/common/plugin.c   2006-05-08 09:09:55.000000000 +0200
++++ sylpheed-claws-2.2.0-new/src/common/plugin.c       2006-05-29 01:24:48.000000000 +0200
+@@ -64,6 +64,11 @@ static gint list_find_by_string(gconstpo
+ static gint list_find_by_plugin_filename(const Plugin *plugin, const gchar *filename)
+ {
++        /* FIXME: There is a problem in case of symlinks or when a
++           user tries to load a plugin with the same name from a
++           different directory.  I think it would be better to compare
++           only the basename of the filename here (case-insensitive on
++           W32). */
+         g_return_val_if_fail(plugin, 1);
+         g_return_val_if_fail(plugin->filename, 1);
+         g_return_val_if_fail(filename, 1);
+@@ -146,9 +151,11 @@ static gint plugin_load_deps(const gchar
+       gchar *deps_file = NULL;
+       FILE *fp = NULL;
+       gchar buf[BUFFSIZE];
++        gchar *p;
+         tmp = g_strdup(filename);
+-      *strrchr(tmp, '.') = '\0';
++      if( (p = strrchr(tmp, '.')) )
++          *p = '\0';
+       deps_file = g_strconcat(tmp, ".deps", NULL);
+       g_free(tmp);
+       
+@@ -390,6 +397,43 @@ void plugin_unload_all(const gchar *type
+       }
+ }
++
++/* Load those plugins we always want to use.  No error output; just
++ * try. */
++void plugin_load_standard_plugins (void)
++{
++        static const char *names[] = {
++                "pgpmime",
++                "pgpinline",
++                NULL
++        };
++        int i;
++        gchar *error, *filename;
++        
++        for (i=0; names[i]; i++) {
++                /* Simple hack to check whether the plugin has already
++                 * been loaded but checking only for the basename. */
++                GSList *cur = plugins;
++                for(; cur; cur = cur->next) {
++                        Plugin *p = (Plugin *)cur->data;
++                        if (strstr(p->filename, names[i]))
++                                break;
++                }
++                if (!cur) { /* Not yet loaded. */
++                        /* FIXME: get_plugin_dir () returns with a trailing
++                         * (back)slash; this should be fixed so that we can use
++                         * g_module_build_path here. */
++                        filename = g_strconcat (get_plugin_dir(),
++                                                names[i], NULL);
++                        error = NULL;
++                        plugin_load(filename, &error);
++                        g_free (error);
++                        g_free(filename);
++                }
++        }
++}
++
++
+ GSList *plugin_get_list(void)
+ {
+       return g_slist_copy(plugins);
+diff -rup sylpheed-claws-2.2.0/src/common/plugin.h sylpheed-claws-2.2.0-new/src/common/plugin.h
+--- sylpheed-claws-2.2.0/src/common/plugin.h   2006-05-08 09:09:55.000000000 +0200
++++ sylpheed-claws-2.2.0-new/src/common/plugin.h       2006-05-29 01:24:48.000000000 +0200
+@@ -38,6 +38,7 @@ void plugin_unload           (Plugin          *plugin);
+ void plugin_load_all          (const gchar     *type);
+ void plugin_unload_all                (const gchar     *type);
+ void plugin_save_list         (void);
++void plugin_load_standard_plugins (void);
+ GSList *plugin_get_list               (void);
+ GSList *plugin_get_unloaded_list(void);
+diff -rup sylpheed-claws-2.2.0/src/main.c sylpheed-claws-2.2.0-new/src/main.c
+--- sylpheed-claws-2.2.0/src/main.c    2006-05-08 09:09:55.000000000 +0200
++++ sylpheed-claws-2.2.0-new/src/main.c        2006-05-29 01:25:35.000000000 +0200
+@@ -543,7 +543,9 @@ int main(int argc, char *argv[])
+                                    "Check the Plugins configuration "
+                                    "for more information."));
+       }
+-      
++
++      plugin_load_standard_plugins ();
++       
+       if (!folder_have_mailbox()) {
+               alertpanel_error(_("Sylpheed-Claws has detected a configured "
+                                  "mailbox, but could not load it. It is "
diff --git a/patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch b/patches/sylpheed-claws-2.2.0/04-pgpcore-def.patch
new file mode 100755 (executable)
index 0000000..a58d003
--- /dev/null
@@ -0,0 +1,19 @@
+#! /bin/sh
+patch -p1 -f $* < $0
+exit $?
+
+2006-05-29  Marcus Brinkmann  <marcus@g10code.com>
+
+       * src/plugins/pgpcore/sylpheed.def: Add alertpanel_error.
+
+diff -rup sylpheed-claws-2.2.0/src/plugins/pgpcore/sylpheed.def sylpheed-claws-2.2.0-new/src/plugins/pgpcore/sylpheed.def
+--- sylpheed-claws-2.2.0/src/plugins/pgpcore/sylpheed.def      2006-05-08 09:09:56.000000000 +0200
++++ sylpheed-claws-2.2.0-new/src/plugins/pgpcore/sylpheed.def  2006-05-29 02:30:32.000000000 +0200
+@@ -1,6 +1,7 @@
+ LIBRARY SYLPHEED-CLAWS.EXE
+ EXPORTS
+ alertpanel
++alertpanel_error
+ alertpanel_full
+ copy_file_part
+ debug_print_real