2007-07-09 [colin] 2.10.0cvs11
authorColin Leroy <colin@colino.net>
Mon, 9 Jul 2007 19:21:53 +0000 (19:21 +0000)
committerColin Leroy <colin@colino.net>
Mon, 9 Jul 2007 19:21:53 +0000 (19:21 +0000)
* src/Makefile.am
* src/exporthtml.c
* src/mbox.c
* src/msgcache.c
* src/prefs_summaries.c
* src/prefs_themes.c
* src/procheader.c
* src/common/Makefile.am
* src/common/log.c
* src/common/timing.h
* src/common/utils.c
* src/common/utils.h
* src/common/w32_account.c
* src/common/w32lib.h
* src/gtk/Makefile.am
* src/gtk/colorlabel.c
* src/plugins/pgpcore/Makefile.am
* src/plugins/pgpcore/claws.def
* src/plugins/pgpcore/passphrase.c
* src/plugins/pgpcore/pgp_viewer.c
* src/plugins/pgpcore/plugin.def
* src/plugins/pgpcore/sgpgme.c
* src/plugins/pgpinline/Makefile.am
* src/plugins/pgpinline/claws.def
* src/plugins/pgpinline/mypgpcore.def
* src/plugins/pgpinline/plugin.def
* src/plugins/pgpmime/Makefile.am
* src/plugins/pgpmime/claws.def
* src/plugins/pgpmime/mypgpcore.def
* src/plugins/pgpmime/plugin.def
Commit win32 patch, from Werner Koch and
Marcus Brinkmann

33 files changed:
ChangeLog
PATCHSETS
configure.ac
src/Makefile.am
src/common/Makefile.am
src/common/log.c
src/common/timing.h
src/common/utils.c
src/common/utils.h
src/common/w32_account.c [new file with mode: 0644]
src/common/w32lib.h
src/exporthtml.c
src/gtk/Makefile.am
src/gtk/colorlabel.c
src/mbox.c
src/msgcache.c
src/plugins/pgpcore/Makefile.am
src/plugins/pgpcore/claws.def
src/plugins/pgpcore/passphrase.c
src/plugins/pgpcore/pgp_viewer.c
src/plugins/pgpcore/plugin.def
src/plugins/pgpcore/sgpgme.c
src/plugins/pgpinline/Makefile.am
src/plugins/pgpinline/claws.def
src/plugins/pgpinline/mypgpcore.def
src/plugins/pgpinline/plugin.def
src/plugins/pgpmime/Makefile.am
src/plugins/pgpmime/claws.def
src/plugins/pgpmime/mypgpcore.def
src/plugins/pgpmime/plugin.def
src/prefs_summaries.c
src/prefs_themes.c
src/procheader.c

index bd70461c92187acbdb7f06e56378a464be7a2242..d60e7721cb403fc711790d0812763c87d9606aba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2007-07-09 [colin]     2.10.0cvs11
+
+       * src/Makefile.am
+       * src/exporthtml.c
+       * src/mbox.c
+       * src/msgcache.c
+       * src/prefs_summaries.c
+       * src/prefs_themes.c
+       * src/procheader.c
+       * src/common/Makefile.am
+       * src/common/log.c
+       * src/common/timing.h
+       * src/common/utils.c
+       * src/common/utils.h
+       * src/common/w32_account.c
+       * src/common/w32lib.h
+       * src/gtk/Makefile.am
+       * src/gtk/colorlabel.c
+       * src/plugins/pgpcore/Makefile.am
+       * src/plugins/pgpcore/claws.def
+       * src/plugins/pgpcore/passphrase.c
+       * src/plugins/pgpcore/pgp_viewer.c
+       * src/plugins/pgpcore/plugin.def
+       * src/plugins/pgpcore/sgpgme.c
+       * src/plugins/pgpinline/Makefile.am
+       * src/plugins/pgpinline/claws.def
+       * src/plugins/pgpinline/mypgpcore.def
+       * src/plugins/pgpinline/plugin.def
+       * src/plugins/pgpmime/Makefile.am
+       * src/plugins/pgpmime/claws.def
+       * src/plugins/pgpmime/mypgpcore.def
+       * src/plugins/pgpmime/plugin.def
+               Commit win32 patch, from Werner Koch and
+               Marcus Brinkmann
+
 2007-07-09 [colin]     2.10.0cvs10
 
        * src/prefs_toolbar.c
index 3ce8f5e4e3ecac5e015c7731be80067a3bd27593..51eb81d2b069f1d659c6ec8e4ac8345b45be3a72 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.9.2.24 -r 1.9.2.25 src/plugins/clamav/clamav_plugin_gtk.c;  ) > 2.10.0cvs8.patchset
 ( cvs diff -u -r 1.5.10.5 -r 1.5.10.6 COPYING;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 manual/claws-mail-manual.xml;  cvs diff -u -r 1.1.2.13 -r 1.1.2.14 po/fi.po;  ) > 2.10.0cvs9.patchset
 ( cvs diff -u -r 1.30.2.33 -r 1.30.2.34 src/prefs_toolbar.c;  ) > 2.10.0cvs10.patchset
