sync with 0.9.0cvs10

This commit is contained in:
Paul Mangan 2003-05-27 07:36:59 +00:00
parent 5f6bc3590a
commit 0933c00684
9 changed files with 80 additions and 36 deletions

View file

@ -1,3 +1,10 @@
2003-05-26
* src/socket.[ch]:
sock_set_io_timeout(): new. It sets the timeout interval.
sock_gdk_input_add(): removed since it's not used anymore.
* src/prefs_common.[ch]: added an option to set the timeout parameter.
2003-05-26
* src/action.c: fixed a bug that didn't hidden user string in

View file

@ -1,3 +1,8 @@
2003-05-27 [paul] 0.9.0claws3
* sync with 0.9.0cvs10
see ChangeLog 2003-05-26
2003-05-26 [paul] 0.9.0claws2
* sync with 0.9.0cvs9

View file

@ -1,3 +1,10 @@
2003-05-26
* src/socket.[ch]:
sock_set_io_timeout(): 新規。タイムアウトの間隔を指定する。
sock_gdk_input_add(): 既に使用されていないため削除。
* src/prefs_common.[ch]: タイムアウトの値を指定するオプションを追加。
2003-05-26
* src/action.c: create_io_dialog() でユーザ文字列を隠していなかった

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=claws2
EXTRA_VERSION=claws3
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target

View file

