sync with sylpheed 0.4.66cvs1-3

This commit is contained in:
Alfons Hoogervorst 2001-05-10 11:19:38 +00:00
parent b2684a2bd0
commit af697d2452
29 changed files with 4328 additions and 3124 deletions

View file

@ -1,3 +1,29 @@
2001-05-10
* src/textview.c: textview_show_mime_part(): modified the messages.
TEXT_INSERT(): new macro.
* po/ja.po: fixed.
* src/prefs_display_header.c: prefs_display_header_create():
modified the text of checkbutton.
2001-05-09
* src/mimeview.c: added "Open with..." to the context menu.
* src/summaryview.c: summary_print()
src/inputdialog.c: input_dialog(): fixed memory leaks.
* src/textview.c: textview_show_mime_part(): updated the description.
* src/send.c: implemented sending progress dialog.
(TODO: automaton should be used.)
send_progress_dialog_create(), send_progress_dialog_destroy(),
send_cancel(): new.
send_message_smtp(): made it update the dialog for each stage.
* src/utils.[ch]: get_left_file_size(): new. Get the left bytes
of opened file.
* src/summaryview.c: summary_show(): when open_inbox_on_inc is set,
go to first unread message even if folder is same as previous.
* src/prefs_common.c: made color selection dialog transient, and
made escape key close the dialogs.
2001-05-08
* version 0.4.66

View file

@ -1,3 +1,9 @@
2001-05-10 [alfons]
0.4.66claws1
* sync with sylpheed 0.4.66cvs1-3
2001-05-10 [darko]
* src/prefs_common.c:

View file

@ -1,3 +1,31 @@
2001-05-10
* src/textview.c: textview_show_mime_part(): メッセージを修正。
TEXT_INSERT(): 新規マクロ。
* po/ja.po: 修正。
* src/prefs_display_header.c: prefs_display_header_create():
チェックボタンのテキストを修正。
2001-05-09
* src/mimeview.c: コンテキストメニューに「アプリケーションから
開く...」を追加。
* src/summaryview.c: summary_print()
src/inputdialog.c: input_dialog(): メモリリークを修正。
* src/textview.c: textview_show_mime_part(): 説明文を更新。
* src/send.c: 送信進捗ダイアログを実装。
(TODO: automaton を使用すべき。)
send_progress_dialog_create(), send_progress_dialog_destroy(),
send_cancel(): 新規。
send_message_smtp(): 各ステージでダイアログを更新するようにした。
* src/utils.[ch]: get_left_file_size(): 新規。オープンされたファイル
の残りのバイト数を得る。
* src/summaryview.c: summary_show(): open_inbox_on_inc がセットされ
ているときは、フォルダが前と同じであっても最初の未読メッセージに
移動するようにした。
* src/prefs_common.c: カラーセレクションダイアログを transient に
し、エスケープキーでダイアログを閉じられるようにした。
2001-05-08
* version 0.4.66

View file

@ -8,7 +8,7 @@ MINOR_VERSION=4
MICRO_VERSION=66
INTERFACE_AGE=66
BINARY_AGE=66
EXTRA_VERSION=claws
EXTRA_VERSION=claws1
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl

536
po/cs.po

File diff suppressed because it is too large Load diff

536
po/de.po

File diff suppressed because it is too large Load diff

522
po/el.po

File diff suppressed because it is too large Load diff

536
po/es.po

File diff suppressed because it is too large Load diff

536
po/fr.po

File diff suppressed because it is too large Load diff

536
po/it.po

File diff suppressed because it is too large Load diff

536
po/ja.po

File diff suppressed because it is too large Load diff

536
po/ko.po

File diff suppressed because it is too large Load diff

519
po/nl.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

536
po/ru.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -142,7 +142,7 @@ sylpheed_LDADD = \
$(GDK_PIXBUF_LIBS) \
$(GPGME_LIBS)
CPPFLAGS = -W -Wall \
CPPFLAGS = \
-DLOCALEDIR=\""$(localedir)"\" \
-DMANUALDIR=\""$(manualdir)"\" \
-DHOST_ALIAS=\""$(host_alias)"\"