+( cvs diff -u -r 1.155.2.66 -r 1.155.2.67 src/Makefile.am;  cvs diff -u -r 1.5.2.19 -r 1.5.2.20 src/exporthtml.c;  cvs diff -u -r 1.28.2.35 -r 1.28.2.36 src/mbox.c;  cvs diff -u -r 1.16.2.51 -r 1.16.2.52 src/msgcache.c;  cvs diff -u -r 1.1.2.44 -r 1.1.2.45 src/prefs_summaries.c;  cvs diff -u -r 1.3.2.48 -r 1.3.2.49 src/prefs_themes.c;  cvs diff -u -r 1.47.2.43 -r 1.47.2.44 src/procheader.c;  cvs diff -u -r 1.24.2.14 -r 1.24.2.15 src/common/Makefile.am;  cvs diff -u -r 1.6.2.11 -r 1.6.2.12 src/common/log.c;  cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/common/timing.h;  cvs diff -u -r 1.36.2.104 -r 1.36.2.105 src/common/utils.c;  cvs diff -u -r 1.20.2.46 -r 1.20.2.47 src/common/utils.h;  diff -u /dev/null src/common/w32_account.c;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/common/w32lib.h;  cvs diff -u -r 1.20.2.14 -r 1.20.2.15 src/gtk/Makefile.am;  cvs diff -u -r 1.2.2.18 -r 1.2.2.19 src/gtk/colorlabel.c;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/pgpcore/Makefile.am;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpcore/claws.def;  cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/plugins/pgpcore/passphrase.c;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/plugins/pgpcore/pgp_viewer.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpcore/plugin.def;  cvs diff -u -r 1.1.2.45 -r 1.1.2.46 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/plugins/pgpinline/Makefile.am;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/claws.def;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/mypgpcore.def;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpinline/plugin.def;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/plugins/pgpmime/Makefile.am;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpmime/claws.def;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/mypgpcore.def;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpmime/plugin.def;  ) > 2.10.0cvs11.patchset
index fd8cd79616f5435c6a827ced930d2bf082d6dbd8..6e6f1cb0abcadeb4f5557c4970c791ab9661a80f 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=10
+EXTRA_VERSION=11
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index bcb68bc3d5f12a499545b5ca94fe9d4529be0ca8..52b9e023b876f6ad5f3617f3451ac00d95aeba9c 100644 (file)
@@ -448,6 +448,7 @@ EXTRA_DIST = \
 
 INCLUDES = \
        -I$(srcdir)/common \
+       -Icommon \
        -I$(srcdir)/gtk \
        -I$(srcdir)/etpan
 
index 637001a95c3162ad4b28f0213fc8b54cdf1d5c1d..edd5b1b7f56d6833f0a3221a60cc25ff21a2f5d8 100644 (file)
@@ -5,7 +5,7 @@ if OS_WIN32
 arch_sources = fnmatch.c \
                w32_dirent.c w32_reg.c w32_signal.c w32_stat.c \
                w32_stdio.c w32_stdlib.c w32_string.c w32_time.c \
-               w32_unistd.c w32_wait.c
+               w32_unistd.c w32_wait.c w32_account.c
 arch_headers = fnmatch.h w32lib.h
 else
 arch_files = 
index 3d674b7dfce92d13acca47dc79e7753a7b2cb8c5..4391764dc96cfcc234ebd07c05b743c8eb9c2723 100644 (file)
 
 #include "defs.h"
 
+#ifdef G_OS_WIN32
+#  include <w32lib.h>
+#endif
+
 #include <stdio.h>
 #include <glib.h>
 #include <glib/gi18n.h>
index edb8595f74291c92806766b8e994ae0098f64467..4db5d25c003ad859b2d2b14b78f1b3b92b31e7a2 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef __TIMING_H__
 #define __TIMING_H__
 
+#include <glib.h>
 #include <sys/time.h>
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #define START_TIMING(str) do {} while(0);
 #define END_TIMING() do {} while(0);
 #else
+
+#ifdef G_OS_WIN32
+
+#include <w32lib.h>
+
+/* no {} by purpose */
+#define START_TIMING(str)                                              \
+        LARGE_INTEGER frequency;                                       \
+       LARGE_INTEGER start;                                            \
+       LARGE_INTEGER end;                                              \
+       LARGE_INTEGER diff;                                             \
+       const char *timing_name=str;                                    \
+       QueryPerformanceFrequency (&frequency);                         \
+       QueryPerformanceCounter (&start);                               \
+
+#define END_TIMING()                                                   \
+       QueryPerformanceCounter (&end);                                 \
+        diff.QuadPart = (double)                                       \
+               ((end.QuadPart - start.QuadPart)        \
+               * (double)1000.0/(double)frequency.QuadPart);           \
+        debug_print("TIMING %s: %ds%03dms\n",                          \
+               timing_name, (unsigned int) (diff.QuadPart / 1000000),  \
+               (unsigned int) ((diff.QuadPart / 1000) % 1000));
+
+#else
 /* no {} by purpose */
 #define START_TIMING(str)                                              \
        struct timeval start;                                           \
        struct timeval end;                                             \
        struct timeval diff;                                            \
        const char *timing_name=str;                                    \
-       gettimeofday(&start, NULL);                                     \
+       gettimeofday(&start, NULL);
 
 #ifdef __GLIBC__
 #define END_TIMING()                                                   \
