#include "customheader.h"
#include "prefs_common.h"
#include "prefs_account.h"
-#include "prefs_actions.h"
+#include "action.h"
#include "account.h"
#include "filesel.h"
#include "procheader.h"
static void compose_convert_header (gchar *dest,
gint len,
gchar *src,
- gint header_len);
+ gint header_len,
+ gboolean addr_field);
static void compose_generate_msgid (Compose *compose,
gchar *buf,
gint len);
if (str[0] != '\0') {
compose_convert_header
(buf, sizeof(buf), str,
- strlen("Resent-To") + 2);
+ strlen("Resent-To") + 2, TRUE);
if (first_address) {
fprintf(fp, "Resent-To: ");
first_address = FALSE;
if (compose->account->name && *compose->account->name) {
compose_convert_header
(buf, sizeof(buf), compose->account->name,
- strlen("From: "));
+ strlen("From: "), TRUE);
fprintf(fp, "Resent-From: %s <%s>\n",
buf, compose->account->address);
} else
g_strstrip(str);
if (*str != '\0') {
compose_convert_header(buf, sizeof(buf), str,
- strlen("Subject: "));
+ strlen("Subject: "), FALSE);
fprintf(fp, "Subject: %s\n", buf);
}
}
compose_convert_header
(buf, sizeof(buf),
compose->account->name,
- strlen("From: "));
+ strlen("From: "),
+ FALSE);
fprintf(fdest, "%s <%s>",
buf,
compose->account->address);
fprintf(fp, "Content-Disposition: inline\n");
} else {
compose_convert_header(filename, sizeof(filename),
- ainfo->name, 12);
+ ainfo->name, 12, FALSE);
fprintf(fp, "Content-Type: %s;\n"
" name=\"%s\"\n",
ainfo->content_type, filename);
compose->to_list = address_list_append \
(compose->to_list, str); \
compose_convert_header \
- (buf, sizeof(buf), str, strlen(header) + 2); \
+ (buf, sizeof(buf), str, strlen(header) + 2, \
+ TRUE); \
fprintf(fp, "%s: %s\n", header, buf); \
} \
} \
if (str[0] != '\0') {
compose_convert_header
(buf, sizeof(buf), str,
- strlen(header) + 2);
+ strlen(header) + 2, TRUE);
if (first_address) {
fprintf(fp, "%s: ", header);
first_address = FALSE;
if (compose->account->name && *compose->account->name) {
compose_convert_header
(buf, sizeof(buf), compose->account->name,
- strlen("From: "));
+ strlen("From: "), TRUE);
QUOTE_IF_REQUIRED(name, buf);
fprintf(fp, "From: %s <%s>\n",
name, compose->account->address);
newsgroup_list_append
(compose->newsgroup_list, str);
compose_convert_header(buf, sizeof(buf), str,
- strlen("Newsgroups: "));
+ strlen("Newsgroups: "),
+ TRUE);
fprintf(fp, "Newsgroups: %s\n", buf);
}
}
g_strstrip(str);
if (*str != '\0') {
compose_convert_header(buf, sizeof(buf), str,
- strlen("Subject: "));
+ strlen("Subject: "), FALSE);
fprintf(fp, "Subject: %s\n", buf);
}
}
remove_space(str);
if (*str != '\0') {
compose_convert_header(buf, sizeof(buf), str,
- strlen("Followup-To: "));
+ strlen("Followup-To: "),
+ TRUE);
fprintf(fp, "Followup-To: %s\n", buf);
}
}
g_strstrip(str);
if (*str != '\0') {
compose_convert_header(buf, sizeof(buf), str,
- strlen("Reply-To: "));
+ strlen("Reply-To: "),
+ TRUE);
fprintf(fp, "Reply-To: %s\n", buf);
}
}
!IS_IN_CUSTOM_HEADER("Organization")) {
compose_convert_header(buf, sizeof(buf),
compose->account->organization,
- strlen("Organization: "));
+ strlen("Organization: "), FALSE);
fprintf(fp, "Organization: %s\n", buf);
}
compose_convert_header
(buf, sizeof(buf),
chdr->value ? chdr->value : "",
- strlen(chdr->name) + 2);
+ strlen(chdr->name) + 2, FALSE);
fprintf(fp, "%s: %s\n", chdr->name, buf);
}
}
if (compose->return_receipt) {
if (compose->account->name
&& *compose->account->name) {
- compose_convert_header(buf, sizeof(buf), compose->account->name, strlen("Disposition-Notification-To: "));
+ compose_convert_header(buf, sizeof(buf),
+ compose->account->name,
+ strlen("Disposition-Notification-To: "),
+ TRUE);
fprintf(fp, "Disposition-Notification-To: %s <%s>\n", buf, compose->account->address);
} else
fprintf(fp, "Disposition-Notification-To: %s\n", compose->account->address);
#undef IS_IN_CUSTOM_HEADER
static void compose_convert_header(gchar *dest, gint len, gchar *src,
- gint header_len)
+ gint header_len, gboolean addr_field)
{
g_return_if_fail(src != NULL);
g_return_if_fail(dest != NULL);
g_strchomp(src);
- conv_encode_header(dest, len, src, header_len);
+ conv_encode_header(dest, len, src, header_len, addr_field);
}
static void compose_generate_msgid(Compose *compose, gchar *buf, gint len)
}
#endif
- update_compose_actions_menu(ifactory, "/Tools/Actions", compose);
+ action_update_compose_menu(ifactory, compose);
undostruct = undo_init(text);
compose->modified = FALSE;
compose->return_receipt = FALSE;
- compose->paste_as_quotation = FALSE;
compose->to_list = NULL;
compose->newsgroup_list = NULL;
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), prefs_common.trans_hdr ? _("Newsgroups:") : "Newsgroups:");
addressbook_set_target_compose(compose);
- update_compose_actions_menu(ifactory, "/Tools/Actions", compose);
+ action_update_compose_menu(ifactory, compose);
if (mode != COMPOSE_REDIRECT)
compose_set_template_menu(compose);
{
if (compose->focused_editable &&
GTK_WIDGET_HAS_FOCUS(compose->focused_editable)) {
- compose->paste_as_quotation = TRUE;
+ /* let text_insert() (called directly or at a later time
+ * after the gtk_editable_paste_clipboard) know that
+ * text is to be inserted as a quotation. implemented
+ * by using a simple refcount... */
+ gint paste_as_quotation = GPOINTER_TO_INT(gtk_object_get_data(
+ GTK_OBJECT(compose->focused_editable),
+ "paste_as_quotation"));
+ gtk_object_set_data(GTK_OBJECT(compose->focused_editable),
+ "paste_as_quotation",
+ GINT_TO_POINTER(paste_as_quotation + 1));
gtk_editable_paste_clipboard
(GTK_EDITABLE(compose->focused_editable));
- compose->paste_as_quotation = FALSE;
}
}
gint length, gint *position, Compose *compose)
{
GtkEditable *editable = GTK_EDITABLE(widget);
+ gint paste_as_quotation = GPOINTER_TO_INT(gtk_object_get_data
+ (GTK_OBJECT(widget), "paste_as_quotation"));
gtk_signal_handler_block_by_func(GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(text_inserted),
compose);
- if (compose->paste_as_quotation) {
+ if (paste_as_quotation) {
gchar *new_text;
gchar *qmark;
gint pos;
gtk_editable_set_position(editable, pos);
*position = pos;
g_free(new_text);
+ gtk_object_set_data(GTK_OBJECT(widget), "paste_as_quotation",
+ GINT_TO_POINTER(paste_as_quotation - 1));
} else
gtk_editable_insert_text(editable, text, length, position);