2005-12-23 [cleroy] 1.9.100cvs104
* autogen.sh * src/folder.c * src/mh.c * src/common/plugin.c * src/common/socket.c * src/common/socket.h * src/common/utils.c * src/common/utils.h * src/gtk/pluginwindow.c * src/plugins/pgpcore/plugin.def * src/plugins/pgpcore/sylpheed.def * src/plugins/pgpinline/Makefile.am * src/plugins/pgpinline/plugin.def * src/plugins/pgpinline/sylpheed.def * src/plugins/pgpmime/plugin.def * src/plugins/pgpmime/sylpheed.def Various w32 fixes by Werner Koch
This commit is contained in:
parent
b6a48fdbe9
commit
820b22c7ae
19 changed files with 321 additions and 166 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2005-12-23 [cleroy] 1.9.100cvs104
|
||||
|
||||
* autogen.sh
|
||||
* src/folder.c
|
||||
* src/mh.c
|
||||
* src/common/plugin.c
|
||||
* src/common/socket.c
|
||||
* src/common/socket.h
|
||||
* src/common/utils.c
|
||||
* src/common/utils.h
|
||||
* src/gtk/pluginwindow.c
|
||||
* src/plugins/pgpcore/plugin.def
|
||||
* src/plugins/pgpcore/sylpheed.def
|
||||
* src/plugins/pgpinline/Makefile.am
|
||||
* src/plugins/pgpinline/plugin.def
|
||||
* src/plugins/pgpinline/sylpheed.def
|
||||
* src/plugins/pgpmime/plugin.def
|
||||
* src/plugins/pgpmime/sylpheed.def
|
||||
Various w32 fixes by Werner Koch
|
||||
|
||||
2005-12-22 [paul] 1.9.100cvs103
|
||||
|
||||
* src/wizard.c
|
||||
|
|
|
@ -1087,3 +1087,4 @@
|
|||
( cvs diff -u -r 1.654.2.1130 -r 1.654.2.1131 configure.ac; cvs diff -u -r 1.5.10.1 -r 1.5.10.2 COPYING; cvs diff -u -r 1.382.2.209 -r 1.382.2.210 src/compose.c; cvs diff -u -r 1.17.2.24 -r 1.17.2.25 src/send_message.c; cvs diff -u -r 1.11.2.14 -r 1.11.2.15 src/common/smtp.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpcore/sylpheed.def; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/sylpheed.def; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/sylpheed.def; ) > 1.9.100cvs101.patchset
|
||||
( cvs diff -u -r 1.100.2.30 -r 1.100.2.31 AUTHORS; cvs diff -u -r 1.274.2.82 -r 1.274.2.83 src/mainwindow.c; cvs diff -u -r 1.39.2.10 -r 1.39.2.11 src/mainwindow.h; cvs diff -u -r 1.43.2.34 -r 1.43.2.35 src/toolbar.c; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/gtk/authors.h; ) > 1.9.100cvs102.patchset
|
||||
( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/wizard.c; ) > 1.9.100cvs103.patchset
|
||||
( cvs diff -u -r 1.4.2.5 -r 1.4.2.6 autogen.sh; cvs diff -u -r 1.213.2.71 -r 1.213.2.72 src/folder.c; cvs diff -u -r 1.79.2.20 -r 1.79.2.21 src/mh.c; cvs diff -u -r 1.13.2.13 -r 1.13.2.14 src/common/plugin.c; cvs diff -u -r 1.13.2.18 -r 1.13.2.19 src/common/socket.c; cvs diff -u -r 1.13.2.4 -r 1.13.2.5 src/common/socket.h; cvs diff -u -r 1.36.2.49 -r 1.36.2.50 src/common/utils.c; cvs diff -u -r 1.20.2.28 -r 1.20.2.29 src/common/utils.h; cvs diff -u -r 1.5.2.23 -r 1.5.2.24 src/gtk/pluginwindow.c; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpcore/plugin.def; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpcore/sylpheed.def; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpinline/Makefile.am; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpinline/plugin.def; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpinline/sylpheed.def; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpmime/plugin.def; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/pgpmime/sylpheed.def; ) > 1.9.100cvs104.patchset
|
||||
|
|
|
@ -39,7 +39,7 @@ if test "$1" = "--build-w32"; then
|
|||
--with-config-dir="Sylpheed-claws" \
|
||||
--disable-openssl --disable-dillo-viewer-plugin \
|
||||
--disable-nls --disable-libetpan --disable-aspell \
|
||||
--disable-trayicon-plugin \
|
||||
--disable-trayicon-plugin --disable-spamassassin-plugin \
|
||||
PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig"
|
||||
|
||||
rc=$?
|
||||
|
|
|
@ -11,7 +11,7 @@ MINOR_VERSION=9
|
|||
MICRO_VERSION=100
|
||||
INTERFACE_AGE=0
|
||||
BINARY_AGE=0
|
||||
EXTRA_VERSION=103
|
||||
EXTRA_VERSION=104
|
||||
EXTRA_RELEASE=
|
||||
EXTRA_GTK2_VERSION=
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ static Plugin *plugin_get_by_filename(const gchar *filename)
|
|||
* Loads a plugin dependancies
|
||||
*
|
||||
* Plugin dependancies are, optionnaly, listed in a file in
|
||||
* PLUGINDIR/$pluginname.deps.
|
||||
* get_plugin_dir()/$pluginname.deps.
|
||||
* \param filename The filename of the plugin for which we have to load deps
|
||||
* \param error The location where an error string can be stored
|
||||
* \return 0 on success, -1 otherwise
|
||||
|
@ -130,22 +130,6 @@ static gint plugin_load_deps(const gchar *filename, gchar **error)
|
|||
gchar *deps_file = NULL;
|
||||
FILE *fp = NULL;
|
||||
gchar buf[BUFFSIZE];
|
||||
#ifdef G_OS_WIN32
|
||||
char *fnamebuf;
|
||||
const char *s;
|
||||
|
||||
s = strchr (filename, '/');
|
||||
if (s)
|
||||
s++;
|
||||
else
|
||||
s = filename;
|
||||
fnamebuf = g_strconcat(sylpheed_get_startup_dir(),
|
||||
"\\lib\\sylpheed-claws\\plugins\\",
|
||||
s,
|
||||
NULL);
|
||||
filename = fnamebuf;
|
||||
|
||||
#endif
|
||||
|
||||
tmp = g_strdup(filename);
|
||||
*strrchr(tmp, '.') = '\0';
|
||||
|
@ -162,7 +146,7 @@ static gint plugin_load_deps(const gchar *filename, gchar **error)
|
|||
Plugin *dep_plugin = NULL;
|
||||
gchar *path = NULL;
|
||||
buf[strlen(buf)-1]='\0'; /* chop off \n */
|
||||
path = g_strconcat(PLUGINDIR, buf,
|
||||
path = g_strconcat(get_plugin_dir(), buf,
|
||||
".", G_MODULE_SUFFIX, NULL);
|
||||
if ((dep_plugin = plugin_get_by_filename(path)) == NULL) {
|
||||
debug_print("trying to load %s\n", path);
|
||||
|
@ -184,9 +168,6 @@ static gint plugin_load_deps(const gchar *filename, gchar **error)
|
|||
}
|
||||
}
|
||||
fclose(fp);
|
||||
#ifdef G_OS_WIN32
|
||||
g_free (fnamebuf);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include <sys/types.h>
|
||||
#ifdef G_OS_WIN32
|
||||
# include <winsock2.h>
|
||||
# ifndef EINPROGRESS
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
# endif
|
||||
#else
|
||||
# if HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
|
@ -61,7 +64,12 @@
|
|||
#error USE_GIO is currently not supported
|
||||
#endif
|
||||
|
||||
#if G_IO_WIN32
|
||||
#define BUFFSIZE 8191
|
||||
#else
|
||||
#define BUFFSIZE 8192
|
||||
#endif
|
||||
|
||||
|
||||
typedef gint (*SockAddrFunc) (GList *addr_list,
|
||||
gpointer data);
|
||||
|
@ -91,6 +99,8 @@ struct _SockLookupData {
|
|||
guint io_tag;
|
||||
SockAddrFunc func;
|
||||
gpointer data;
|
||||
gushort port;
|
||||
gint pipe_fds[2];
|
||||
};
|
||||
|
||||
struct _SockAddrData {
|
||||
|
@ -141,7 +151,6 @@ static gint sock_connect_by_getaddrinfo (const gchar *hostname,
|
|||
static SockInfo *sockinfo_from_fd(const gchar *hostname,
|
||||
gushort port,
|
||||
gint sock);
|
||||
#ifdef G_OS_UNIX
|
||||
static void sock_address_list_free (GList *addr_list);
|
||||
|
||||
static gboolean sock_connect_async_cb (GIOChannel *source,
|
||||
|
@ -162,7 +171,6 @@ static SockLookupData *sock_get_address_info_async
|
|||
SockAddrFunc func,
|
||||
gpointer data);
|
||||
static gint sock_get_address_info_async_cancel (SockLookupData *lookup_data);
|
||||
#endif /* G_OS_UNIX */
|
||||
|
||||
|
||||
gint sock_init(void)
|
||||
|
@ -215,6 +223,24 @@ void refresh_resolvers(void)
|
|||
#endif /*G_OS_UNIX*/
|
||||
}
|
||||
|
||||
|
||||
/* Due to the fact that socket under Windows are not represented by
|
||||
standard file descriptors, we sometimes need to check whether a
|
||||
given file descriptor is actually a socket. This is done by
|
||||
testing for an error. Returns true under W32 if FD is a socket. */
|
||||
static int fd_is_w32_socket(gint fd)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gint optval;
|
||||
gint retval = sizeof(optval);
|
||||
|
||||
return !getsockopt(fd, SOL_SOCKET, SO_TYPE, (char*)&optval, &retval);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
gint fd_connect_unix(const gchar *path)
|
||||
{
|
||||
#ifdef G_OS_UNIX
|
||||
|
@ -279,15 +305,11 @@ gint fd_open_unix(const gchar *path)
|
|||
|
||||
gint fd_accept(gint sock)
|
||||
{
|
||||
#ifdef G_OS_UNIX
|
||||
struct sockaddr_in caddr;
|
||||
guint caddr_len;
|
||||
|
||||
caddr_len = sizeof(caddr);
|
||||
return accept(sock, (struct sockaddr *)&caddr, &caddr_len);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -357,7 +379,7 @@ static gboolean sock_check(GSource *source)
|
|||
struct timeval timeout = {0, 0};
|
||||
fd_set fds;
|
||||
GIOCondition condition = sock->condition;
|
||||
|
||||
|
||||
if (!sock || !sock->sock)
|
||||
return FALSE;
|
||||
|
||||
|
@ -471,7 +493,7 @@ static void timeout_handler(gint sig)
|
|||
{
|
||||
siglongjmp(jmpenv, 1);
|
||||
}
|
||||
#endif
|
||||
#endif /*G_OS_UNIX*/
|
||||
|
||||
static gint sock_connect_with_timeout(gint sock,
|
||||
const struct sockaddr *serv_addr,
|
||||
|
@ -666,7 +688,7 @@ SockInfo *sock_connect_cmd(const gchar *hostname, const gchar *tunnelcmd)
|
|||
close(fd[1]);
|
||||
return sockinfo_from_fd(hostname, 0, fd[0]);
|
||||
#else
|
||||
/* We would need a special implementaion for W32. */
|
||||
/* We would need a special implementation for W32. */
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -704,7 +726,7 @@ SockInfo *sock_connect(const gchar *hostname, gushort port)
|
|||
return sockinfo_from_fd(hostname, port, sock);
|
||||
}
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
|
||||
static void sock_address_list_free(GList *addr_list)
|
||||
{
|
||||
GList *cur;
|
||||
|
@ -954,8 +976,12 @@ static gboolean sock_get_address_info_async_cb(GIOChannel *source,
|
|||
g_io_channel_close(source);
|
||||
g_io_channel_unref(source);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* FIXME: We would need to cancel the thread. */
|
||||
#else
|
||||
kill(lookup_data->child_pid, SIGKILL);
|
||||
waitpid(lookup_data->child_pid, NULL, 0);
|
||||
#endif
|
||||
|
||||
lookup_data->func(addr_list, lookup_data->data);
|
||||
|
||||
|
@ -965,121 +991,163 @@ static gboolean sock_get_address_info_async_cb(GIOChannel *source,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* For better readability we use a separate function to implement the
|
||||
child code of sock_get_address_info_async. Note, that under W32
|
||||
this is actually not a child but a thread and this is the reason
|
||||
why we pass only a void pointer. */
|
||||
static void address_info_async_child(void *opaque)
|
||||
{
|
||||
SockLookupData *parm = opaque;
|
||||
#ifdef INET6
|
||||
gint gai_err;
|
||||
struct addrinfo hints, *res, *ai;
|
||||
gchar port_str[6];
|
||||
#else /* !INET6 */
|
||||
struct hostent *hp;
|
||||
gchar **addr_list_p;
|
||||
struct sockaddr_in ad;
|
||||
#endif /* INET6 */
|
||||
gint ai_member[4] = {AF_UNSPEC, 0, 0, 0};
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
close(parm->pipe_fds[0]);
|
||||
parm->pipe_fds[0] = -1;
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
/* hints.ai_flags = AI_CANONNAME; */
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
g_snprintf(port_str, sizeof(port_str), "%d", parm->port);
|
||||
|
||||
gai_err = getaddrinfo(parm->hostname, port_str, &hints, &res);
|
||||
if (gai_err != 0) {
|
||||
g_warning("getaddrinfo for %s:%s failed: %s\n",
|
||||
parm->hostname, port_str, gai_strerror(gai_err));
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
close(parm->pipe_fds[1]);
|
||||
parm->pipe_fds[1] = -1;
|
||||
#ifdef G_OS_WIN32
|
||||
_endthread();
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (ai = res; ai != NULL; ai = ai->ai_next) {
|
||||
ai_member[0] = ai->ai_family;
|
||||
ai_member[1] = ai->ai_socktype;
|
||||
ai_member[2] = ai->ai_protocol;
|
||||
ai_member[3] = ai->ai_addrlen;
|
||||
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)ai->ai_addr,
|
||||
ai->ai_addrlen);
|
||||
}
|
||||
|
||||
if (res != NULL)
|
||||
freeaddrinfo(res);
|
||||
#else /* !INET6 */
|
||||
hp = my_gethostbyname(parm->hostname);
|
||||
if (hp == NULL || hp->h_addrtype != AF_INET) {
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
close(parm->pipe_fds[1]);
|
||||
parm->pipe_fds[1] = -1;
|
||||
#ifdef G_OS_WIN32
|
||||
_endthread();
|
||||
#else
|
||||
_exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
ai_member[0] = AF_INET;
|
||||
ai_member[1] = SOCK_STREAM;
|
||||
ai_member[2] = IPPROTO_TCP;
|
||||
ai_member[3] = sizeof(ad);
|
||||
|
||||
memset(&ad, 0, sizeof(ad));
|
||||
ad.sin_family = AF_INET;
|
||||
ad.sin_port = htons(parm->port);
|
||||
|
||||
for (addr_list_p = hp->h_addr_list; *addr_list_p != NULL;
|
||||
addr_list_p++) {
|
||||
memcpy(&ad.sin_addr, *addr_list_p, hp->h_length);
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
fd_write_all(parm->pipe_fds[1], (gchar *)&ad, sizeof(ad));
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
close(parm->pipe_fds[1]);
|
||||
parm->pipe_fds[1] = -1;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
_endthread();
|
||||
#else
|
||||
_exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static SockLookupData *sock_get_address_info_async(const gchar *hostname,
|
||||
gushort port,
|
||||
SockAddrFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
SockLookupData *lookup_data = NULL;
|
||||
gint pipe_fds[2];
|
||||
pid_t pid;
|
||||
|
||||
refresh_resolvers();
|
||||
|
||||
if (pipe(pipe_fds) < 0) {
|
||||
lookup_data = g_new0(SockLookupData, 1);
|
||||
lookup_data->hostname = g_strdup(hostname);
|
||||
lookup_data->func = func;
|
||||
lookup_data->data = data;
|
||||
lookup_data->port = port;
|
||||
lookup_data->child_pid = (pid_t)(-1);
|
||||
lookup_data->pipe_fds[0] = -1;
|
||||
lookup_data->pipe_fds[1] = -1;
|
||||
|
||||
if (pipe(lookup_data->pipe_fds) < 0) {
|
||||
perror("pipe");
|
||||
func(NULL, data);
|
||||
g_free (lookup_data->hostname);
|
||||
g_free (lookup_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((pid = fork()) < 0) {
|
||||
#ifndef G_OS_WIN32
|
||||
if ((lookup_data->child_pid = fork()) < 0) {
|
||||
perror("fork");
|
||||
func(NULL, data);
|
||||
g_free (lookup_data->hostname);
|
||||
g_free (lookup_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* child process */
|
||||
if (pid == 0) {
|
||||
#ifdef INET6
|
||||
gint gai_err;
|
||||
struct addrinfo hints, *res, *ai;
|
||||
gchar port_str[6];
|
||||
#else /* !INET6 */
|
||||
struct hostent *hp;
|
||||
gchar **addr_list_p;
|
||||
struct sockaddr_in ad;
|
||||
#endif /* INET6 */
|
||||
gint ai_member[4] = {AF_UNSPEC, 0, 0, 0};
|
||||
|
||||
close(pipe_fds[0]);
|
||||
|
||||
#ifdef INET6
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
/* hints.ai_flags = AI_CANONNAME; */
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
g_snprintf(port_str, sizeof(port_str), "%d", port);
|
||||
|
||||
gai_err = getaddrinfo(hostname, port_str, &hints, &res);
|
||||
if (gai_err != 0) {
|
||||
g_warning("getaddrinfo for %s:%s failed: %s\n",
|
||||
hostname, port_str, gai_strerror(gai_err));
|
||||
fd_write_all(pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
close(pipe_fds[1]);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
for (ai = res; ai != NULL; ai = ai->ai_next) {
|
||||
ai_member[0] = ai->ai_family;
|
||||
ai_member[1] = ai->ai_socktype;
|
||||
ai_member[2] = ai->ai_protocol;
|
||||
ai_member[3] = ai->ai_addrlen;
|
||||
|
||||
fd_write_all(pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
fd_write_all(pipe_fds[1], (gchar *)ai->ai_addr,
|
||||
ai->ai_addrlen);
|
||||
}
|
||||
|
||||
if (res != NULL)
|
||||
freeaddrinfo(res);
|
||||
#else /* !INET6 */
|
||||
hp = my_gethostbyname(hostname);
|
||||
if (hp == NULL || hp->h_addrtype != AF_INET) {
|
||||
fd_write_all(pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
close(pipe_fds[1]);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
ai_member[0] = AF_INET;
|
||||
ai_member[1] = SOCK_STREAM;
|
||||
ai_member[2] = IPPROTO_TCP;
|
||||
ai_member[3] = sizeof(ad);
|
||||
|
||||
memset(&ad, 0, sizeof(ad));
|
||||
ad.sin_family = AF_INET;
|
||||
ad.sin_port = htons(port);
|
||||
|
||||
for (addr_list_p = hp->h_addr_list; *addr_list_p != NULL;
|
||||
addr_list_p++) {
|
||||
memcpy(&ad.sin_addr, *addr_list_p, hp->h_length);
|
||||
fd_write_all(pipe_fds[1], (gchar *)ai_member,
|
||||
sizeof(ai_member));
|
||||
fd_write_all(pipe_fds[1], (gchar *)&ad, sizeof(ad));
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
close(pipe_fds[1]);
|
||||
|
||||
_exit(0);
|
||||
} else {
|
||||
close(pipe_fds[1]);
|
||||
|
||||
lookup_data = g_new0(SockLookupData, 1);
|
||||
lookup_data->hostname = g_strdup(hostname);
|
||||
lookup_data->child_pid = pid;
|
||||
lookup_data->func = func;
|
||||
lookup_data->data = data;
|
||||
|
||||
lookup_data->channel = g_io_channel_unix_new(pipe_fds[0]);
|
||||
lookup_data->io_tag = g_io_add_watch
|
||||
(lookup_data->channel, G_IO_IN,
|
||||
sock_get_address_info_async_cb, lookup_data);
|
||||
if (lookup_data->child_pid == 0) {
|
||||
/* Child process. */
|
||||
address_info_async_child (lookup_data);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
/* Parent process. */
|
||||
close(lookup_data->pipe_fds[1]);
|
||||
lookup_data->pipe_fds[1] = -1;
|
||||
#endif /*!G_OS_WIN32 */
|
||||
|
||||
lookup_data->channel = g_io_channel_unix_new(lookup_data->pipe_fds[0]);
|
||||
lookup_data->io_tag = g_io_add_watch(lookup_data->channel, G_IO_IN,
|
||||
sock_get_address_info_async_cb,
|
||||
lookup_data);
|
||||
#ifdef G_OS_WIN32
|
||||
lookup_data->child_pid = _beginthread(
|
||||
address_info_async_child, 0, lookup_data);
|
||||
#endif
|
||||
|
||||
return lookup_data;
|
||||
}
|
||||
|
@ -1094,8 +1162,12 @@ static gint sock_get_address_info_async_cancel(SockLookupData *lookup_data)
|
|||
}
|
||||
|
||||
if (lookup_data->child_pid > 0) {
|
||||
#ifdef G_OS_WIN32
|
||||
/* FIXME: Need a way to cancel the thread. */
|
||||
#else
|
||||
kill(lookup_data->child_pid, SIGKILL);
|
||||
waitpid(lookup_data->child_pid, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
g_free(lookup_data->hostname);
|
||||
|
@ -1103,7 +1175,6 @@ static gint sock_get_address_info_async_cancel(SockLookupData *lookup_data)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* G_OS_UNIX */
|
||||
|
||||
|
||||
static SockInfo *sockinfo_from_fd(const gchar *hostname,
|
||||
|
@ -1139,11 +1210,9 @@ gint fd_read(gint fd, gchar *buf, gint len)
|
|||
if (fd_check_io(fd, G_IO_IN) < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
return recv(fd, buf, len, 0);
|
||||
#else
|
||||
if (fd_is_w32_socket(fd))
|
||||
return recv(fd, buf, len, 0);
|
||||
return read(fd, buf, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_OPENSSL
|
||||
|
@ -1199,11 +1268,9 @@ gint fd_write(gint fd, const gchar *buf, gint len)
|
|||
if (fd_check_io(fd, G_IO_OUT) < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
return send(fd, buf, len, 0);
|
||||
#else
|
||||
if (fd_is_w32_socket (fd))
|
||||
return send(fd, buf, len, 0);
|
||||
return write(fd, buf, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_OPENSSL
|
||||
|
@ -1254,7 +1321,11 @@ gint fd_write_all(gint fd, const gchar *buf, gint len)
|
|||
#ifndef G_OS_WIN32
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
n = write(fd, buf, len);
|
||||
if (fd_is_w32_socket(fd))
|
||||
n = send(fd, buf, len, 0);
|
||||
else
|
||||
n = write(fd, buf, len);
|
||||
|
||||
if (n <= 0) {
|
||||
log_error("write on fd%d: %s\n", fd, strerror(errno));
|
||||
return -1;
|
||||
|
@ -1318,6 +1389,30 @@ gint fd_gets(gint fd, gchar *buf, gint len)
|
|||
|
||||
if (--len < 1)
|
||||
return -1;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
do {
|
||||
/*
|
||||
XXX:tm try nonblock
|
||||
MSKB Article ID: Q147714
|
||||
Windows Sockets 2 Service Provider Interface Limitations
|
||||
Polling with recv(MSG_PEEK) to determine when a complete message
|
||||
has arrived.
|
||||
Reason and Workaround not available.
|
||||
|
||||
Single-byte send() and recv().
|
||||
Reason: Couple one-byte sends with Nagle disabled.
|
||||
Workaround: Send modest amounts and receive as much as possible.
|
||||
(still unused)
|
||||
*/
|
||||
if (recv(fd, bp, 1, 0) <= 0)
|
||||
return -1;
|
||||
if (*bp == '\n')
|
||||
break;
|
||||
bp++;
|
||||
len--;
|
||||
} while (0 < len);
|
||||
#else /*!G_OS_WIN32*/
|
||||
do {
|
||||
if ((n = fd_recv(fd, bp, len, MSG_PEEK)) <= 0)
|
||||
return -1;
|
||||
|
@ -1328,6 +1423,7 @@ gint fd_gets(gint fd, gchar *buf, gint len)
|
|||
bp += n;
|
||||
len -= n;
|
||||
} while (!newline && len);
|
||||
#endif /*!G_OS_WIN32*/
|
||||
|
||||
*bp = '\0';
|
||||
return bp - buf;
|
||||
|
@ -1389,7 +1485,11 @@ gint fd_getline(gint fd, gchar **str)
|
|||
*str = g_realloc(*str, size);
|
||||
strcat(*str, buf);
|
||||
}
|
||||
if (buf[len - 1] == '\n')
|
||||
if (buf[len - 1] == '\n'
|
||||
#ifdef G_OS_WIN32 /* FIXME This does not seem to be correct. */
|
||||
|| buf[len - 1] == '\r'
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
}
|
||||
if (len == -1 && *str)
|
||||
|
@ -1513,7 +1613,13 @@ gint sock_close(SockInfo *sock)
|
|||
g_source_remove(sock->g_source);
|
||||
sock->g_source = 0;
|
||||
#endif
|
||||
#ifdef G_OS_WIN32
|
||||
shutdown(sock->sock, 1); /* complete transfer before close */
|
||||
ret = closesocket(sock->sock);
|
||||
#else
|
||||
ret = fd_close(sock->sock);
|
||||
#endif
|
||||
|
||||
g_free(sock->hostname);
|
||||
g_free(sock);
|
||||
|
||||
|
|
|
@ -84,11 +84,9 @@ struct hostent *my_gethostbyname (const gchar *hostname);
|
|||
|
||||
SockInfo *sock_connect (const gchar *hostname, gushort port);
|
||||
SockInfo *sock_connect_cmd (const gchar *hostname, const gchar *tunnelcmd);
|
||||
#ifdef G_OS_UNIX
|
||||
gint sock_connect_async (const gchar *hostname, gushort port,
|
||||
SockConnectFunc func, gpointer data);
|
||||
gint sock_connect_async_cancel (gint id);
|
||||
#endif
|
||||
|
||||
/* Basic I/O functions */
|
||||
gint sock_printf (SockInfo *sock, const gchar *format, ...)
|
||||
|
|
|
@ -2091,6 +2091,22 @@ const gchar *get_header_cache_dir(void)
|
|||
return header_dir;
|
||||
}
|
||||
|
||||
/* Return the default directory for Plugins. */
|
||||
const gchar *get_plugin_dir(void)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
static gchar *plugin_dir = NULL;
|
||||
|
||||
if (!plugin_dir)
|
||||
plugin_dir = g_strconcat(sylpheed_get_startup_dir(),
|
||||
"\\lib\\sylpheed-claws\\plugins\\",
|
||||
NULL);
|
||||
return plugin_dir;
|
||||
#else
|
||||
return PLUGINDIR;
|
||||
#endif
|
||||
}
|
||||
|
||||
const gchar *get_tmp_dir(void)
|
||||
{
|
||||
static gchar *tmp_dir = NULL;
|
||||
|
@ -2226,6 +2242,30 @@ gboolean file_exist(const gchar *file, gboolean allow_fifo)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Test on whether FILE is a relative file name. This is
|
||||
* straightforward for Unix but more complex for Windows. */
|
||||
gboolean is_relative_filename(const gchar *file)
|
||||
{
|
||||
if (!file)
|
||||
return TRUE;
|
||||
#ifdef G_OS_WIN32
|
||||
if ( *file == '\\' && file[1] == '\\' && strchr (file+2, '\\') )
|
||||
return FALSE; /* Prefixed with a hostname - this can't
|
||||
* be a relative name. */
|
||||
|
||||
if ( ((*file >= 'a' && *file <= 'z')
|
||||
|| (*file >= 'A' && *file <= 'Z'))
|
||||
&& file[1] == ':')
|
||||
file += 2; /* Skip drive letter. */
|
||||
|
||||
return !(*file == '\\' || *file == '/');
|
||||
#else
|
||||
return !(*file == G_DIR_SEPARATOR);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
gboolean is_dir_exist(const gchar *dir)
|
||||
{
|
||||
if (dir == NULL)
|
||||
|
|
|
@ -399,6 +399,7 @@ const gchar *get_mbox_cache_dir (void);
|
|||
const gchar *get_mime_tmp_dir (void);
|
||||
const gchar *get_template_dir (void);
|
||||
const gchar *get_header_cache_dir (void);
|
||||
const gchar *get_plugin_dir (void);
|
||||
const gchar *get_tmp_dir (void);
|
||||
gchar *get_tmp_file (void);
|
||||
const gchar *get_domain_name (void);
|
||||
|
@ -410,6 +411,7 @@ off_t get_left_file_size (FILE *fp);
|
|||
|
||||
gboolean file_exist (const gchar *file,
|
||||
gboolean allow_fifo);
|
||||
gboolean is_relative_filename (const gchar *file);
|
||||
gboolean is_dir_exist (const gchar *dir);
|
||||
gboolean is_file_entry_exist (const gchar *file);
|
||||
gboolean dirent_is_regular_file (struct dirent *d);
|
||||
|
|
|
@ -3365,7 +3365,10 @@ static void folder_create_processing_folder(void)
|
|||
g_assert(processing_folder != NULL);
|
||||
|
||||
debug_print("tmpparentroot %s\n", LOCAL_FOLDER(processing_folder)->rootpath);
|
||||
if (LOCAL_FOLDER(processing_folder)->rootpath[0] == '/')
|
||||
/* FIXME: [W32] The code below does not correctly merge
|
||||
relative filenames; there should be a function to handle
|
||||
this. */
|
||||
if (!is_relative_filename(LOCAL_FOLDER(processing_folder)->rootpath))
|
||||
tmpname = g_strconcat(LOCAL_FOLDER(processing_folder)->rootpath,
|
||||
G_DIR_SEPARATOR_S, PROCESSING_FOLDER_ITEM,
|
||||
NULL);
|
||||
|
|
|
@ -155,7 +155,7 @@ static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
|
|||
gchar *file, *error = NULL;
|
||||
|
||||
file = filesel_select_file_open_with_filter(_("Select Plugin to load"),
|
||||
PLUGINDIR,
|
||||
get_plugin_dir(),
|
||||
"*." G_MODULE_SUFFIX);
|
||||
if (file == NULL)
|
||||
return;
|
||||
|
|
5
src/mh.c
5
src/mh.c
|
@ -625,7 +625,10 @@ static gchar *mh_item_get_path(Folder *folder, FolderItem *item)
|
|||
folder_path = g_strdup(LOCAL_FOLDER(folder)->rootpath);
|
||||
g_return_val_if_fail(folder_path != NULL, NULL);
|
||||
|
||||
if (folder_path[0] == G_DIR_SEPARATOR) {
|
||||
/* FIXME: [W32] The code below does not correctly merge
|
||||
relative filenames; there should be a function to handle
|
||||
this. */
|
||||
if ( !is_relative_filename (folder_path) ) {
|
||||
if (item->path)
|
||||
path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
|
||||
item->path, NULL);
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
EXPORTS
|
||||
plugin_desc
|
||||
plugin_done
|
||||
plugin_init
|
||||
plugin_done
|
||||
plugin_name
|
||||
plugin_desc
|
||||
plugin_type
|
||||
plugin_licence
|
||||
plugin_version
|
||||
|
||||
sgpgme_data_from_mimeinfo
|
||||
sgpgme_decrypt_verify
|
||||
|
|
|
@ -4,6 +4,7 @@ alertpanel
|
|||
alertpanel_full
|
||||
copy_file_part
|
||||
debug_print_real
|
||||
debug_srcname
|
||||
get_rc_dir
|
||||
get_tmp_file
|
||||
gtkut_stock_button_set_create
|
||||
|
@ -18,6 +19,7 @@ prefs_account_get_privacy_prefs
|
|||
prefs_account_register_page
|
||||
prefs_account_set_privacy_prefs
|
||||
prefs_account_unregister_page
|
||||
prefs_button_toggled
|
||||
prefs_file_close
|
||||
prefs_file_close_revert
|
||||
prefs_gtk_register_page
|
||||
|
@ -28,5 +30,3 @@ prefs_set_default
|
|||
prefs_write_open
|
||||
prefs_write_param
|
||||
sylpheed_get_version
|
||||
prefs_button_toggled
|
||||
debug_srcname
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
EXTRA_DIST = version.rc plugin.def sylpheed.def pgpinline.deps
|
||||
EXTRA_DIST = version.rc plugin.def sylpheed.def mypgpcore.def pgpinline.deps
|
||||
|
||||
|
||||
if PLATFORM_WIN32
|
||||
|
@ -16,12 +16,15 @@ plugin_res_ldflag = -Wl,.libs/version.o
|
|||
no_undefined = -no-undefined
|
||||
export_symbols = -export-symbols $(srcdir)/plugin.def
|
||||
|
||||
plugin_deps = libsylpheed.a $(plugin_res) plugin.def
|
||||
plugin_deps = libsylpheed.a libmypgpcore.a $(plugin_res) plugin.def
|
||||
|
||||
libsylpheed.a: sylpheed.def
|
||||
$(DLLTOOL) --output-lib $@ --def $<
|
||||
|
||||
plugin_ldadd = -L . -lsylpheed
|
||||
libmypgpcore.a: mypgpcore.def
|
||||
$(DLLTOOL) --output-lib $@ --def $<
|
||||
|
||||
plugin_ldadd = -L . -lsylpheed -lmypgpcore
|
||||
|
||||
else
|
||||
plugin_res =
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
EXPORTS
|
||||
plugin_desc
|
||||
plugin_done
|
||||
plugin_init
|
||||
plugin_done
|
||||
plugin_name
|
||||
plugin_desc
|
||||
plugin_type
|
||||
plugin_licence
|
||||
plugin_version
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ codeconv_set_strict
|
|||
conv_codeset_strdup
|
||||
conv_get_locale_charset_str_no_utf8
|
||||
debug_print_real
|
||||
debug_srcname
|
||||
get_mime_tmp_dir
|
||||
gpgmegtk_passphrase_cb
|
||||
my_tmpfile
|
||||
prefs_gpg_get_config
|
||||
privacy_register_system
|
||||
privacy_unregister_system
|
||||
procmime_decode_content
|
||||
|
@ -17,12 +16,4 @@ procmime_mimeinfo_get_parameter
|
|||
procmime_mimeinfo_parent
|
||||
procmime_scan_file
|
||||
procmime_write_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
|
||||
sylpheed_get_version
|
||||
debug_srcname
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
EXPORTS
|
||||
plugin_desc
|
||||
plugin_done
|
||||
plugin_init
|
||||
plugin_done
|
||||
plugin_name
|
||||
plugin_desc
|
||||
plugin_type
|
||||
plugin_licence
|
||||
plugin_version
|
||||
|
|
|
@ -2,6 +2,7 @@ LIBRARY SYLPHEED-CLAWS.EXE
|
|||
EXPORTS
|
||||
canonicalize_str
|
||||
debug_print_real
|
||||
debug_srcname
|
||||
file_read_stream_to_str
|
||||
generate_mime_boundary
|
||||
get_mime_tmp_dir
|
||||
|
@ -15,4 +16,3 @@ procmime_mimeinfo_parent
|
|||
procmime_scan_file
|
||||
procmime_write_mimeinfo
|
||||
sylpheed_get_version
|
||||
debug_srcname
|
||||
|
|
Loading…
Reference in a new issue