View file

@ -90,8 +90,10 @@ gchar *input_dialog(const gchar *title, const gchar *message,
if (ack) {
str = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
if (str && *str == '\0')
if (str && *str == '\0') {
g_free(str);
str = NULL;
}
} else
str = NULL;

View file

@ -46,6 +46,7 @@
#include "menu.h"
#include "filesel.h"
#include "alertpanel.h"
#include "inputdialog.h"
#include "utils.h"
#include "gtkutils.h"
#include "prefs_common.h"
@ -99,8 +100,10 @@ static void mimeview_drag_data_get (GtkWidget *widget,
static void mimeview_display_as_text (MimeView *mimeview);
static void mimeview_save_as (MimeView *mimeview);
static void mimeview_launch (MimeView *mimeview);
static void mimeview_open_with (MimeView *mimeview);
static void mimeview_view_file (const gchar *filename,
MimeInfo *partinfo);
MimeInfo *partinfo,
const gchar *cmdline);
#if USE_GPGME
static void mimeview_check_signature (MimeView *mimeview);
#endif
@ -108,6 +111,7 @@ static void mimeview_check_signature (MimeView *mimeview);
static GtkItemFactoryEntry mimeview_popup_entries[] =
{
{N_("/_Open"), NULL, mimeview_launch, 0, NULL},
{N_("/Open _with..."), NULL, mimeview_open_with, 0, NULL},
{N_("/_Display as text"), NULL, mimeview_display_as_text, 0, NULL},
{N_("/_Save as..."), NULL, mimeview_save_as, 0, NULL}
#if USE_GPGME
@ -729,12 +733,47 @@ static void mimeview_launch(MimeView *mimeview)
alertpanel_error
(_("Can't save the part of multipart message."));
else
mimeview_view_file(filename, partinfo);
mimeview_view_file(filename, partinfo, NULL);
g_free(filename);
}
static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo)
static void mimeview_open_with(MimeView *mimeview)
{
MimeInfo *partinfo;
gchar *filename;
if (!mimeview->opened) return;
if (!mimeview->file) return;
partinfo = gtk_ctree_node_get_row_data
(GTK_CTREE(mimeview->ctree), mimeview->opened);
g_return_if_fail(partinfo != NULL);
filename = procmime_get_tmp_file_name(partinfo);
if (procmime_get_part(filename, mimeview->file, partinfo) < 0)
alertpanel_error
(_("Can't save the part of multipart message."));
else {
gchar *cmd;
cmd = input_dialog
(_("Open with"),
_("Enter the command line to open file:\n"
"(`%s' will be replaced with file name)"),
"gedit %s");
if (cmd) {
mimeview_view_file(filename, partinfo, cmd);
g_free(cmd);
}
}
g_free(filename);
}
static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
const gchar *cmdline)
{
static gchar *default_image_cmdline = "display '%s'";
static gchar *default_audio_cmdline = "play '%s'";
@ -743,11 +782,14 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo)
static gchar *mime_cmdline = "metamail -d -b -c %s '%s'";
gchar buf[1024];
gchar m_buf[1024];
gchar *cmd;
gchar *def_cmd;
gchar *p;
const gchar *cmd;
const gchar *def_cmd;
const gchar *p;
if (MIME_APPLICATION_OCTET_STREAM == partinfo->mime_type) {
if (cmdline) {
cmd = cmdline;
def_cmd = NULL;
} else if (MIME_APPLICATION_OCTET_STREAM == partinfo->mime_type) {
return;
} else if (MIME_IMAGE == partinfo->mime_type) {
cmd = prefs_common.mime_image_viewer;

View file

@ -544,12 +544,18 @@ static void prefs_quote_description (void);
static void prefs_quote_description_create (void);
static void prefs_quote_colors_dialog (void);
static void prefs_quote_colors_dialog_create (void);
static void prefs_quote_colors_key_pressed (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
static void quote_color_set_dialog (GtkWidget *widget,
gpointer data);
static void quote_colors_set_dialog_ok (GtkWidget *widget,
gpointer data);
static void quote_colors_set_dialog_cancel (GtkWidget *widget,
gpointer data);
static void quote_colors_set_dialog_key_pressed (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
static void set_button_bg_color (GtkWidget *widget,
gint color);
static void prefs_enable_message_color_toggled (void);
@ -1974,6 +1980,7 @@ void prefs_quote_colors_dialog(void)
if (!quote_color_win)
prefs_quote_colors_dialog_create();
gtk_widget_show(quote_color_win);
manage_window_set_transient(GTK_WINDOW(dialog.window));
gtk_main();
gtk_widget_hide(quote_color_win);
@ -2002,7 +2009,7 @@ static void prefs_quote_colors_dialog_create(void)
gtk_window_set_title(GTK_WINDOW(window), _("Set message colors"));
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(window), TRUE);
gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE);
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
vbox = gtk_vbox_new (FALSE, VSPACING);
gtk_container_add (GTK_CONTAINER (window), vbox);
@ -2015,57 +2022,53 @@ static void prefs_quote_colors_dialog_create(void)
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
/* gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); */
color_buttons.quote_level1_btn = gtk_button_new();
gtk_table_attach(GTK_TABLE (table), color_buttons.quote_level1_btn, 0, 1, 0, 1,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level1_btn,
0, 1, 0, 1, 0, 0, 0, 0);
gtk_widget_set_usize (color_buttons.quote_level1_btn, 40, 30);
gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level1_btn), 5);
gtk_container_set_border_width
(GTK_CONTAINER (color_buttons.quote_level1_btn), 5);
color_buttons.quote_level2_btn = gtk_button_new();
gtk_table_attach(GTK_TABLE (table), color_buttons.quote_level2_btn, 0, 1, 1, 2,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level2_btn,
0, 1, 1, 2, 0, 0, 0, 0);
gtk_widget_set_usize (color_buttons.quote_level2_btn, 40, 30);
gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level2_btn), 5);
color_buttons.quote_level3_btn = gtk_button_new_with_label ("");
gtk_table_attach(GTK_TABLE (table), color_buttons.quote_level3_btn, 0, 1, 2, 3,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_table_attach (GTK_TABLE (table), color_buttons.quote_level3_btn,
0, 1, 2, 3, 0, 0, 0, 0);
gtk_widget_set_usize (color_buttons.quote_level3_btn, 40, 30);
gtk_container_set_border_width (GTK_CONTAINER (color_buttons.quote_level3_btn), 5);
gtk_container_set_border_width
(GTK_CONTAINER (color_buttons.quote_level3_btn), 5);
color_buttons.uri_btn = gtk_button_new_with_label ("");
gtk_table_attach(GTK_TABLE (table), color_buttons.uri_btn, 0, 1, 3, 4,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_table_attach (GTK_TABLE (table), color_buttons.uri_btn,
0, 1, 3, 4, 0, 0, 0, 0);
gtk_widget_set_usize (color_buttons.uri_btn, 40, 30);
gtk_container_set_border_width (GTK_CONTAINER (color_buttons.uri_btn), 5);
quotelevel1_label = gtk_label_new (_("Quoted Text - First Level"));
gtk_table_attach(GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), quotelevel1_label, 1, 2, 0, 1,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_label_set_justify (GTK_LABEL (quotelevel1_label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (quotelevel1_label), 0, 0.5);
quotelevel2_label = gtk_label_new (_("Quoted Text - Second Level"));
gtk_table_attach(GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), quotelevel2_label, 1, 2, 1, 2,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_label_set_justify (GTK_LABEL (quotelevel2_label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (quotelevel2_label), 0, 0.5);
quotelevel3_label = gtk_label_new (_("Quoted Text - Third Level"));
gtk_table_attach(GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), quotelevel3_label, 1, 2, 2, 3,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_label_set_justify (GTK_LABEL (quotelevel3_label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (quotelevel3_label), 0, 0.5);
uri_label = gtk_label_new (_("URI link"));
gtk_table_attach(GTK_TABLE (table), uri_label, 1, 2, 3, 4,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), uri_label, 1, 2, 3, 4,
(GTK_EXPAND | GTK_FILL), 0, 0, 0);
gtk_label_set_justify (GTK_LABEL (uri_label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (uri_label), 0, 0.5);
@ -2077,10 +2080,15 @@ static void prefs_quote_colors_dialog_create(void)
gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
gtk_widget_grab_default(ok_btn);
gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
GTK_SIGNAL_FUNC(prefs_quote_colors_key_pressed),
NULL);
gtk_signal_connect(GTK_OBJECT(color_buttons.quote_level1_btn), "clicked",
GTK_SIGNAL_FUNC(quote_color_set_dialog), "LEVEL1");
@ -2092,6 +2100,8 @@ static void prefs_quote_colors_dialog_create(void)
GTK_SIGNAL_FUNC(quote_color_set_dialog), "URI");
gtk_signal_connect(GTK_OBJECT(recycle_colors_btn), "toggled",
GTK_SIGNAL_FUNC(prefs_recycle_colors_toggled), NULL);
gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
/* show message button colors and recycle options */
set_button_bg_color(color_buttons.quote_level1_btn,
@ -2109,6 +2119,13 @@ static void prefs_quote_colors_dialog_create(void)
quote_color_win = window;
}
static void prefs_quote_colors_key_pressed(GtkWidget *widget,
GdkEventKey *event, gpointer data)
{
if (event && event->keyval == GDK_Escape)
gtk_main_quit();
}
static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
{
gchar *type = (gchar *)data;
@ -2130,7 +2147,7 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
title = _("Pick color for URI");
rgbvalue = prefs_common.uri_col;
} else { /* Should never be called */
fprintf(stderr, "Unrecognized datatype '%s' in quote_color_set_dialog\n", type);
g_warning("Unrecognized datatype '%s' in quote_color_set_dialog\n", type);
return;
}
@ -2138,19 +2155,23 @@ static void quote_color_set_dialog(GtkWidget *widget, gpointer data)
gtk_window_set_position(GTK_WINDOW(color_dialog), GTK_WIN_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE);
gtk_window_set_policy(GTK_WINDOW(color_dialog), FALSE, FALSE, FALSE);
manage_window_set_transient(GTK_WINDOW(color_dialog));
gtk_signal_connect(GTK_OBJECT(((GtkColorSelectionDialog *)color_dialog)->ok_button),
gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button),
"clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_ok), data);
gtk_signal_connect(GTK_OBJECT(((GtkColorSelectionDialog *)color_dialog)->cancel_button),
gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(quote_colors_set_dialog_cancel), data);
gtk_signal_connect(GTK_OBJECT(color_dialog), "key_press_event",
GTK_SIGNAL_FUNC(quote_colors_set_dialog_key_pressed),
data);
/* preselect the previous color in the color selection dialog */
color[0] = (gdouble) ((rgbvalue & 0xff0000) >> 16) / 255.0;
color[1] = (gdouble) ((rgbvalue & 0x00ff00) >> 8) / 255.0;
color[2] = (gdouble) (rgbvalue & 0x0000ff) / 255.0;
dialog = (GtkColorSelectionDialog *)color_dialog;
dialog = GTK_COLOR_SELECTION_DIALOG(color_dialog);
gtk_color_selection_set_color
((GtkColorSelection *)dialog->colorsel, color);
(GTK_COLOR_SELECTION(dialog->colorsel), color);
gtk_widget_show(color_dialog);
}
@ -2191,12 +2212,19 @@ static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
} else
fprintf( stderr, "Unrecognized datatype '%s' in quote_color_set_dialog_ok\n", type );
gtk_widget_hide(color_dialog);
gtk_widget_destroy(color_dialog);
}
static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data)
{
gtk_widget_hide(color_dialog);
gtk_widget_destroy(color_dialog);
}
static void quote_colors_set_dialog_key_pressed(GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
gtk_widget_destroy(color_dialog);
}
static void set_button_bg_color(GtkWidget *widget, gint rgbvalue)

