static PrefsAccount *compose_current_mail_account(void);
/* static gint compose_send (Compose *compose); */
+static gboolean compose_check_for_valid_recipient
+ (Compose *compose);
+static gboolean compose_check_entries (Compose *compose);
static gint compose_write_to_file (Compose *compose,
const gchar *file,
gboolean is_draft);
static gint compose_write_body_to_file (Compose *compose,
const gchar *file);
-static gint compose_save_to_outbox (Compose *compose,
- const gchar *file);
static gint compose_remove_reedit_target (Compose *compose);
static gint compose_queue (Compose *compose,
gint *msgnum,
#endif /* USE_GPGME */
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/_Request Return Receipt"), NULL, compose_toggle_return_receipt_cb, 0, "<ToggleItem>"},
- {N_("/_Tool"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Tool/Show _ruler"), NULL, compose_toggle_ruler_cb, 0, "<ToggleItem>"},
- {N_("/_Tool/_Address book"), "<shift><control>A", compose_address_cb , 0, NULL},
- {N_("/_Tool/_Template"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Tool/Actio_ns"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Tools"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Tools/Show _ruler"), NULL, compose_toggle_ruler_cb, 0, "<ToggleItem>"},
+ {N_("/_Tools/_Address book"), "<shift><control>A", compose_address_cb , 0, NULL},
+ {N_("/_Tools/_Template"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Tools/Actio_ns"), NULL, NULL, 0, "<Branch>"},
{N_("/_Help"), NULL, NULL, 0, "<Branch>"},
{N_("/_Help/_About"), NULL, about_show, 0, NULL}
};
menu_set_sensitive(ifactory, "/Message/Encrypt", FALSE);
#endif
menu_set_sensitive(ifactory, "/Message/Request Return Receipt", FALSE);
- menu_set_sensitive(ifactory, "/Tool/Template", FALSE);
+ menu_set_sensitive(ifactory, "/Tools/Template", FALSE);
gtk_widget_set_sensitive(c->insert_btn, FALSE);
gtk_widget_set_sensitive(c->attach_btn, FALSE);
}
line_end = 1;
} else {
- if (ch_len == 1 && strchr(">:#", *cbuf))
+ if (ch_len == 1 && strchr(">|:#", *cbuf))
quoted = 1;
else if (ch_len != 1 || !isspace(*cbuf))
quoted = 0;
}
line_end = 1;
} else {
- if (line_end && ch_len == 1 && strchr(">:#", *cbuf))
+ if (line_end && ch_len == 1 && strchr(">|:#", *cbuf))
goto compose_end; /* quoted part */
line_end = 0;
GET_CHAR(i, cbuf, ch_len);
if (ch_len > 1)
break;
- /* allow space, tab, > or | */
- if (cbuf[0] != ' ' && cbuf[0] != '\t' &&
- cbuf[0] != '>' && cbuf[0] != '|')
+ /* allow space, tab, >, |, : or # */
+ if (!strchr(" \t>|:#", *cbuf))
break;
indent_len++;
}
return recipient_found;
}
+static gboolean compose_check_entries(Compose *compose)
+{
+ gchar *str;
+
+ if (compose_check_for_valid_recipient(compose) == FALSE) {
+ alertpanel_error(_("Recipient is not specified."));
+ return FALSE;
+ }
+
+ str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+ if (*str == '\0') {
+ AlertValue aval;
+
+ aval = alertpanel(_("Send"),
+ _("Subject is empty. Send it anyway?"),
+ _("Yes"), _("No"), NULL);
+ if (aval != G_ALERTDEFAULT)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
gint compose_send(Compose *compose)
{
gint msgnum;
lock = TRUE;
- if(!compose_check_for_valid_recipient(compose)) {
- alertpanel_error(_("Recipient is not specified."));
+ if (compose_check_entries(compose) == FALSE) {
lock = FALSE;
return 1;
}
folderview_update_item
(compose->targetinfo->folder, TRUE);
}
- }
-
- /* save message to outbox */
- if (ok == 0 && prefs_common.savemsg) {
- if (compose_save_to_outbox(compose, tmp) < 0)
- alertpanel_error
- (_("Can't save the message to outbox."));
+ /* save message to outbox */
+ if (prefs_common.savemsg) {
+ Folder *folder = FOLDER(compose->account->folder);
+ FolderItem *outbox = NULL;
+
+ if (folder)
+ outbox = folder->outbox;
+ if (procmsg_save_to_outbox(outbox, tmp, FALSE) < 0)
+ alertpanel_error
+ (_("Can't save the message to outbox."));
+ }
}
unlink(tmp);
if (fputs(buf, fdest) == -1)
goto error;
- if (g_strncasecmp(buf, "From:", strlen("From:")) == 0) {
- fputs(" (by way of ", fdest);
- if (compose->account->name
- && *compose->account->name) {
- compose_convert_header
- (buf, sizeof(buf),
- compose->account->name,
- strlen("From: "));
- fprintf(fdest, "%s <%s>",
- buf, compose->account->address);
- } else
- fprintf(fdest, "%s",
- compose->account->address);
- fputs(")", fdest);
+ if (!prefs_common.bounce_keep_from) {
+ if (g_strncasecmp(buf, "From:",
+ strlen("From:")) == 0) {
+ fputs(" (by way of ", fdest);
+ if (compose->account->name
+ && *compose->account->name) {
+ compose_convert_header
+ (buf, sizeof(buf),
+ compose->account->name,
+ strlen("From: "));
+ fprintf(fdest, "%s <%s>",
+ buf,
+ compose->account->address);
+ } else
+ fprintf(fdest, "%s",
+ compose->account->address);
+ fputs(")", fdest);
+ }
}
if (fputs("\n", fdest) == -1)
return 0;
}
-static gint compose_save_to_outbox(Compose *compose, const gchar *file)
-{
- FolderItem *outbox;
- gchar *path;
- gint num;
- FILE *fp;
-
- 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;
- }
-
- if ((fp = procmsg_open_mark_file(path, TRUE)) == NULL)
- g_warning(_("can't open mark file\n"));
- else {
- MsgInfo newmsginfo;
-
- newmsginfo.msgnum = num;
- newmsginfo.flags.perm_flags = 0;
- newmsginfo.flags.tmp_flags = 0;
- procmsg_write_flags(&newmsginfo, fp);
- fclose(fp);
- }
- g_free(path);
-
- return 0;
-}
-
static gint compose_remove_reedit_target(Compose *compose)
{
FolderItem *item;
lock = TRUE;
- if(!compose_check_for_valid_recipient(compose)) {
+/* if(!compose_check_for_valid_recipient(compose)) {
alertpanel_error(_("Recipient is not specified."));
lock = FALSE;
return -1;
- }
+ } */
+ if (compose_check_entries(compose) == FALSE) {
+ lock = FALSE;
+ return -1;
+ }
+
if (!compose->to_list && !compose->newsgroup_list) {
g_warning(_("can't get recipient list."));
lock = FALSE;
g_free(tmp2);
return -1;
}
-
- /* queue message */
- queue = folder_get_default_queue();
+
+ if (compose->account->folder &&
+ FOLDER(compose->account->folder)->queue)
+ queue = FOLDER(compose->account->folder)->queue;
+ else
+ queue = folder_get_default_queue();
folder_item_scan(queue);
queue_path = folder_item_get_path(queue);
menu_set_sensitive(ifactory, "/Edit/Undo", FALSE);
menu_set_sensitive(ifactory, "/Edit/Redo", FALSE);
- tmpl_menu = gtk_item_factory_get_item(ifactory, "/Tool/Template");
+ tmpl_menu = gtk_item_factory_get_item(ifactory, "/Tools/Template");
#if 0 /* NEW COMPOSE GUI */
gtk_widget_hide(bcc_hbox);
gtk_widget_hide(bcc_entry);
}
#endif
- update_compose_actions_menu(ifactory, "/Tool/Actions", compose);
+ update_compose_actions_menu(ifactory, "/Tools/Actions", compose);
undostruct = undo_init(text);
if (lock) return;
- draft = folder_get_default_draft();
+ if (compose->account && compose->account->folder &&
+ FOLDER(compose->account->folder)->draft)
+ draft = FOLDER(compose->account->folder)->draft;
+ else
+ draft = folder_get_default_draft();
g_return_if_fail(draft != NULL);
lock = TRUE;
}
folder_item_scan(draft);
- if ((msgnum = folder_item_add_msg(draft, tmp, TRUE)) <= 0) {
+ if ((msgnum = folder_item_add_msg(draft, tmp, TRUE)) < 0) {
unlink(tmp);
g_free(tmp);
lock = FALSE;