+2001-05-18 [hoa]
+
+ * src/compose.[ch]
+ * src/filtering.c
+ * src/summaryview.c
+ new filtering action : forward and forward as attachment
+
+ * src/main.c
+ no need for $DISPLAY when we run sylpheed --help
+ call to parse_cmd_opt() is moved
+
+ * src/mainwindow.[ch]
+ execute button is hidden when immediate execute
+ is chosen
+
+ * src/mh.c
+ * src/news.c
+ * src/prefs_folder_item.c
+ * src/procmsg.c
+ better handling of missing directories
+
+ * src/summaryview.c
+ reedit is enabled is outbox
+
2001-05-17 [hoa]
* src/filtering.c
static void compose_wrap_line (Compose *compose);
static void compose_set_title (Compose *compose);
-static gint compose_send (Compose *compose);
+/* static gint compose_send (Compose *compose); */
static gint compose_write_to_file (Compose *compose,
const gchar *file,
gboolean is_draft);
{"text/uri-list", 0, 0}
};
-void compose_new(PrefsAccount *account)
+Compose * compose_new(PrefsAccount *account)
{
- compose_new_with_recipient(account, NULL);
+ return compose_new_with_recipient(account, NULL);
}
-void compose_new_with_recipient(PrefsAccount *account, const gchar *to)
+Compose * compose_new_with_recipient(PrefsAccount *account, const gchar *to)
{
Compose *compose;
gtk_widget_grab_focus(compose->to_entry);
} else
gtk_widget_grab_focus(compose->newsgroups_entry);
+
+ return compose;
}
void compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all)
gtk_stext_insert(text, NULL, NULL, NULL, "\n", 1); \
}
-void compose_forward(MsgInfo *msginfo, gboolean as_attach)
+Compose * compose_forward(PrefsAccount * account, MsgInfo *msginfo,
+ gboolean as_attach)
{
Compose *compose;
- PrefsAccount *account;
+ /* PrefsAccount *account; */
GtkSText *text;
FILE *fp;
gchar buf[BUFFSIZE];
g_return_if_fail(msginfo != NULL);
g_return_if_fail(msginfo->folder != NULL);
- account = msginfo->folder->folder->account;
- if (!account) account = cur_account;
+ if (account == NULL) {
+ account = msginfo->folder->folder->account;
+ if (!account) account = cur_account;
+ }
g_return_if_fail(account != NULL);
MSG_UNSET_FLAGS(msginfo->flags, MSG_REPLIED);
gtk_widget_grab_focus(compose->to_entry);
else
gtk_widget_grab_focus(compose->newsgroups_entry);
+
+ return compose;
}
#undef INSERT_FW_HEADER
case COMPOSE_BCC:
entry = GTK_ENTRY(compose->bcc_entry);
break;
+ case COMPOSE_NEWSGROUPS:
+ entry = GTK_ENTRY(compose->newsgroups_entry);
+ break;
case COMPOSE_TO:
default:
entry = GTK_ENTRY(compose->to_entry);
g_free(str);
}
-static gint compose_send(Compose *compose)
+gint compose_send(Compose *compose)
{
gchar tmp[MAXPATHLEN + 1];
gchar *to, *newsgroups;
}
path = folder_item_get_path(outbox);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
if ((fp = procmsg_open_mark_file(path, TRUE)) == NULL)
g_warning(_("can't open mark file\n"));
else {
g_free(tmp);
queue_path = folder_item_get_path(queue);
+ if (!is_dir_exist(queue_path))
+ make_dir_hier(queue_path);
+
if ((fp = procmsg_open_mark_file(queue_path, TRUE)) == NULL)
g_warning(_("can't open mark file\n"));
else {
{
COMPOSE_TO,
COMPOSE_CC,
- COMPOSE_BCC
+ COMPOSE_BCC,
+ COMPOSE_NEWSGROUPS
} ComposeEntryType;
typedef enum
off_t size;
};
-void compose_new (PrefsAccount *account);
+Compose * compose_new (PrefsAccount *account);
-void compose_new_with_recipient (PrefsAccount *account,
- const gchar *to);
+Compose * compose_new_with_recipient (PrefsAccount *account,
+ const gchar *to);
void compose_reply (MsgInfo *msginfo,
gboolean quote,
gboolean to_all);
-void compose_forward (MsgInfo *msginfo,
+Compose * compose_forward (PrefsAccount *account,
+ MsgInfo *msginfo,
gboolean as_attach);
void compose_reedit (MsgInfo *msginfo);
void compose_entry_append (Compose *compose,
const gchar *address,
ComposeEntryType type);
+gint compose_send(Compose *compose);
#endif /* __COMPOSE_H__ */
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <gtk/gtk.h>
#include <stdio.h>
#include "intl.h"
#include "utils.h"
#include "matcher.h"
#include "filtering.h"
#include "prefs.h"
+#include "compose.h"
#define PREFSBUFSIZE 1024
FILE * fp;
dest_path = folder_item_get_path(info->folder);
+ if (!is_dir_exist(dest_path))
+ make_dir_hier(dest_path);
+
if (dest_path == NULL) {
g_warning(_("Can't open mark file.\n"));
return FALSE;
{
FolderItem * dest_folder;
gint val;
+ Compose * compose;
+ PrefsAccount * account;
switch(action->type) {
case MATCHING_ACTION_MOVE:
case MATCHING_ACTION_FORWARD:
+ account = account_find_from_id(action->account_id);
+ compose = compose_forward(account, info, FALSE);
+ if (compose->account->protocol == A_NNTP)
+ compose_entry_append(compose, action->destination,
+ COMPOSE_NEWSGROUPS);
+ else
+ compose_entry_append(compose, action->destination,
+ COMPOSE_TO);
+
+ val = compose_send(compose);
+ if (val == 0) {
+ gtk_widget_destroy(compose->window);
+ return TRUE;
+ }
+
+ gtk_widget_destroy(compose->window);
return FALSE;
case MATCHING_ACTION_FORWARD_AS_ATTACHMENT:
+ account = account_find_from_id(action->account_id);
+ compose = compose_forward(account, info, TRUE);
+ if (compose->account->protocol == A_NNTP)
+ compose_entry_append(compose, action->destination,
+ COMPOSE_NEWSGROUPS);
+ else
+ compose_entry_append(compose, action->destination,
+ COMPOSE_TO);
+
+ val = compose_send(compose);
+ if (val == 0) {
+ gtk_widget_destroy(compose->window);
+ return TRUE;
+ }
+
+ gtk_widget_destroy(compose->window);
return FALSE;
default:
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ parse_cmd_opt(argc, argv);
+
gtk_set_locale();
gtk_init(&argc, &argv);
prog_version = PROG_VERSION;
startup_dir = g_get_current_dir();
- parse_cmd_opt(argc, argv);
+ /* parse_cmd_opt(argc, argv); */
CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
gtk_widget_set_sensitive(mainwin->get_btn, FALSE);
gtk_widget_set_sensitive(mainwin->getall_btn, FALSE);
}
+ if (prefs_common.immediate_exec)
+ gtk_widget_hide(mainwin->exec_btn);
+ else
+ gtk_widget_show(mainwin->exec_btn);
summary_change_display_item(mainwin->summaryview);
summary_redisplay_msg(mainwin->summaryview);
GtkWidget *replyall_btn;
GtkWidget *fwd_btn;
GtkWidget *send_btn;
+ /*
GtkWidget *prefs_btn;
GtkWidget *account_btn;
+ */
GtkWidget *next_btn;
GtkWidget *delete_btn;
GtkWidget *exec_btn;
toolbar_next_unread_cb,
mainwin);
+ /*
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
CREATE_TOOLBAR_ICON(stock_preferences_xpm);
gtk_signal_connect(GTK_OBJECT(account_btn), "button_press_event",
GTK_SIGNAL_FUNC(toolbar_account_button_pressed),
mainwin);
+ */
mainwin->toolbar = toolbar;
mainwin->get_btn = get_btn;
mainwin->replyall_btn = replyall_btn;
mainwin->fwd_btn = fwd_btn;
mainwin->send_btn = send_btn;
+ /*
mainwin->prefs_btn = prefs_btn;
mainwin->account_btn = account_btn;
+ */
mainwin->next_btn = next_btn;
mainwin->delete_btn = delete_btn;
mainwin->exec_btn = exec_btn;
compose_reply(msginfo, prefs_common.reply_with_quote, TRUE);
break;
case COMPOSE_FORWARD:
- compose_forward(msginfo, FALSE);
+ compose_forward(NULL, msginfo, FALSE);
break;
case COMPOSE_FORWARD_AS_ATTACH:
- compose_forward(msginfo, TRUE);
+ compose_forward(NULL, msginfo, TRUE);
break;
default:
compose_reply(msginfo, prefs_common.reply_with_quote, FALSE);
GtkWidget *replyall_btn;
GtkWidget *fwd_btn;
GtkWidget *send_btn;
+ /*
GtkWidget *prefs_btn;
GtkWidget *account_btn;
+ */
GtkWidget *next_btn;
GtkWidget *delete_btn;
GtkWidget *exec_btn;
g_return_val_if_fail(item != NULL, NULL);
path = folder_item_get_path(item);
+
if (stat(path, &s) < 0) {
FILE_OP_ERROR(path, "stat");
} else {
g_return_val_if_fail(num > 0 && num <= item->last_num, NULL);
path = folder_item_get_path(item);
+
file = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
g_free(path);
if (!is_file_exist(file)) {
destpath = folder_item_get_path(dest);
g_return_val_if_fail(destpath != NULL, -1);
+ if (!is_dir_exist(destpath))
+ make_dir_hier(destpath);
+
destfile = g_strdup_printf("%s%c%d", destpath, G_DIR_SEPARATOR,
dest->last_num + 1);
}
destdir = folder_item_get_path(dest);
+
+ if (!is_dir_exist(destdir))
+ make_dir_hier(destdir);
+
if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
g_warning(_("Can't open mark file.\n"));
}
destdir = folder_item_get_path(dest);
+ if (!is_dir_exist(destdir))
+ make_dir_hier(destdir);
+
if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
g_warning(_("Can't open mark file.\n"));
}
destdir = folder_item_get_path(dest);
+ if (!is_dir_exist(destdir))
+ make_dir_hier(destdir);
+
if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
g_warning(_("Can't open mark file.\n"));
}
destdir = folder_item_get_path(dest);
+ if (!is_dir_exist(destdir))
+ make_dir_hier(destdir);
+
if ((fp = procmsg_open_mark_file(destdir, TRUE)) == NULL)
g_warning(_("Can't open mark file.\n"));
g_return_val_if_fail(name != NULL, NULL);
path = folder_item_get_path(parent);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
fullpath = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL);
g_free(path);
g_return_val_if_fail(name != NULL, -1);
oldpath = folder_item_get_path(item);
+ if (!is_dir_exist(oldpath))
+ make_dir_hier(oldpath);
+
dirname = g_dirname(oldpath);
newpath = g_strconcat(dirname, G_DIR_SEPARATOR_S, name, NULL);
g_free(dirname);
g_return_val_if_fail(item != NULL, NULL);
path = folder_item_get_path(item);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(num), NULL);
g_free(path);
gchar *file;
dir = folder_item_get_path(item);
+ if (!is_dir_exist(dir))
+ make_dir_hier(dir);
+
if ((dp = opendir(dir)) == NULL) {
FILE_OP_ERROR(dir, "opendir");
g_free(dir);
debug_print(_("\tDeleting cached group list... "));
path = folder_item_get_path(item);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
filename = g_strconcat(path, G_DIR_SEPARATOR_S, GROUPLIST_FILE, NULL);
g_free(path);
if (remove(filename) != 0)
gchar * path;
path = folder_item_get_path(item);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
prefs_read_config(param, path, FOLDERITEM_RC);
g_free(path);
tmp_prefs = * item->prefs;
path = folder_item_get_path(item);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
prefs_save_config(param, path, FOLDERITEM_RC);
g_free(path);
}
debug_print(_("\tMarking the messages..."));
markdir = folder_item_get_path(item);
+ if (!is_dir_exist(markdir))
+ make_dir_hier(markdir);
+
mark_table = procmsg_read_mark_file(markdir);
g_free(markdir);
file = g_strdup(msginfo->plaintext_file);
else {
path = folder_item_get_path(msginfo->folder);
+
file = g_strconcat(path, G_DIR_SEPARATOR_S,
itos(msginfo->msgnum), NULL);
g_free(path);
menu_set_sensitive(ifactory, "/Open in new window", sens);
menu_set_sensitive(ifactory, "/View source", sens);
menu_set_sensitive(ifactory, "/Show all header", sens);
- if (summaryview->folder_item->stype == F_DRAFT)
+ if ((summaryview->folder_item->stype == F_DRAFT) ||
+ (summaryview->folder_item->stype == F_OUTBOX))
menu_set_sensitive(ifactory, "/Reedit", sens);
menu_set_sensitive(ifactory, "/Save as...", sens);
compose_reply(msginfo, FALSE, TRUE);
break;
case COMPOSE_FORWARD:
- compose_forward(msginfo, FALSE);
+ compose_forward(NULL, msginfo, FALSE);
break;
case COMPOSE_FORWARD_AS_ATTACH:
- compose_forward(msginfo, TRUE);
+ compose_forward(NULL, msginfo, TRUE);
break;
default:
compose_reply(msginfo, prefs_common.reply_with_quote, FALSE);