commit - 20fd6d35ecda5a32b8bf90d39840d6606281f57b
commit + e8ebe27745291c2147478dfb9320c2372a2bf95d
blob - b33e16887d8c53bf5a5acfd2dde06f44e60cb5fc
blob + e6c459b3a4eb0dbe3a9a660120d0f2ac9f248741
--- src/compose.c
+++ src/compose.c
PrefsAccount *account,
gboolean warn);
static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item);
-static void compose_toggle_return_receipt_cb(GtkToggleAction *action,
- gpointer data);
static void compose_toggle_remove_refs_cb(GtkToggleAction *action,
gpointer data);
static void compose_reply_change_mode (Compose *compose, ComposeMode action);
{"Edit/AutoIndent", NULL, N_("Auto _indent"), NULL, NULL, G_CALLBACK(compose_toggle_autoindent_cb), FALSE }, /* Toggle */
{"Options/Sign", NULL, N_("Si_gn"), NULL, NULL, G_CALLBACK(compose_toggle_sign_cb), FALSE }, /* Toggle */
{"Options/Encrypt", NULL, N_("_Encrypt"), NULL, NULL, G_CALLBACK(compose_toggle_encrypt_cb), FALSE }, /* Toggle */
- {"Options/RequestRetRcpt", NULL, N_("_Request Return Receipt"), NULL, NULL, G_CALLBACK(compose_toggle_return_receipt_cb), FALSE }, /* Toggle */
{"Options/RemoveReferences", NULL, N_("Remo_ve references"), NULL, NULL, G_CALLBACK(compose_toggle_remove_refs_cb), FALSE }, /* Toggle */
{"Tools/ShowRuler", NULL, N_("Show _ruler"), NULL, NULL, G_CALLBACK(compose_toggle_ruler_cb), FALSE }, /* Toggle */
};
if (account->protocol != A_NNTP) {
if (mailto && *mailto != '\0') {
mfield = compose_entries_set(compose, mailto, COMPOSE_TO);
-
} else {
compose_set_folder_prefs(compose, item, TRUE);
}
- if (item && item->ret_rcpt) {
- cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE);
- }
- } else {
- if (mailto && *mailto != '\0') {
- if (!strchr(mailto, '@'))
- mfield = compose_entries_set(compose, mailto, COMPOSE_NEWSGROUPS);
- else
- mfield = compose_entries_set(compose, mailto, COMPOSE_TO);
- } else if (item && FOLDER_CLASS(item->folder) == news_get_class()) {
- compose_entry_append(compose, item->path, COMPOSE_NEWSGROUPS, PREF_FOLDER);
- mfield = TO_FIELD_PRESENT;
- }
- /*
- * CLAWS: just don't allow return receipt request, even if the user
- * may want to send an email. simple but foolproof.
- */
- cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", FALSE);
}
compose_add_field_list( compose, listAddress );
compose_extract_original_charset(compose);
- if (msginfo->folder && msginfo->folder->ret_rcpt)
- cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE);
-
/* Set save folder */
if (msginfo->folder && msginfo->folder->prefs && msginfo->folder->prefs->save_copy_to_folder) {
gchar *folderidentifier;
g_free(queueheader_buf);
}
if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, "RRCPT:")) {
- gint active = atoi(&queueheader_buf[strlen("RRCPT:")]);
- if (active) {
- cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE);
- }
g_free(queueheader_buf);
}
}
err |= (fprintf(fp, "SCF:%s\n", savefolderid) < 0);
g_free(savefolderid);
}
- /* Save copy folder */
- if (compose->return_receipt) {
- err |= (fprintf(fp, "RRCPT:1\n") < 0);
- }
/* Message-ID of message replying to */
if ((compose->replyinfo != NULL) && (compose->replyinfo->msgid != NULL)) {
gchar *folderid = NULL;
g_string_append_printf(header, "From: %s <%s>\n",
qname, from_address);
- if (!IS_IN_CUSTOM_HEADER("Disposition-Notification-To") &&
- compose->return_receipt) {
- compose_convert_header(compose, buf, sizeof(buf), from_name,
- strlen("Disposition-Notification-To: "),
- TRUE);
- g_string_append_printf(header, "Disposition-Notification-To: %s <%s>\n", buf, from_address);
- }
if (qname != name)
g_free(qname);
} else {
g_string_append_printf(header, "From: %s\n", from_address);
- if (!IS_IN_CUSTOM_HEADER("Disposition-Notification-To") &&
- compose->return_receipt)
- g_string_append_printf(header, "Disposition-Notification-To: %s\n", from_address);
-
}
g_free(from_name);
g_free(from_address);
/* To */
compose_add_headerfield_from_headerlist(compose, header, "To", ", ");
- /* Newsgroups */
- compose_add_headerfield_from_headerlist(compose, header, "Newsgroups", ",");
-
/* Cc */
compose_add_headerfield_from_headerlist(compose, header, "Cc", ", ");
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Sign", "Options/Sign", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Encrypt", "Options/Encrypt", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator3", "Options/---", GTK_UI_MANAGER_SEPARATOR)
- MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "RequestRetRcpt", "Options/RequestRetRcpt", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator4", "Options/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "RemoveReferences", "Options/RemoveReferences", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator5", "Options/---", GTK_UI_MANAGER_SEPARATOR)
err |= (fprintf(fp, "SCF:%s\n", savefolderid) < 0);
g_free(savefolderid);
}
- if (compose->return_receipt) {
- err |= (fprintf(fp, "RRCPT:1\n") < 0);
- }
if (compose->privacy_system) {
err |= (fprintf(fp, "X-Claws-Sign:%d\n", compose->use_signing) < 0);
err |= (fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption) < 0);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
}
-static void compose_toggle_return_receipt_cb(GtkToggleAction *action, gpointer data)
-{
- Compose *compose = (Compose *)data;
-
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
- compose->return_receipt = TRUE;
- else
- compose->return_receipt = FALSE;
-}
-
static void compose_toggle_remove_refs_cb(GtkToggleAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
blob - 7cd75647e17616e35bc17b0303408ceba70fc09c
blob + 9f6fe7e9a897c29e0debee787f296a682000536c
--- src/messageview.c
+++ src/messageview.c
static gboolean key_pressed (GtkWidget *widget,
GdkEventKey *event,
MessageView *messageview);
-static void return_receipt_show (NoticeView *noticeview,
- MsgInfo *msginfo);
-static void return_receipt_send_clicked (NoticeView *noticeview,
- MsgInfo *msginfo);
+
static void partial_recv_show (NoticeView *noticeview,
MsgInfo *msginfo);
static void partial_recv_dload_clicked (NoticeView *noticeview,
}
}
-static gint disposition_notification_send(MsgInfo *msginfo)
-{
- gchar *buf = NULL;
- gchar tmp[MAXPATHLEN + 1];
- FILE *fp;
- GList *ac_list;
- PrefsAccount *account = NULL;
- gint ok;
- gchar *to;
- FolderItem *queue, *outbox;
- gint num;
- gchar *path;
- gchar *addr;
- gchar *addrp;
- gchar *foo = NULL;
- gboolean queued_removed = FALSE;
- gchar *boundary = NULL;
- gchar buf_date[RFC822_DATE_BUFFSIZE];
- gchar *date = NULL;
- gchar *orig_to = NULL;
- gchar *enc_sub = NULL;
-
- if (!msginfo->extradata)
- return -1;
- if (!msginfo->extradata->returnreceiptto &&
- !msginfo->extradata->dispositionnotificationto)
- return -1;
-
- /* RFC2298: Test for Return-Path */
- if (msginfo->extradata->dispositionnotificationto)
- to = msginfo->extradata->dispositionnotificationto;
- else
- to = msginfo->extradata->returnreceiptto;
-
- ok = procheader_get_header_from_msginfo(msginfo, &buf, "Return-Path:");
- if (ok == 0) {
- gchar *to_addr = g_strdup(to);
- extract_address(to_addr);
- extract_address(buf);
- ok = strcasecmp(to_addr, buf);
- g_free(to_addr);
- } else {
- buf = g_strdup(_("<No Return-Path found>"));
- }
-
- if (ok != 0) {
- AlertValue val;
- gchar *message;
- message = g_markup_printf_escaped(
- _("The notification address to which the return receipt is\n"
- "to be sent does not correspond to the return path:\n"
- "Notification address: %s\n"
- "Return path: %s\n"
- "It is advised to not send the return receipt."),
- to, buf);
- val = alertpanel_full(_("Warning"), message,
- NULL, _("_Don't Send"), NULL, _("_Send"),
- NULL, NULL, ALERTFOCUS_FIRST, FALSE,
- NULL, ALERT_WARNING);
- g_free(message);
- if (val != G_ALERTALTERNATE) {
- g_free(buf);
- return -1;
- }
- }
- g_free(buf);
- buf = NULL;
-
- ac_list = account_find_all_from_address(NULL, msginfo->to);
- ac_list = account_find_all_from_address(ac_list, msginfo->cc);
-
- if (ac_list == NULL) {
- ac_list = account_find_all();
- if ((account = select_account_from_list(ac_list, FALSE)) == NULL)
- return -1;
- } else if (g_list_length(ac_list) > 1) {
- if ((account = select_account_from_list(ac_list, TRUE)) == NULL)
- return -1;
- } else if (ac_list != NULL)
- account = (PrefsAccount *) ac_list->data;
- g_list_free(ac_list);
-
- if (account == NULL)
- account = account_get_default();
- if (!account || account->protocol == A_NNTP) {
- alertpanel_error(_("Account for sending mail is not specified.\n"
- "Please select a mail account before sending."));
- return -1;
- }
-
- /* write to temporary file */
- g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg%p",
- get_rc_dir(), G_DIR_SEPARATOR, msginfo);
-
- if ((fp = g_fopen(tmp, "wb")) == NULL) {
- FILE_OP_ERROR(tmp, "g_fopen");
- return -1;
- }
-
- /* chmod for security */
- if (change_file_mode_rw(fp, tmp) < 0) {
- FILE_OP_ERROR(tmp, "chmod");
- g_warning("can't change file mode");
- }
-
- addr = g_strdup(to);
-
- extract_address(addr);
- addrp = addr;
-
- /* write queue headers */
- ok = fprintf(fp, "AF:\n"
- "NF:0\n"
- "PS:10\n"
- "SRH:1\n"
- "SFN:\n"
- "DSR:\n"
- "MID:\n"
- "CFG:\n"
- "PT:0\n"
- "S:%s\n"
- "RQ:\n"
- "SSV:%s\n"
- "SSH:\n"
- "R:<%s>\n",
- account->address,
- account->smtp_server?account->smtp_server:"",
- addrp);
-
- g_free(addrp);
- if (ok < 0)
- goto FILE_ERROR;
-
- /* check whether we need to save the message */
- outbox = account_get_special_folder(account, F_OUTBOX);
- if (folder_get_default_outbox() == outbox && !prefs_common.savemsg)
- outbox = NULL;
- if (outbox) {
- path = folder_item_get_identifier(outbox);
- ok = fprintf(fp, "SCF:%s\n", path);
- g_free(path);
-
- if (ok < 0)
- goto FILE_ERROR;
- }
-
- if (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0)
- goto FILE_ERROR;
-
- /* Date */
- get_rfc822_date(buf_date, sizeof(buf_date));
- if (fprintf(fp, "Date: %s\n", buf_date) < 0)
- goto FILE_ERROR;
-
- /* From */
- if (account->name && *account->name) {
- notification_convert_header(&buf, account->name, strlen("From: "));
- if (buf == NULL)
- goto FILE_ERROR;
- if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0) {
- g_free(buf);
- goto FILE_ERROR;
- }
- g_free(buf);
- buf = NULL;
- } else {
- if (fprintf(fp, "From: %s\n", account->address) < 0)
- goto FILE_ERROR;
- }
-
- if (fprintf(fp, "To: %s\n", to) < 0)
- goto FILE_ERROR;
-
- /* Subject */
- notification_convert_header(&buf, msginfo->subject, strlen("Subject: "));
- if (buf == NULL)
- goto FILE_ERROR;
- if (fprintf(fp, "Subject: Disposition notification: %s\n", buf) < 0) {
- g_free(buf);
- goto FILE_ERROR;
- }
- g_free(buf);
- buf = NULL;
-
- /* Message ID */
- if (account->gen_msgid) {
- gchar *addr = prefs_account_generate_msgid(account);
- if (fprintf(fp, "Message-ID: <%s>\n", addr) < 0) {
- g_free(addr);
- goto FILE_ERROR;
- }
- g_free(addr);
- }
-
- boundary = generate_mime_boundary("DN");
- date = g_strdup(buf_date);
- if (msginfo->to) {
- orig_to = g_strdup(msginfo->to);
- extract_address(orig_to);
- }
- if (msginfo->subject && *(msginfo->subject)) {
- enc_sub = g_malloc0(strlen(msginfo->subject)*8);
- qp_encode_line(enc_sub, (const guchar *)msginfo->subject);
- g_strstrip(enc_sub);
- }
- ok = fprintf(fp,"MIME-Version: 1.0\n"
- "Content-Type: multipart/report; report-type=disposition-notification;\n"
- " boundary=\"%s\"\n"
- "\n"
- "--%s\n"
- "Content-Type: text/plain; charset=UTF-8\n"
- "Content-Transfer-Encoding: quoted-printable\n"
- "\n"
- "The message sent on: %s\n"
- "To: %s\n"
- "With subject: \"%s\"\n"
- "has been displayed at %s.\n"
- "\n"
- "There is no guarantee that the message has been read or understood.\n"
- "\n"
- "--%s\n"
- "Content-Type: message/disposition-notification\n"
- "\n"
- "Reporting-UA: %s\n"
- "Original-Recipient: rfc822;%s\n"
- "Final-Recipient: rfc822;%s\n"
- "Original-Message-ID: <%s>\n"
- "Disposition: manual-action/MDN-sent-manually; displayed\n"
- "\n"
- "--%s\n"
- "Content-Type: application/octet-stream\n"
- "\n"
- "Reporting-UA: %s\n"
- "Original-Recipient: rfc822;%s\n"
- "Final-Recipient: rfc822;%s\n"
- "Original-Message-ID: <%s>\n"
- "Disposition: manual-action/MDN-sent-manually; displayed\n"
- "\n"
- "--%s--\n",
- boundary,
- boundary,
- msginfo->date,
- orig_to?orig_to:"No To:",
- enc_sub?enc_sub:"No subject",
- date,
- boundary,
- PROG_VERSION,
- orig_to?orig_to:"No To:",
- account->address,
- msginfo->msgid?msginfo->msgid:"NO MESSAGE ID",
- boundary,
- PROG_VERSION,
- orig_to?orig_to:"No To:",
- account->address,
- msginfo->msgid?msginfo->msgid:"NO MESSAGE ID",
- boundary);
-
- g_free(enc_sub);
- g_free(orig_to);
- g_free(date);
- g_free(boundary);
-
- if (ok < 0)
- goto FILE_ERROR;
-
- if (safe_fclose(fp) == EOF) {
- FILE_OP_ERROR(tmp, "fclose");
- unlink(tmp);
- return -1;
- }
-
- /* put it in queue */
- queue = account_get_special_folder(account, F_QUEUE);
- if (!queue) queue = folder_get_default_queue();
- if (!queue) {
- g_warning("can't find queue folder");
- unlink(tmp);
- return -1;
- }
- folder_item_scan(queue);
- if ((num = folder_item_add_msg(queue, tmp, NULL, TRUE)) < 0) {
- g_warning("can't queue the message");
- unlink(tmp);
- return -1;
- }
-
- if (prefs_common.work_offline &&
- !inc_offline_should_override(TRUE,
- _("Claws Mail needs network access in order "
- "to send this email.")))
- return 0;
-
- /* send it */
- path = folder_item_fetch_msg(queue, num);
- ok = procmsg_send_message_queue_with_lock(path, &foo, queue, num, &queued_removed);
- g_free(path);
- g_free(foo);
- if (ok == 0 && !queued_removed)
- folder_item_remove_msg(queue, num);
-
- return ok;
-
-FILE_ERROR:
- fclose(fp);
- unlink(tmp);
- return -1;
-}
-
static gboolean find_encrypted_func(GNode *node, gpointer data)
{
MimeInfo *mimeinfo = (MimeInfo *) node->data;
&& !noticeview_is_visible(messageview->noticeview))
partial_recv_show(messageview->noticeview,
messageview->msginfo);
- else if (messageview->msginfo && messageview->msginfo->extradata &&
- (messageview->msginfo->extradata->dispositionnotificationto ||
- messageview->msginfo->extradata->returnreceiptto) &&
- !MSG_IS_RETRCPT_SENT(messageview->msginfo->flags) &&
- !prefs_common.never_send_retrcpt &&
- !noticeview_is_visible(messageview->noticeview))
- return_receipt_show(messageview->noticeview,
- messageview->msginfo);
if (find_broken_part(mimeinfo) != NULL) {
noticeview_set_icon(messageview->noticeview,
messageview->partial_display_shown = TRUE;
}
-static void return_receipt_show(NoticeView *noticeview, MsgInfo *msginfo)
-{
- gchar *addr = NULL;
- gboolean from_me = FALSE;
- if (msginfo->folder
- && (folder_has_parent_of_type(msginfo->folder, F_QUEUE)
- || folder_has_parent_of_type(msginfo->folder, F_DRAFT)))
- return;
-
- addr = g_strdup(msginfo->from);
- if (addr) {
- extract_address(addr);
- if (account_find_from_address(addr, FALSE)) {
- from_me = TRUE;
- }
- g_free(addr);
- }
-
- if (from_me) {
- noticeview_set_icon(noticeview, STOCK_PIXMAP_NOTICE_WARN);
- if (MSG_IS_RETRCPT_GOT(msginfo->flags)) {
- noticeview_set_text(noticeview, _("You got a return receipt for this message: "
- "it has been displayed by the recipient."));
- } else {
- noticeview_set_text(noticeview, _("You asked for a return receipt in this message."));
- }
- noticeview_set_button_text(noticeview, NULL);
- noticeview_set_button_press_callback(noticeview, NULL, NULL);
- } else {
- noticeview_set_icon(noticeview, STOCK_PIXMAP_NOTICE_WARN);
- noticeview_set_text(noticeview, _("This message asks for a return receipt."));
- noticeview_set_button_text(noticeview, _("Send receipt"));
- noticeview_set_button_press_callback(noticeview,
- G_CALLBACK(return_receipt_send_clicked),
- (gpointer) msginfo);
- }
- noticeview_show(noticeview);
-}
-
-static void return_receipt_send_clicked(NoticeView *noticeview, MsgInfo *msginfo)
-{
- MsgInfo *tmpmsginfo;
- gchar *file;
-
- file = procmsg_get_message_file_path(msginfo);
- if (!file) {
- g_warning("can't get message file path");
- return;
- }
-
- tmpmsginfo = procheader_parse_file(file, msginfo->flags, TRUE, TRUE);
- tmpmsginfo->folder = msginfo->folder;
- tmpmsginfo->msgnum = msginfo->msgnum;
-
- if (disposition_notification_send(tmpmsginfo) >= 0) {
- procmsg_msginfo_set_flags(msginfo, MSG_RETRCPT_SENT, 0);
- noticeview_hide(noticeview);
- }
-
- procmsg_msginfo_free(&tmpmsginfo);
- g_free(file);
-}
-
static void partial_recv_show(NoticeView *noticeview, MsgInfo *msginfo)
{
gchar *text = NULL;
blob - 04145433ee4d651ce2afdd52d54e16c0effd3813
blob + 49e6adeb4ef5e0ab7616511ad47e66571379078f
--- src/prefs_folder_item.c
+++ src/prefs_folder_item.c
rowcount++;
if (item_protocol(item) != A_NNTP) {
- /* Request Return Receipt */
- checkbtn_request_return_receipt = gtk_check_button_new_with_label
- (_("Request Return Receipt"));
- gtk_grid_attach(GTK_GRID(table), checkbtn_request_return_receipt, 0, rowcount, 1, 1);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
- item->ret_rcpt ? TRUE : FALSE);
-
- request_return_receipt_rec_checkbtn = gtk_check_button_new();
- gtk_grid_attach(GTK_GRID(table), request_return_receipt_rec_checkbtn, 2, rowcount, 1, 1);
- rowcount++;
-
/* Save Copy to Folder */
checkbtn_save_copy_to_folder = gtk_check_button_new_with_label
(_("Save copy of outgoing messages to this folder instead of Sent"));