@@ -64,7 +90,7 @@
        debug_print("TIMING %s %s: %ds%03dms\n",                        \
                __FUNCTION__,                                           \
                timing_name, (unsigned int)diff.tv_sec,                 \
-               (unsigned int)diff.tv_usec/1000);                       
+               (unsigned int)diff.tv_usec/1000);
 #else
 #define END_TIMING()                                                   \
        gettimeofday(&end, NULL);                                       \
 
 #endif 
 #endif 
+#endif
index f0a5c9fec1e6c263f25c29cd4a3f3b1c568c3174..79d5296fb5206ffb0706b08e9e440d18b8254c59 100644 (file)
@@ -57,6 +57,7 @@
 #  include <direct.h>
 #  include <io.h>
 #  include <fcntl.h>
+#  include <w32lib.h>
 #endif
 
 #ifdef MAEMO
@@ -75,6 +76,18 @@ static gboolean debug_mode = FALSE;
 static GSList *tempfiles=NULL;
 #endif
 
+/* Return true if we are running as root.  This function should beused
+   instead of getuid () == 0.  */
+gboolean superuser_p (void)
+{
+#ifdef G_OS_WIN32
+  return w32_is_administrator ();
+#else
+  return !getuid();
+#endif  
+}
+
+
 
 #if !GLIB_CHECK_VERSION(2, 7, 0) && !defined(G_OS_UNIX)
 gint g_chdir(const gchar *path)
@@ -4766,7 +4779,12 @@ gint copy_dir(const gchar *src, const gchar *dst)
                                g_dir_close(dir);
                                return r;
                        }
-               } else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
+                }
+#ifndef G_OS_WIN32
+                /* Windows has no symlinks.  Or well, Vista seems to
+                   have something like this but the semantics might be
+                   different.  Thus we don't use it under Windows. */
+                else if (g_file_test(old_file, G_FILE_TEST_IS_SYMLINK)) {
                        GError *error;
                        gint r = 0;
                        gchar *target = g_file_read_link(old_file, &error);
@@ -4777,7 +4795,9 @@ gint copy_dir(const gchar *src, const gchar *dst)
                                g_dir_close(dir);
                                return r;
                        }
