const gchar *fmt);
static void compose_reply_set_entry (Compose *compose,
MsgInfo *msginfo,
- gboolean to_all);
+ gboolean to_all,
+ gboolean to_author);
static void compose_reedit_set_entry (Compose *compose,
MsgInfo *msginfo);
static void compose_insert_sig (Compose *compose);
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)
+void compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all,
+ gboolean to_author)
{
Compose *compose;
PrefsAccount *account;
compose->mode = COMPOSE_REPLY;
if (compose_parse_header(compose, msginfo) < 0) return;
- compose_reply_set_entry(compose, msginfo, to_all);
+ compose_reply_set_entry(compose, msginfo, to_all, to_author);
text = GTK_STEXT(compose->text);
gtk_stext_freeze(text);
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);
}
static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
- gboolean to_all)
+ gboolean to_all, gboolean to_author)
{
GSList *cc_list;
GSList *cur;
if (compose->account->protocol != A_NNTP)
gtk_entry_set_text(GTK_ENTRY(compose->to_entry),
- compose->replyto ? compose->replyto
- : msginfo->from ? msginfo->from : "");
+ ( (compose->replyto && !to_author)
+ ? compose->replyto
+ : msginfo->from ? msginfo->from : ""));
if (compose->account->protocol == A_NNTP)
gtk_entry_set_text(GTK_ENTRY(compose->newsgroups_entry),
compose->followup_to ? compose->followup_to
g_free(str);
}
-static gint compose_send(Compose *compose)
+gint compose_send(Compose *compose)
{
gchar tmp[MAXPATHLEN + 1];
gchar *to, *newsgroups;
debug_print(_("saving sent message...\n"));
outbox = folder_get_default_outbox();
+ path = folder_item_get_path(outbox);
+ if (!is_dir_exist(path))
+ make_dir_hier(path);
+
folder_item_scan(outbox);
if ((num = folder_item_add_msg(outbox, file, FALSE)) < 0) {
+ g_free(path);
g_warning(_("can't save message\n"));
return -1;
}
- path = folder_item_get_path(outbox);
if ((fp = procmsg_open_mark_file(path, TRUE)) == NULL)
g_warning(_("can't open mark file\n"));
else {
queue = folder_get_default_queue();
folder_item_scan(queue);
+ queue_path = folder_item_get_path(queue);
+ if (!is_dir_exist(queue_path))
+ make_dir_hier(queue_path);
if ((num = folder_item_add_msg(queue, tmp, TRUE)) < 0) {
g_warning(_("can't queue the message\n"));
unlink(tmp);
g_free(tmp);
+ g_free(queue_path);
return -1;
}
g_free(tmp);
- queue_path = folder_item_get_path(queue);
if ((fp = procmsg_open_mark_file(queue_path, TRUE)) == NULL)
g_warning(_("can't open mark file\n"));
else {