View file

@ -241,7 +241,7 @@ static void prefs_display_header_create(void)
"Reply-To", "Sender", "User-Agent", "X-Mailer",
NULL);
clist_hbox = gtk_hbox_new (FALSE, 8);
clist_hbox = gtk_hbox_new (FALSE, 10);
gtk_widget_show (clist_hbox);
gtk_box_pack_start (GTK_BOX (vbox1), clist_hbox, TRUE, TRUE, 0);
@ -345,7 +345,7 @@ static void prefs_display_header_create(void)
(void *) hidden_headers_clist);
PACK_CHECK_BUTTON (btn_hbox, checkbtn_other_headers,
_("Show other headers"));
_("Show all unspecified headers"));
SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, clist_hbox2);
gtk_widget_show_all(window);

View file

@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999,2000 Hiroyuki Yamamoto
* Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* 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

View file

@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999,2000 Hiroyuki Yamamoto
* Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* 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
@ -24,8 +24,14 @@
#include "defs.h"
#include <glib.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkclist.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include "intl.h"
#include "send.h"
@ -34,12 +40,23 @@
#include "prefs_account.h"
#include "account.h"
#include "compose.h"
#include "progressdialog.h"
#include "manage_window.h"
#include "procmsg.h"
#include "procheader.h"
#include "utils.h"
#include "gtkutils.h"
#define SMTP_PORT 25
typedef struct _SendProgressDialog SendProgressDialog;
struct _SendProgressDialog
{
ProgressDialog *dialog;
GList *queue_list;
};
static gint send_message_smtp (GSList *to_list, const gchar *from,
const gchar *server, gushort port,
const gchar *domain, const gchar *userid,
@ -47,31 +64,14 @@ static gint send_message_smtp (GSList *to_list, const gchar *from,
FILE *fp);
static SockInfo *send_smtp_open (const gchar *server, gushort port,
const gchar *domain, gboolean use_smtp_auth);
static SendProgressDialog *send_progress_dialog_create(void);
static void send_progress_dialog_destroy(SendProgressDialog *dialog);
static void send_cancel(GtkWidget *widget, gpointer data);
static gint send_message_with_command(GSList *to_list, gchar * mailcmd,
FILE * fp);
#define SEND_EXIT_IF_ERROR(f, s) \
{ \
if (!(f)) { \
log_warning("Error occurred while %s\n", s); \
sock_close(smtp_sock); \
smtp_sock = NULL; \
return -1; \
} \
}
#define SEND_EXIT_IF_NOTOK(f, s) \
{ \
if ((f) != SM_OK) { \
log_warning("Error occurred while %s\n", s); \
if (smtp_quit(smtp_sock) != SM_OK) \
log_warning("Error occurred while sending QUIT\n"); \
sock_close(smtp_sock); \
smtp_sock = NULL; \
return -1; \
} \
}
gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
{
FILE *fp;
@ -240,38 +240,112 @@ gint send_message_queue(const gchar *file)
return val;
}
#define SEND_EXIT_IF_ERROR(f, s) \
{ \
if (!(f)) { \
log_warning("Error occurred while %s\n", s); \
sock_close(smtp_sock); \
smtp_sock = NULL; \
return -1; \
} \
}
#define SEND_EXIT_IF_NOTOK(f, s) \
{ \
if ((f) != SM_OK) { \
log_warning("Error occurred while %s\n", s); \
if (smtp_quit(smtp_sock) != SM_OK) \
log_warning("Error occurred while sending QUIT\n"); \
sock_close(smtp_sock); \
smtp_sock = NULL; \
return -1; \
} \
}
static gint send_message_smtp(GSList *to_list, const gchar *from,
const gchar *server, gushort port,
const gchar *domain, const gchar *userid,
const gchar* passwd, gboolean use_smtp_auth,
const gchar *passwd, gboolean use_smtp_auth,
FILE *fp)
{
SockInfo *smtp_sock;
SendProgressDialog *dialog;
GtkCList *clist;
const gchar *text[3];
gchar buf[BUFFSIZE];
gchar str[BUFFSIZE];
GSList *cur;
gint size;
gint bytes = 0;
struct timeval tv_prev, tv_cur;
g_return_val_if_fail(to_list != NULL, -1);
g_return_val_if_fail(from != NULL, -1);
g_return_val_if_fail(server != NULL, -1);
g_return_val_if_fail(fp != NULL, -1);
log_message(_("Connecting to SMTP server: %s ...\n"), server);
size = get_left_file_size(fp);
if (size < 0) return -1;
dialog = send_progress_dialog_create();
text[0] = NULL;
text[1] = server;
text[2] = _("Standby");
clist = GTK_CLIST(dialog->dialog->clist);
gtk_clist_append(clist, (gchar **)text);
g_snprintf(buf, sizeof(buf), _("Connecting to SMTP server: %s ..."),
server);
log_message("%s\n", buf);
progress_dialog_set_label(dialog->dialog, buf);
gtk_clist_set_text(clist, 0, 2, _("Connecting"));
GTK_EVENTS_FLUSH();
SEND_EXIT_IF_ERROR((smtp_sock = send_smtp_open
(server, port, domain, use_smtp_auth)),
"connecting to server");
progress_dialog_set_label(dialog->dialog, _("Sending MAIL FROM..."));
gtk_clist_set_text(clist, 0, 2, _("Sending"));
GTK_EVENTS_FLUSH();
SEND_EXIT_IF_NOTOK
(smtp_from(smtp_sock, from, userid, passwd, use_smtp_auth),
"sending MAIL FROM");
progress_dialog_set_label(dialog->dialog, _("Sending RCPT TO..."));
GTK_EVENTS_FLUSH();
for (cur = to_list; cur != NULL; cur = cur->next)
SEND_EXIT_IF_NOTOK(smtp_rcpt(smtp_sock, (gchar *)cur->data),
"sending RCPT TO");
progress_dialog_set_label(dialog->dialog, _("Sending DATA..."));
GTK_EVENTS_FLUSH();
SEND_EXIT_IF_NOTOK(smtp_data(smtp_sock), "sending DATA");
gettimeofday(&tv_prev, NULL);
/* send main part */
while (fgets(buf, sizeof(buf), fp) != NULL) {
bytes += strlen(buf);
strretchomp(buf);
gettimeofday(&tv_cur, NULL);
if (tv_cur.tv_sec - tv_prev.tv_sec > 0 ||
tv_cur.tv_usec - tv_prev.tv_usec > 10000) {
g_snprintf(str, sizeof(str),
_("Sending message (%d / %d bytes)"),
bytes, size);
progress_dialog_set_label(dialog->dialog, str);
progress_dialog_set_percentage
(dialog->dialog, (gfloat)bytes / (gfloat)size);
GTK_EVENTS_FLUSH();
gettimeofday(&tv_prev, NULL);
}
/* escape when a dot appears on the top */
if (buf[0] == '.')
SEND_EXIT_IF_ERROR(sock_write(smtp_sock, ".", 1),
@ -280,10 +354,15 @@ static gint send_message_smtp(GSList *to_list, const gchar *from,
SEND_EXIT_IF_ERROR(sock_puts(smtp_sock, buf), "sending data");
}
progress_dialog_set_label(dialog->dialog, _("Quitting..."));
GTK_EVENTS_FLUSH();
SEND_EXIT_IF_NOTOK(smtp_eom(smtp_sock), "terminating data");
SEND_EXIT_IF_NOTOK(smtp_quit(smtp_sock), "sending QUIT");
sock_close(smtp_sock);
send_progress_dialog_destroy(dialog);
return 0;
}
@ -312,3 +391,45 @@ static SockInfo *send_smtp_open(const gchar *server, gushort port,
return NULL;
}
static SendProgressDialog *send_progress_dialog_create(void)
{
SendProgressDialog *dialog;
ProgressDialog *progress;
dialog = g_new0(SendProgressDialog, 1);
progress = progress_dialog_create();
gtk_window_set_title(GTK_WINDOW(progress->window),
_("Sending message"));
gtk_signal_connect(GTK_OBJECT(progress->cancel_btn), "clicked",
GTK_SIGNAL_FUNC(send_cancel), dialog);
gtk_signal_connect(GTK_OBJECT(progress->window), "delete_event",
GTK_SIGNAL_FUNC(gtk_true), NULL);
manage_window_set_transient(GTK_WINDOW(progress->window));
progress_dialog_set_value(progress, 0.0);
gtk_widget_show_now(progress->window);
dialog->dialog = progress;
dialog->queue_list = NULL;
return dialog;
}
static void send_progress_dialog_destroy(SendProgressDialog *dialog)
{
g_return_if_fail(dialog != NULL);
progress_dialog_destroy(dialog->dialog);
g_free(dialog);
}
static void send_cancel(GtkWidget *widget, gpointer data)
{
SendProgressDialog *dialog = data;
g_print("cancelled\n");
}

View file

@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999,2000 Hiroyuki Yamamoto
* Copyright (C) 1999-2001 Hiroyuki Yamamoto
*
* 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
@ -24,8 +24,9 @@
#include "prefs_account.h"
gint send_message (const gchar *file, PrefsAccount *ac_prefs,
GSList *to_list);
gint send_message_queue (const gchar *file);
gint send_message (const gchar *file,
PrefsAccount *ac_prefs,
GSList *to_list);
gint send_message_queue (const gchar *file);
#endif /* __SEND_H__ */

View file

@ -604,7 +604,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
STATUSBAR_POP(summaryview->mainwin);
is_refresh = (item == summaryview->folder_item) ? TRUE : FALSE;
is_refresh = (!prefs_common.open_inbox_on_inc &&
item == summaryview->folder_item) ? TRUE : FALSE;
if (is_refresh) {
prev_msgnum = summary_get_current_msgnum(summaryview);
if (prev_msgnum < 1)
@ -1569,7 +1570,7 @@ static void summary_set_header(gchar *text[], MsgInfo *msginfo)
_("(No From)");
if (prefs_common.swap_from && msginfo->from && msginfo->to &&
cur_account && cur_account->address &&
+ !MSG_IS_NEWS(msginfo->flags)) {
!MSG_IS_NEWS(msginfo->flags)) {
gchar *from;
Xalloca(from, strlen(msginfo->from) + 1, return);
@ -1629,6 +1630,17 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
}
g_free(filename);
if (MSG_IS_NEW(msginfo->flags))
summaryview->newmsgs--;
if (MSG_IS_UNREAD(msginfo->flags))
summaryview->unread--;
if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
MSG_UNSET_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
summary_set_row_marks(summaryview, row);
gtk_clist_thaw(GTK_CLIST(ctree));
summary_status_show(summaryview);
}
if (new_window) {
MessageView *msgview;
@ -1651,17 +1663,6 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
gtkut_ctree_node_move_if_on_the_edge(ctree, row);
}
if (MSG_IS_NEW(msginfo->flags))
summaryview->newmsgs--;
if (MSG_IS_UNREAD(msginfo->flags))
summaryview->unread--;
if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
MSG_UNSET_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
summary_set_row_marks(summaryview, row);
gtk_clist_thaw(GTK_CLIST(ctree));
summary_status_show(summaryview);
}
if (GTK_WIDGET_VISIBLE(summaryview->headerwin->window))
header_window_show(summaryview->headerwin, msginfo);
@ -2247,6 +2248,7 @@ void summary_print(SummaryView *summaryview)
strchr(p + 2, '%')) {
alertpanel_error(_("Print command line is invalid:\n`%s'"),
cmdline);
g_free(cmdline);
return;
}
@ -2255,6 +2257,8 @@ void summary_print(SummaryView *summaryview)
(ctree, GTK_CTREE_NODE(cur->data));
if (msginfo) procmsg_print_message(msginfo, cmdline);
}
g_free(cmdline);
}
void summary_execute(SummaryView *summaryview)