-               } else if (g_file_test(old_file, G_FILE_TEST_IS_DIR)) {
+                 }
+#endif /*G_OS_WIN32*/
+               else if (g_file_test(old_file, G_FILE_TEST_IS_DIR)) {
                        gint r = copy_dir(old_file, new_file);
                        if (r < 0) {
                                g_dir_close(dir);
index 294df6de8da4ddb346ede6c06f8ad9c48cd966f0..dcddfd35854aecd622975b4dfb4df0e5317070a5 100644 (file)
@@ -204,6 +204,14 @@ gboolean debug_get_mode            (void);
 #define Str(x) #x
 #define Xstr(x)        Str(x)
 
+
+/* System related stuff.  */
+
+gboolean superuser_p (void);
+
+
+/* String utilities.  */
+
 void list_free_strings         (GList          *list);
 void slist_free_strings                (GSList         *list);
 
diff --git a/src/common/w32_account.c b/src/common/w32_account.c
new file mode 100644 (file)
index 0000000..97dbd4a
--- /dev/null
@@ -0,0 +1,149 @@
+/* w32_account.c - Account related W32 functions.
+   Copyright (C) 2007 g10 Code GmbH 
+   Copyright (C) 1999-2005 Nullsoft, Inc.
+
+   This software is provided 'as-is', without any express or implied
+   warranty. In no event will the authors be held liable for any
+   damages arising from the use of this software.
+   
+   Permission is granted to anyone to use this software for any
+   purpose, including commercial applications, and to alter it and
+   redistribute it freely, subject to the following restrictions:
+   
+   1. The origin of this software must not be misrepresented; you must
+      not claim that you wrote the original software. If you use this
+      software in a product, an acknowledgment in the product
+      documentation would be appreciated but is not required.
+   
+   2. Altered source versions must be plainly marked as such, and must
+      not be misrepresented as being the original software.
+   
+   3. This notice may not be removed or altered from any source
+      distribution.
+
+ =======[ wk 2007-05-21 ]====
+   The code for get_group_name has been taken from NSIS 2.05, module
+   UserInfo.c.  NSIS bears the above license and along with the
+   notice:
+     This license applies to everything in the NSIS package, except where
+     otherwise noted.
+   Thus we make this module available under the same license - note,
+   that this lincese is fully compatibe with the GNU GPL 2.0.
+*/ 
+  
+  
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "w32lib.h"
+
+#ifndef DIM
+#define DIM(v)  (sizeof(v)/sizeof((v)[0]))
+#endif
+
+
+/* Return a malloced name of our user group.  */
+static char *
+get_group_name (void)
+{
+  HANDLE        hThread;
+  TOKEN_GROUPS  *ptg = NULL;
+  DWORD         cbTokenGroups;
+  DWORD         i, j;
+  SID_IDENTIFIER_AUTHORITY SystemSidAuthority = { SECURITY_NT_AUTHORITY };
+  char *group;
+  struct
+  {
+    DWORD auth_id;
+    char *name;
+  } groups[] = 
+    {
+      /* Every user belongs to the users group, hence
+         users comes before guests */
+      {DOMAIN_ALIAS_RID_USERS, "User"},
+      {DOMAIN_ALIAS_RID_GUESTS, "Guest"},
+      {DOMAIN_ALIAS_RID_POWER_USERS, "Power"},
+      {DOMAIN_ALIAS_RID_ADMINS, "Admin"}
+    };
+
+
+  group = NULL;
+  if (GetVersion() & 0x80000000) 
+    {
+      /* This is not NT; thus we are always Admin. */
+      group = "Admin";
+    }
+  else if (OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, FALSE, &hThread) 
+           || OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hThread))
+    {
+      /* With the token for the current thread or process in hand we
+         query the size of the associated group information.  Note
+         that we expect an error because buffer has been passed as
+         NULL. cbTokenGroups will then tell use the required size.  */
+      if (!GetTokenInformation (hThread, TokenGroups, NULL, 0, &cbTokenGroups)
+          && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
+        {
+          ptg = GlobalAlloc (GPTR, cbTokenGroups);
+          if (ptg)
+            {
+              if (GetTokenInformation ( hThread, TokenGroups, ptg,
+                                        cbTokenGroups, &cbTokenGroups))
+                {
+
+                  /* Now iterate through the list of groups for this
+                     access token looking for a match against the SID
+                     we created above. */
+                  for (i = 0; i < DIM (groups); i++)
+                    {
+                      PSID psid = 0;
+                      
+                      AllocateAndInitializeSid (&SystemSidAuthority,
+                                                2,
+                                                SECURITY_BUILTIN_DOMAIN_RID,
+                                                groups[i].auth_id,
+                                                0, 0, 0, 0, 0, 0,
+                                                &psid);
+                      if (!psid) 
+                        continue;
+                      for (j = 0; j < ptg->GroupCount; j++)
+                        if (EqualSid(ptg->Groups[j].Sid, psid))
+                          group = groups[i].name;
+                      FreeSid(psid);
+                    }
+                }
+              
+              GlobalFree(ptg);
+            }
+        }
+      
+      CloseHandle(hThread);
+    }
+
+  return group? strdup (group):NULL;
+}
+
+
+/* Return true if we are an administrator.  The chekc is done only
+   once so if the current user has been hadded to the Administrator
+   group the process needs to be rerstarted. */
+int
+w32_is_administrator (void)
+{
+  static int got_it;
+  static int is_admin;
+
+  if (!got_it)
+    {
+      char *name = get_group_name ();
+
+      if (name && !strcmp (name, "Admin"))
+        is_admin = 1;
+      got_it = 1;
+      free (name);
+    }
+
+  return is_admin;
+}
+
index 7292cdd42f8d83acde944a514345cbdce664e84c..d77d058d9c10495b87b825599aabe47bc2744df0 100644 (file)
 
 /* Changes are:
 
+2007-05-21  Werner Koch  <wk@g10code.com>
+
+       * src/common/w32_account.c: New.
+
+       * src/common/w32lib.h: Undef "interface".
+
 2005-11-17  Werner Koch  <wk@g10code.com>
 
        Add boilerplate text to all files and explain legal status.
 #include <dirent.h>
 #endif
 
+/* Mingw32 3.4.4 defines interface to struct and thus breaks our own
+   use of that symbol.  Undef it here. */
+#if defined(_BASETYPS_H) && defined(interface) 
+#undef interface
+#endif
+
+
 /* types */
 /*** ??? ***/
 #ifndef __MINGW32__
@@ -188,8 +201,18 @@ int kill( pid_t pid, int sig );
 FILE *popen( const char *command, const char *type );
 int pclose( FILE *stream );
 
+/*** w32_account.c ***/
+int w32_is_administrator (void);
+
 /*** misc ***/
 char *read_w32_registry_string( char *parent, char *section, char *key );
 char *get_content_type_from_registry_with_ext( char *ext );
 
+\f
+/* Simulate thread-safe versions of some functions.  */
+#define gmtime_r(time, resultp) gmtime (time)
+#define localtime_r(time, resultp) localtime (time)
+#define asctime_r(time, buffer) asctime (time)
+#define ctime_r(time, buffer) ctime (time)
+
 #endif
index 99aec7ebafd3a329cc16c8a1f286332675bb8b3e..409465d44be79e6da4b087a89d8020a1cc35a581 100644 (file)
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#ifdef G_OS_WIN32
+#  include <w32lib.h>
+#endif
+
 #include "mgutils.h"
 #include "utils.h"
 #include "exporthtml.h"
index 60b679ef348d71b642f48f2c9c8d4933683e73a6..597aabbc3b095bd918f2054ca0a0e7e3511c1578 100644 (file)
@@ -66,6 +66,7 @@ clawsgtkinclude_HEADERS = \
 
 AM_CPPFLAGS = \
        -I$(srcdir)/../common \
+       -I../common \
        -I$(srcdir)/.. \
        $(GTK_CFLAGS) \
        $(OPENSSL_CFLAGS) \
index f8d84036b4bc4bfb8dbc4573d28be3e38cef59f0..cc4033ff41c70922df31ed5bc43acbbbfbe38022 100644 (file)
@@ -339,7 +339,7 @@ GtkWidget *colorlabel_create_check_color_menu_item(gint color_index, gboolean fo
        gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
        if (color_index < 9) {
-               accel = g_strdup_printf("Ctrl+%c", '1'+color_index);
+               accel = g_strdup_printf(_("Ctrl+%c"), '1'+color_index);
                label = gtk_label_new(accel);
                gtk_widget_show(label);
                gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
index 5263d505b2d6e8ce1d3bc85bdf82595d3c0dcde7..a0e069afd354cef5eb4a50552f69fba7296fdbb7 100644 (file)
 #include <time.h>
 #include <errno.h>
 
+#ifdef G_OS_WIN32
+#  include <w32lib.h>
+#endif
+
 #include "mbox.h"
 #include "procmsg.h"
 #include "folder.h"
index 0ee9da9687e92f65e55c72aa994ada3fa4c89461..4323108dba7ca69f6ee0a6c574fef9b3ed642d73 100644 (file)
 
 #include <glib.h>
 #include <glib/gi18n.h>
-#include <sys/mman.h>
+#ifdef _WIN32
+# include <w32lib.h>
+# define MAP_FAILED    ((char *) -1)
+#else
+# include <sys/mman.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -622,8 +627,23 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
                        map_len = st.st_size;
                else
                        map_len = -1;
-               if (map_len > 0)
+               if (map_len > 0) {
+#ifdef G_OS_WIN32
+                       cache_data = NULL;
+                       HANDLE hFile, hMapping;
+                       hFile = (HANDLE) _get_osfhandle (fileno(fp));
+                       if (hFile == (HANDLE) -1)
+                               goto w32_fail;
+                       hMapping = CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0, NULL);
+                       if (!hMapping)
+                               goto w32_fail;
+                       cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+               w32_fail:
+                       ;
+#else
                        cache_data = mmap(NULL, map_len, PROT_READ, MAP_PRIVATE, fileno(fp), 0);
+#endif
+               }
        } else {
                cache_data = NULL;
        }
@@ -679,8 +699,12 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
                        if(msginfo->msgid)
                                g_hash_table_insert(cache->msgid_table, msginfo->msgid, msginfo);
                }