@ -53,7 +53,8 @@
#endif
#define BUFFSIZE 8192
#define IO_TIMEOUT 60
guint io_timeout = 60;
static gint sock_connect_with_timeout (gint sock,
const struct sockaddr *serv_addr,
@ -73,6 +74,12 @@ static SockInfo *sockinfo_from_fd(const gchar *hostname,
gushort port,
gint sock);
gint sock_set_io_timeout(guint sec)
{
io_timeout = sec;
return 0;
}
gint fd_connect_unix(const gchar *path)
{
gint sock;
@ -188,16 +195,18 @@ static gint fd_check_io(gint fd, GIOCondition cond)
struct timeval timeout;
fd_set fds;
timeout.tv_sec = IO_TIMEOUT;
timeout.tv_sec = io_timeout;
timeout.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(fd, &fds);
if (cond == G_IO_IN) {
select(fd + 1, &fds, NULL, NULL, &timeout);
select(fd + 1, &fds, NULL, NULL,
io_timeout > 0 ? &timeout : NULL);
} else {
select(fd + 1, NULL, &fds, NULL, &timeout);
select(fd + 1, NULL, &fds, NULL,
io_timeout > 0 ? &timeout : NULL);
}
if (FD_ISSET(fd, &fds)) {
@ -245,7 +254,6 @@ struct hostent *my_gethostbyname(const gchar *hostname)
{
struct hostent *hp;
void (*prev_handler)(gint);
guint timeout_secs = IO_TIMEOUT;
alarm(0);
prev_handler = signal(SIGALRM, timeout_handler);
@ -256,7 +264,7 @@ struct hostent *my_gethostbyname(const gchar *hostname)
errno = 0;
return NULL;
}
alarm(timeout_secs);
alarm(io_timeout);
if ((hp = gethostbyname(hostname)) == NULL) {
alarm(0);
@ -298,7 +306,6 @@ static gint sock_connect_by_hostname(gint sock, const gchar *hostname,
{
struct hostent *hp;
struct sockaddr_in ad;
guint timeout_secs = IO_TIMEOUT;
memset(&ad, 0, sizeof(ad));
ad.sin_family = AF_INET;
@ -321,7 +328,7 @@ static gint sock_connect_by_hostname(gint sock, const gchar *hostname,
}
return sock_connect_with_timeout(sock, (struct sockaddr *)&ad,
sizeof(ad), timeout_secs);
sizeof(ad), io_timeout);
}
#else /* INET6 */
@ -329,7 +336,6 @@ static gint sock_connect_by_getaddrinfo(const gchar *hostname, gushort port)
{
gint sock = -1, gai_error;
struct addrinfo hints, *res, *ai;
guint timeout_secs = IO_TIMEOUT;
gchar port_str[6];
memset(&hints, 0, sizeof(hints));
@ -353,7 +359,7 @@ static gint sock_connect_by_getaddrinfo(const gchar *hostname, gushort port)
continue;
if (sock_connect_with_timeout
(sock, ai->ai_addr, ai->ai_addrlen, timeout_secs) == 0)
(sock, ai->ai_addr, ai->ai_addrlen, io_timeout) == 0)
break;
close(sock);
@ -773,22 +779,3 @@ gint fd_close(gint fd)
{
return close(fd);
}
gint sock_input_add(SockInfo *sock,
GIOCondition condition,
GIOFunc function,
gpointer data)
{
GIOChannel *channel;
guint result;
g_return_val_if_fail(sock != NULL, -1);
channel = g_io_channel_unix_new(sock->sock);
/* :WK: We have to change some things here becuse most likey
function() does take SockInfo * and not an gint */
result = g_io_add_watch(channel, condition, function, data);
g_io_channel_unref(channel);
return result;
}

View file

@ -61,6 +61,8 @@ struct _SockInfo
#endif
};
gint sock_set_io_timeout (guint sec);
gint sock_set_nonblocking_mode (SockInfo *sock, gboolean nonblock);
gboolean sock_is_nonblocking_mode (SockInfo *sock);
@ -79,12 +81,6 @@ gchar *sock_getline (SockInfo *sock);
gint sock_puts (SockInfo *sock, const gchar *buf);
gint sock_close (SockInfo *sock);
/* wrapper functions */
gint sock_input_add (SockInfo *sock,
GIOCondition condition,
GIOFunc function,
gpointer data);
/* Functions to directly work on FD. They are needed for pipes */
gint fd_connect_unix (const gchar *path);
gint fd_open_unix (const gchar *path);

View file

@ -66,6 +66,7 @@
#include "setup.h"
#include "utils.h"
#include "gtkutils.h"
#include "socket.h"
#include "log.h"
#include "prefs_toolbar.h"
#include "plugin.h"
@ -270,6 +271,7 @@ int main(int argc, char *argv[])
gtkaspellcheckers = gtkaspell_checkers_new();
#endif
sock_set_io_timeout(prefs_common.io_timeout_secs);
prefs_common_save_config();
prefs_actions_read_config();

View file

@ -51,6 +51,7 @@
#include "gtkutils.h"
#include "alertpanel.h"
#include "folder.h"
#include "socket.h"
#include "filesel.h"
#include "folderview.h"
#include "stock_pixmap.h"
@ -224,6 +225,7 @@ static struct Other {
GtkWidget *printcmd_entry;
GtkWidget *exteditor_combo;
GtkWidget *exteditor_entry;
GtkWidget *checkbtn_addaddrbyclick;
GtkWidget *checkbtn_confonexit;
GtkWidget *checkbtn_cleanonexit;
@ -237,6 +239,8 @@ static struct Other {
#endif
#endif
GtkWidget *spinbtn_iotimeout;
GtkObject *spinbtn_iotimeout_adj;
} other;
static struct MessageColorButtons {
@ -809,6 +813,9 @@ static PrefParam param[] = {
{"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
NULL, NULL, NULL},
{"io_timeout_secs", "60", &prefs_common.io_timeout_secs,
P_INT, &other.spinbtn_iotimeout,
prefs_set_data_from_spinbtn, prefs_set_spinbtn},
{"hide_score", "-9999", &prefs_common.kill_score, P_INT,
NULL, NULL, NULL},
{"important_score", "1", &prefs_common.important_score, P_INT,
@ -2824,6 +2831,11 @@ static void prefs_other_create(void)
GtkWidget *checkbtn_cleanonexit;
GtkWidget *checkbtn_askonclean;
GtkWidget *checkbtn_warnqueued;
GtkWidget *label_iotimeout;
GtkWidget *spinbtn_iotimeout;
GtkObject *spinbtn_iotimeout_adj;
#if 0
#ifdef USE_OPENSSL
GtkWidget *frame_ssl;
@ -2983,6 +2995,27 @@ static void prefs_other_create(void)
PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
_("Warn if there are queued messages"));
hbox1 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
label_iotimeout = gtk_label_new (_("Socket I/O timeout:"));
gtk_widget_show (label_iotimeout);
gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
spinbtn_iotimeout = gtk_spin_button_new
(GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
gtk_widget_show (spinbtn_iotimeout);
gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
FALSE, FALSE, 0);
gtk_widget_set_usize (spinbtn_iotimeout, 64, -1);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
label_iotimeout = gtk_label_new (_("second(s)"));
gtk_widget_show (label_iotimeout);
gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
other.uri_combo = uri_combo;
other.uri_entry = uri_entry;
other.printcmd_entry = printcmd_entry;
@ -2999,6 +3032,9 @@ static void prefs_other_create(void)
other.checkbtn_cleanonexit = checkbtn_cleanonexit;
other.checkbtn_askonclean = checkbtn_askonclean;
other.checkbtn_warnqueued = checkbtn_warnqueued;
other.spinbtn_iotimeout = spinbtn_iotimeout;
other.spinbtn_iotimeout_adj = spinbtn_iotimeout_adj;
#if 0
#ifdef USE_OPENSSL
@ -4204,6 +4240,7 @@ static void prefs_common_apply(void)
update_pixmap_theme = FALSE;
prefs_set_data_from_dialog(param);
sock_set_io_timeout(prefs_common.io_timeout_secs);
if (update_pixmap_theme)
{

View file

@ -263,6 +263,9 @@ struct _PrefsCommon
gboolean clean_on_exit;
gboolean ask_on_clean;
gboolean warn_queued_on_exit;
gint io_timeout_secs;
#if 0
#ifdef USE_OPENSSL
gboolean ssl_ask_unknown_valid;