View file

@ -349,6 +349,9 @@ void textview_show_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
gtk_text_thaw(text);
}
#define TEXT_INSERT(str) \
gtk_text_insert(text, textview->msgfont, NULL, NULL, str, -1)
void textview_show_mime_part(TextView *textview, MimeInfo *partinfo)
{
GtkText *text;
@ -361,26 +364,17 @@ void textview_show_mime_part(TextView *textview, MimeInfo *partinfo)
gtk_text_freeze(text);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("To save this part, pop up the context menu with\n"), -1);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("right click and select `Save as...', or press `y' key.\n\n"), -1);
TEXT_INSERT(_("To save this part, pop up the context menu with "));
TEXT_INSERT(_("right click and select `Save as...', "));
TEXT_INSERT(_("or press `y' key.\n\n"));
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("To display this part as a text message, select\n"), -1);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("`Display as text', or press `t' key.\n\n"), -1);
TEXT_INSERT(_("To display this part as a text message, select "));
TEXT_INSERT(_("`Display as text', or press `t' key.\n\n"));
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("To open this part with external program, select `Open',\n"), -1);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("or double-click, or click the center button, or press `l' key."), -1);
TEXT_INSERT(_("To open this part with external program, select "));
TEXT_INSERT(_("`Open' or `Open with...', "));
TEXT_INSERT(_("or double-click, or click the center button, "));
TEXT_INSERT(_("or press `l' key."));
gtk_text_thaw(text);
}
@ -399,24 +393,19 @@ void textview_show_signature_part(TextView *textview, MimeInfo *partinfo)
gtk_text_freeze(text);
if (partinfo->sigstatus_full == NULL) {
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("This signature has not been checked yet.\n"), -1);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("To check it, pop up the context menu with\n"), -1);
gtk_text_insert
(text, textview->msgfont, NULL, NULL,
_("right click and select `Check signature'.\n"), -1);
TEXT_INSERT(_("This signature has not been checked yet.\n"));
TEXT_INSERT(_("To check it, pop up the context menu with\n"));
TEXT_INSERT(_("right click and select `Check signature'.\n"));
} else {
gtk_text_insert(text, textview->msgfont, NULL, NULL,
partinfo->sigstatus_full, -1);
TEXT_INSERT(partinfo->sigstatus_full);
}
gtk_text_thaw(text);
}
#endif /* USE_GPGME */
#undef TEXT_INSERT
static void textview_show_html(TextView *textview, FILE *fp,
CodeConverter *conv)
{

View file

@ -1171,6 +1171,33 @@ off_t get_file_size(const gchar *file)
return s.st_size;
}
off_t get_left_file_size(FILE *fp)
{
glong pos;
glong end;
off_t size;
if ((pos = ftell(fp)) < 0) {
perror("ftell");
return -1;
}
if (fseek(fp, 0L, SEEK_END) < 0) {
perror("fseek");
return -1;
}
if ((end = ftell(fp)) < 0) {
perror("fseek");
return -1;
}
size = end - pos;
if (fseek(fp, pos, SEEK_SET) < 0) {
perror("fseek");
return -1;
}
return size;
}
gboolean file_exist(const gchar *file, gboolean allow_fifo)
{
struct stat s;

View file

@ -244,6 +244,7 @@ gchar *get_domain_name (void);
/* file / directory handling */
off_t get_file_size (const gchar *file);
off_t get_left_file_size (FILE *fp);
gboolean file_exist (const gchar *file,
gboolean allow_fifo);
gboolean is_dir_exist (const gchar *dir);