-               
+
+#ifdef G_OS_WIN32
+               UnmapViewOfFile((void*) cache_data);
+#else
                munmap(cache_data, map_len);
+#endif
        } else {
                while (fread(&num, sizeof(num), 1, fp) == 1) {
                        if (swapping)
@@ -785,8 +809,23 @@ void msgcache_read_mark(MsgCache *cache, const gchar *mark_file)
                        map_len = st.st_size;
                else
                        map_len = -1;
-               if (map_len > 0)
+               if (map_len > 0) {
+#ifdef G_OS_WIN32
+                       cache_data = NULL;
+                       HANDLE hFile, hMapping;
+                       hFile = (HANDLE) _get_osfhandle (fileno(fp));
+                       if (hFile == (HANDLE) -1)
+                               goto w32_fail2;
+                       hMapping = CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0, NULL);
+                       if (!hMapping)
+                               goto w32_fail2;
+                       cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+               w32_fail2:
+                       ;
+#else
                        cache_data = mmap(NULL, map_len, PROT_READ, MAP_PRIVATE, fileno(fp), 0);
+#endif
+               }
        } else {
                cache_data = NULL;
        }
@@ -802,7 +841,11 @@ void msgcache_read_mark(MsgCache *cache, const gchar *mark_file)
                                msginfo->flags.perm_flags = perm_flags;
                        }
                }
+#ifdef G_OS_WIN32
+               UnmapViewOfFile((void*) cache_data);
+#else
                munmap(cache_data, map_len);
+#endif
        } else {
                while (fread(&num, sizeof(num), 1, fp) == 1) {
                        if (swapping)
@@ -849,8 +892,23 @@ void msgcache_read_tags(MsgCache *cache, const gchar *tags_file)
                        map_len = st.st_size;
                else
                        map_len = -1;
-               if (map_len > 0)
+               if (map_len > 0) {
+#ifdef G_OS_WIN32
+                       cache_data = NULL;
+                       HANDLE hFile, hMapping;
+                       hFile = (HANDLE) _get_osfhandle (fileno(fp));
+                       if (hFile == (HANDLE) -1)
+                               goto w32_fail6;
+                       hMapping = CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0, NULL);
+                       if (!hMapping)
+                               goto w32_fail6;
+                       cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+               w32_fail6:
+                       ;
+#else
                        cache_data = mmap(NULL, map_len, PROT_READ, MAP_PRIVATE, fileno(fp), 0);
+#endif
+               }
        } else {
                cache_data = NULL;
        }
@@ -876,7 +934,11 @@ void msgcache_read_tags(MsgCache *cache, const gchar *tags_file)
                                msginfo->tags = g_slist_reverse(msginfo->tags);
                        }
                }
+#ifdef G_OS_WIN32
+               UnmapViewOfFile((void*) cache_data);
+#else
                munmap(cache_data, map_len);
+#endif
        } else {
                while (fread(&num, sizeof(num), 1, fp) == 1) {
                        gint id = -1;
@@ -1164,26 +1226,78 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
        if (msgcache_use_mmap_write && cache->memusage > 0) {
                map_len = cache->memusage;
                if (ftruncate(fileno(write_fps.cache_fp), (off_t)map_len) == 0) {
+
+#ifdef G_OS_WIN32
+                       cache_data = NULL;
+                       HANDLE hFile, hMapping;
+                       hFile = (HANDLE) _get_osfhandle (fileno(write_fps.cache_fp));
+                       if (hFile == (HANDLE) -1)
+                               goto w32_fail3;
+                       hMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
+                       if (!hMapping)
+                               goto w32_fail3;
+                       cache_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+               w32_fail3:
+                       ;
+#else
                        cache_data = mmap(NULL, map_len, PROT_WRITE, MAP_SHARED, 
                                fileno(write_fps.cache_fp), 0);
+#endif
                }
                if (cache_data != NULL && cache_data != MAP_FAILED) {
                        if (ftruncate(fileno(write_fps.mark_fp), (off_t)map_len) == 0) {
+#ifdef G_OS_WIN32
+                               mark_data = NULL;
+                               HANDLE hFile, hMapping;
+                               hFile = (HANDLE) _get_osfhandle (fileno(write_fps.mark_fp));
+                               if (hFile == (HANDLE) -1)
+                                       goto w32_fail4;
+                               hMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
+                               if (!hMapping)
+                                       goto w32_fail4;
+                               mark_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+                       w32_fail4:
+                               ;
+#else
                                mark_data = mmap(NULL, map_len, PROT_WRITE, MAP_SHARED, 
                                        fileno(write_fps.mark_fp), 0);
+#endif
                        } 
                        if (mark_data == NULL || mark_data == MAP_FAILED) {
+#ifdef G_OS_WIN32
+                               UnmapViewOfFile((void*) cache_data);
+#else
                                munmap(cache_data, map_len);
+#endif
                                cache_data = NULL;
                        } else {
                                if (ftruncate(fileno(write_fps.tags_fp), (off_t)map_len) == 0) {
+#ifdef G_OS_WIN32
+                                               tags_data = NULL;
+                                               HANDLE hFile, hMapping;
+                                               hFile = (HANDLE) _get_osfhandle (fileno(write_fps.tags_fp));
+                                               if (hFile == (HANDLE) -1)
+                                                       goto w32_fail5;
+                                               hMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
+                                               if (!hMapping)
+                                                       goto w32_fail5;
+                                               tags_data = (unsigned char *)MapViewOfFile(hMapping, FILE_MAP_COPY, 0, 0, 0);
+                                       w32_fail5:
+                                               ;
+#else
                                        tags_data = mmap(NULL, map_len, PROT_WRITE, MAP_SHARED, 
                                                fileno(write_fps.tags_fp), 0);
+#endif
                                } 
                                if (tags_data == NULL || tags_data == MAP_FAILED) {
+#ifdef G_OS_WIN32
+                                       UnmapViewOfFile((void*) cache_data);
+                                       UnmapViewOfFile((void*) mark_data);
+#else
                                        munmap(cache_data, map_len);
-                                       cache_data = NULL;
                                        munmap(mark_data, map_len);
+#endif
+                                       cache_data = NULL;
                                        mark_data = NULL;
                                } 
                        }
@@ -1195,9 +1309,15 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
                write_fps.mark_data = mark_data + ftell(write_fps.mark_fp);
                write_fps.tags_data = mark_data + ftell(write_fps.tags_fp);
                g_hash_table_foreach(cache->msgnum_table, msgcache_write_mmap_func, (gpointer)&write_fps);
+#ifdef G_OS_WIN32
+               UnmapViewOfFile((void*) cache_data);
+               UnmapViewOfFile((void*) mark_data);
+               UnmapViewOfFile((void*) tags_data);
+#else
                munmap(cache_data, map_len);
                munmap(mark_data, map_len);
                munmap(tags_data, map_len);
+#endif
                ftruncate(fileno(write_fps.cache_fp), write_fps.cache_size);
                ftruncate(fileno(write_fps.mark_fp), write_fps.mark_size);
                ftruncate(fileno(write_fps.tags_fp), write_fps.tags_size);
index 827a7a421abcc55ec4888f31b8b288fb0b794640..05841fa6aa363ddf95859015402ed8fae8804194 100644 (file)
@@ -72,6 +72,7 @@ pgpcore_la_LIBADD = $(cygwin_export_lib) $(plugin_ldadd) \
 INCLUDES = \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/common \
+       -I$(top_builddir)/src/common \
        -I$(top_srcdir)/src/gtk
 
 AM_CPPFLAGS = \
index a7fed853e917eb1bc61f942c97b6a0d523fb0509..7868955944d51571ffc83929e9292bedcebeda8d 100644 (file)
@@ -1,26 +1,37 @@
 LIBRARY CLAWS-MAIL.EXE
 EXPORTS
+account_get_default
 alertpanel
-alertpanel_full
 alertpanel_error
+alertpanel_full
+check_plugin_version
 copy_file_part
 debug_print_real
 debug_srcname
+extract_address
 get_rc_dir
 get_tmp_file
+gtkut_get_options_frame
 gtkut_stock_button_set_create
+gtkut_window_new
 input_dialog
+label_window_create
+label_window_destroy
 mainwindow_get_mainwindow
 manage_window_destroy
 manage_window_focus_in
 manage_window_focus_out
 manage_window_set_transient
 manage_window_unmap
+mimeview_register_viewer_factory
+mimeview_unregister_viewer_factory
 prefs_account_get_privacy_prefs
 prefs_account_register_page
 prefs_account_set_privacy_prefs
 prefs_account_unregister_page
 prefs_button_toggled
+prefs_button_toggled_reverse
+prefs_common
 prefs_file_close
 prefs_file_close_revert
 prefs_gtk_register_page
@@ -30,6 +41,12 @@ prefs_set_block_label
 prefs_set_default
 prefs_write_open
 prefs_write_param
-claws_get_version
-privacy_set_error
 privacy_get_error
+privacy_set_error
+textview_clear
+textview_create
+textview_destroy
+textview_init
+textview_set_font
+textview_show_icon
+textview_show_mime_part
index 4629bcb0f0050fc24273ee71189214ede277a971..db1796646187f32fd678db8ab707a20d613368d5 100644 (file)
@@ -44,7 +44,7 @@
 #include <string.h>
 #include <sys/types.h>
 #ifdef G_OS_WIN32
-#include <windows.h>
+#include <w32lib.h>
 #else
 #include <sys/mman.h>
 #endif
index 7ad953f0363f3fe337ae540022070288581faac4..869db8ae936e933bd7355a8de603f7277c52331c 100644 (file)
@@ -26,7 +26,9 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <sys/types.h>
-#include <sys/wait.h>
+#ifndef G_OS_WIN32
+#  include <sys/wait.h>
+#endif
 #if (defined(__DragonFly__) || defined (__NetBSD__) || defined (__FreeBSD__) || defined (__OpenBSD__))
 #  include <sys/signal.h>
 #endif
index a9a1dcef803e910dfb1603241ea359d05ed0c719..1bc043a15b802632369361b9b1c830112390aee3 100644 (file)
@@ -1,13 +1,15 @@
 EXPORTS
-        plugin_init
+        plugin_desc
         plugin_done
+        plugin_init
+        plugin_licence
         plugin_name
-        plugin_desc
+       plugin_provides
         plugin_type
-        plugin_licence
         plugin_version
 
         sgpgme_data_from_mimeinfo
+       sgpgme_data_release_and_get_mem
         sgpgme_decrypt_verify
         sgpgme_get_encrypt_data
         sgpgme_setup_signers
@@ -17,4 +19,5 @@ EXPORTS
         sgpgme_verify_signature
 
         gpgmegtk_passphrase_cb
+        prefs_gpg_enable_agent
         prefs_gpg_get_config
index b6bbbc5e4bfa96fc61f2ab99f0cd156781f63b3e..130713015164108f428d3c40d4a60afb8466c934 100644 (file)
@@ -33,7 +33,9 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/wait.h>
+#ifndef G_OS_WIN32
+#  include <sys/wait.h>
+#endif
 #if (defined(__DragonFly__) || defined (__NetBSD__) || defined (__FreeBSD__) || defined (__OpenBSD__))
 #  include <sys/signal.h>
 #endif
index 93efc6fd6cf2ace6a42e6b338a3277ccd53b7cda..25c88346ed8a57b45dfb14f483db91b74f95ed94 100644 (file)
@@ -71,6 +71,7 @@ pgpinline_la_LIBADD = $(plugin_ldadd) $(pgpcore_lib) $(cygwin_export_lib) \
 INCLUDES = \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/common \
+       -I$(top_builddir)/src/common \
        -I$(top_srcdir)/src/gtk
 
 AM_CPPFLAGS = \
index 2a13e76112d5cf506905d27dcbe1173e20f172e0..02d08cd02616ffc8c69b89af0f8e3d012cd814d4 100644 (file)
@@ -1,5 +1,6 @@
 LIBRARY CLAWS-MAIL.EXE
 EXPORTS
+check_plugin_version
 codeconv_set_strict
 conv_codeset_strdup
 conv_get_locale_charset_str_no_utf8
@@ -8,6 +9,8 @@ debug_srcname
 get_mime_tmp_dir
 my_tmpfile
 privacy_register_system
+privacy_reset_error
+privacy_set_error
 privacy_unregister_system
 procmime_decode_content
 procmime_encode_content
@@ -16,7 +19,3 @@ procmime_mimeinfo_get_parameter
 procmime_mimeinfo_parent
 procmime_scan_file
 procmime_write_mimeinfo
-claws_get_version
-privacy_set_error
-privacy_get_error
-privacy_reset_error
index 16d96c9c70213fe541232a61f8e62bbda31b8c80..5243e420da569c4b432947167f24c8a0bfdef053 100644 (file)
@@ -1,14 +1,16 @@
 LIBRARY PGPCORE.DLL
 EXPORTS
-        sgpgme_data_from_mimeinfo
-        sgpgme_decrypt_verify
-        sgpgme_get_encrypt_data
-        sgpgme_setup_signers
-        sgpgme_sigstat_gpgme_to_privacy
-        sgpgme_sigstat_info_full
-        sgpgme_sigstat_info_short
-        sgpgme_verify_signature
-        gpgmegtk_passphrase_cb
-        prefs_gpg_get_config
-
-
+gpgmegtk_passphrase_cb
+prefs_gpg_add_skip_encryption_warning
+prefs_gpg_enable_agent
+prefs_gpg_get_config
+prefs_gpg_remove_skip_encryption_warning
+prefs_gpg_should_skip_encryption_warning
+sgpgme_data_release_and_get_mem
+sgpgme_decrypt_verify
+sgpgme_get_encrypt_data
+sgpgme_setup_signers
+sgpgme_sigstat_gpgme_to_privacy
+sgpgme_sigstat_info_full
+sgpgme_sigstat_info_short
+sgpgme_verify_signature
index 56a15075b3deaa897d35851a791a1f07bbab101a..8916a5d7c3b8ef989dcd1513fc5dd7405b7a57e1 100644 (file)
@@ -1,9 +1,10 @@
 EXPORTS
-        plugin_init
+        plugin_desc
         plugin_done
+        plugin_init
+        plugin_licence
         plugin_name
-        plugin_desc
         plugin_type
-        plugin_licence
+       plugin_provides
         plugin_version
 
index 1facc7594e2a219e1bb40973c1392e85dbb01038..c7f3fdf35b7d0cf393caf45e9e61c70c35b77e9d 100644 (file)
@@ -70,6 +70,7 @@ pgpmime_la_LIBADD = $(plugin_ldadd) $(pgpcore_lib) $(cygwin_export_lib) \
 INCLUDES = \
        -I$(top_srcdir)/src \
        -I$(top_srcdir)/src/common \
+       -I$(top_builddir)/src/common \
        -I$(top_srcdir)/src/gtk
 
 AM_CPPFLAGS = \
index f53700fd3009f3824a909848868b770d49590ebc..fe03c78794d842bf445772050aab5a876a9179e7 100644 (file)
@@ -1,6 +1,7 @@
 LIBRARY CLAWS-MAIL.EXE
 EXPORTS
 canonicalize_str
+check_plugin_version
 debug_print_real
 debug_srcname
 file_read_stream_to_str
@@ -8,6 +9,8 @@ generate_mime_boundary
 get_mime_tmp_dir
 my_tmpfile
 privacy_register_system
+privacy_reset_error
+privacy_set_error
 privacy_unregister_system
 procmime_mimeinfo_free_all
 procmime_mimeinfo_get_parameter
@@ -15,7 +18,3 @@ procmime_mimeinfo_new
 procmime_mimeinfo_parent
 procmime_scan_file
 procmime_write_mimeinfo
-claws_get_version
-privacy_set_error
-privacy_get_error
-privacy_reset_error
index 16d96c9c70213fe541232a61f8e62bbda31b8c80..14e219fe0bf70be10487253b6cbb1354a34526b7 100644 (file)
@@ -1,14 +1,17 @@
 LIBRARY PGPCORE.DLL
 EXPORTS
-        sgpgme_data_from_mimeinfo
-        sgpgme_decrypt_verify
-        sgpgme_get_encrypt_data
-        sgpgme_setup_signers
-        sgpgme_sigstat_gpgme_to_privacy
-        sgpgme_sigstat_info_full
-        sgpgme_sigstat_info_short
-        sgpgme_verify_signature
-        gpgmegtk_passphrase_cb
-        prefs_gpg_get_config
-
-
+gpgmegtk_passphrase_cb
+prefs_gpg_add_skip_encryption_warning
+prefs_gpg_enable_agent
+prefs_gpg_get_config
+prefs_gpg_remove_skip_encryption_warning
+prefs_gpg_should_skip_encryption_warning
+sgpgme_data_from_mimeinfo
+sgpgme_data_release_and_get_mem
+sgpgme_decrypt_verify
+sgpgme_get_encrypt_data
+sgpgme_setup_signers
+sgpgme_sigstat_gpgme_to_privacy
+sgpgme_sigstat_info_full
+sgpgme_sigstat_info_short
+sgpgme_verify_signature
index 5a56fdc36723c53497edf640be8763ad281b3bfc..4e547b511370276b7be447ad49bd0c99037cde43 100644 (file)
@@ -1,8 +1,9 @@
 EXPORTS
-        plugin_init
+        plugin_desc
         plugin_done
+        plugin_init
+        plugin_licence
         plugin_name
-        plugin_desc
         plugin_type
-        plugin_licence
+       plugin_provides
         plugin_version
index 04b0b54237f59d0ec528acedf9b984f96bf6d63d..e2a3ece9474b6eb93adc5aebd9f4b226da7b0622 100644 (file)
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
+#ifdef G_OS_WIN32
+#  include <w32lib.h>
+#endif
+
 #include "prefs_common.h"
 #include "prefs_gtk.h"
 #include "prefs_summary_open.h"
index c0048dc0e39d18d29c66a9ca7b5816bd27162dfe..7aedbd0ce498a47283878e7bdf309d06fea78d92 100644 (file)
@@ -445,7 +445,7 @@ static void prefs_themes_btn_remove_clicked_cb(GtkWidget *widget, gpointer data)
        tmp = g_path_get_basename(theme_str);
 
        if (IS_SYSTEM_THEME(theme_str)) {
-               if (getuid() != 0) {
+               if (!superuser_p()) {
                        alertpanel_error(_("Only root can remove system themes"));
                        return;
                }
@@ -518,7 +518,7 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data
                if (G_ALERTALTERNATE != val)
                        goto end_inst;
        }
-       if (getuid() == 0) {
+       if (superuser_p ()) {
                val = alertpanel(alert_title,
                                 _("Do you want to install theme for all users?"),
                                 GTK_STOCK_NO, GTK_STOCK_YES, NULL);
index 2cad299a194896ca7e1b88429c080994a2580d2f..31f42ef1e2db19ac1c3fc6d50ba0d7e92ddabf7d 100644 (file)
 #include <time.h>
 #include <sys/stat.h>
 
+#ifdef G_OS_WIN32
+#  include <w32lib.h>
+#endif
+
 #include "procheader.h"
 #include "procmsg.h"
 #include "codeconv.h"