commit 77c35669c9ee41a65effd7edd82224fad9db5f6c from: Oliver Lowe date: Fri Dec 26 08:52:39 2025 UTC Drop PGP support It never really caught on. For really truly encrypted messaging there's Signal. commit - e655086f6825d74eb9af518efcdbbb91707005f8 commit + 77c35669c9ee41a65effd7edd82224fad9db5f6c blob - a07a0a1a9d27d410145361e80f2eb5b528504296 blob + 935e6dfcb83b5786d245bd4e8d35026b69d7f4cc --- src/compose.c +++ src/compose.c @@ -83,7 +83,6 @@ #include "message_search.h" #include "combobox.h" #include "hooks.h" -#include "privacy.h" #include "headers.h" #include "file-utils.h" #include "fence.h" @@ -153,13 +152,6 @@ typedef enum { #define COMPOSE_DRAFT_TIMEOUT_UNSET -1 #define COMPOSE_DRAFT_TIMEOUT_FORBIDDEN -2 -#define COMPOSE_PRIVACY_WARNING() { \ - alertpanel_error(_("You have opted to sign and/or encrypt this " \ - "message but have not selected a privacy system.\n\n" \ - "Signing and encrypting have been disabled for this " \ - "message.")); \ -} - #define INVALID_PID -1 static GdkRGBA default_header_bgcolor = @@ -200,7 +192,6 @@ static Compose *compose_reply (MsgInfo *msginfo, static Compose *compose_reply_mode (ComposeMode mode, GSList *msginfo_list, gchar *body); -static void compose_update_privacy_systems_menu(Compose *compose); static GtkWidget *compose_account_option_menu_create (Compose *compose); @@ -410,20 +401,8 @@ static void compose_toggle_autowrap_cb (GtkToggleActio gpointer data); static void compose_toggle_autoindent_cb(GtkToggleAction *action, gpointer data); - -static void compose_toggle_sign_cb (GtkToggleAction *action, - gpointer data); -static void compose_toggle_encrypt_cb (GtkToggleAction *action, - gpointer data); -static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data); -static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn); -static void compose_activate_privacy_system (Compose *compose, - PrefsAccount *account, - gboolean warn); -static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item); -static void compose_toggle_remove_refs_cb(GtkToggleAction *action, - gpointer data); -static void compose_reply_change_mode (Compose *compose, ComposeMode action); +static void compose_toggle_remove_refs_cb(GtkToggleAction *action, gpointer data); +static void compose_reply_change_mode (Compose *compose, ComposeMode action); static void compose_reply_change_mode_cb(GtkAction *action, GtkRadioAction *current, gpointer data); static void compose_attach_drag_received_cb (GtkWidget *widget, @@ -572,8 +551,6 @@ static GtkActionEntry compose_entries[] = {"Options/ReplyMode", NULL, N_("Reply _mode"), NULL, NULL, NULL }, {"Options/---", NULL, "---", NULL, NULL, NULL }, - {"Options/PrivacySystem", NULL, N_("Privacy _System"), NULL, NULL, NULL }, - {"Options/PrivacySystem/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(compose_nothing_cb) }, {"Options/Encoding", NULL, N_("Character _encoding"), NULL, NULL, NULL }, {"Options/Encoding/---", NULL, "---", NULL, NULL, NULL }, @@ -591,8 +568,6 @@ static GtkToggleActionEntry compose_toggle_entries[] = { {"Edit/AutoWrap", NULL, N_("Aut_o wrapping"), "L", NULL, G_CALLBACK(compose_toggle_autowrap_cb), FALSE }, /* Toggle */ {"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/RemoveReferences", NULL, N_("Remo_ve references"), NULL, NULL, G_CALLBACK(compose_toggle_remove_refs_cb), FALSE }, /* Toggle */ }; @@ -821,12 +796,7 @@ Compose *compose_generic_new(PrefsAccount *account, co cm_return_val_if_fail(account != NULL, NULL); compose = compose_create(account, item, COMPOSE_NEW, FALSE); - compose_apply_folder_privacy_settings(compose, item); - if (privacy_system_can_sign(compose->privacy_system) == FALSE && - (account->default_encrypt || account->default_sign)) - COMPOSE_PRIVACY_WARNING(); - /* override from name if mailto asked for it */ if (mailto_from) { gtk_entry_set_text(GTK_ENTRY(compose->from_name), mailto_from); @@ -934,80 +904,6 @@ Compose *compose_generic_new(PrefsAccount *account, co return compose; } -static void compose_force_encryption(Compose *compose, PrefsAccount *account, - gboolean override_pref, const gchar *system) -{ - const gchar *privacy = NULL; - - cm_return_if_fail(compose != NULL); - cm_return_if_fail(account != NULL); - - if (privacy_system_can_encrypt(compose->privacy_system) == FALSE || - (override_pref == FALSE && account->default_encrypt_reply == FALSE)) - return; - - if (account->default_privacy_system && strlen(account->default_privacy_system)) - privacy = account->default_privacy_system; - else if (system) - privacy = system; - else { - GSList *privacy_avail = privacy_get_system_ids(); - if (privacy_avail && g_slist_length(privacy_avail)) { - privacy = (gchar *)(privacy_avail->data); - } - g_slist_free_full(privacy_avail, g_free); - } - if (privacy != NULL) { - if (system) { - g_free(compose->privacy_system); - compose->privacy_system = NULL; - g_free(compose->encdata); - compose->encdata = NULL; - } - if (compose->privacy_system == NULL) - compose->privacy_system = g_strdup(privacy); - else if (*(compose->privacy_system) == '\0') { - g_free(compose->privacy_system); - g_free(compose->encdata); - compose->encdata = NULL; - compose->privacy_system = g_strdup(privacy); - } - compose_update_privacy_system_menu_item(compose, FALSE); - compose_use_encryption(compose, TRUE); - } -} - -static void compose_force_signing(Compose *compose, PrefsAccount *account, const gchar *system) -{ - const gchar *privacy = NULL; - if (privacy_system_can_sign(compose->privacy_system) == FALSE) - return; - - if (account->default_privacy_system && strlen(account->default_privacy_system)) - privacy = account->default_privacy_system; - else if (system) - privacy = system; - else { - GSList *privacy_avail = privacy_get_system_ids(); - if (privacy_avail && g_slist_length(privacy_avail)) { - privacy = (gchar *)(privacy_avail->data); - } - } - - if (privacy != NULL) { - if (system) { - g_free(compose->privacy_system); - compose->privacy_system = NULL; - g_free(compose->encdata); - compose->encdata = NULL; - } - if (compose->privacy_system == NULL) - compose->privacy_system = g_strdup(privacy); - compose_update_privacy_system_menu_item(compose, FALSE); - compose_use_signing(compose, TRUE); - } -} - static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar *body) { MsgInfo *msginfo; @@ -1227,7 +1123,6 @@ static Compose *compose_generic_reply(MsgInfo *msginfo cm_return_val_if_fail(account != NULL, NULL); compose = compose_create(account, msginfo->folder, COMPOSE_REPLY, FALSE); - compose_apply_folder_privacy_settings(compose, msginfo->folder); compose->updating = TRUE; @@ -1263,22 +1158,8 @@ static Compose *compose_generic_reply(MsgInfo *msginfo undo_block(compose->undostruct); - if (MSG_IS_ENCRYPTED(compose->replyinfo->flags)) { - compose_force_encryption(compose, account, FALSE, s_system); - } - - privacy_msginfo_get_signed_state(compose->replyinfo, &s_system); - if (MSG_IS_SIGNED(compose->replyinfo->flags) && account->default_sign_reply) { - compose_force_signing(compose, account, s_system); - } g_free(s_system); - if (privacy_system_can_sign(compose->privacy_system) == FALSE && - ((account->default_encrypt || account->default_sign) || - (account->default_encrypt_reply && MSG_IS_ENCRYPTED(compose->replyinfo->flags)) || - (account->default_sign_reply && MSG_IS_SIGNED(compose->replyinfo->flags)))) - COMPOSE_PRIVACY_WARNING(); - SIGNAL_BLOCK(textbuf); compose_wrap_all(compose); SIGNAL_UNBLOCK(textbuf); @@ -1343,8 +1224,6 @@ Compose *compose_forward(PrefsAccount *account, MsgInf return NULL; } - compose_apply_folder_privacy_settings(compose, msginfo->folder); - compose->updating = TRUE; compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo); if (!compose->fwdinfo) @@ -1388,10 +1267,6 @@ Compose *compose_forward(PrefsAccount *account, MsgInf compose_wrap_all(compose); SIGNAL_UNBLOCK(textbuf); - if (privacy_system_can_sign(compose->privacy_system) == FALSE && - (account->default_encrypt || account->default_sign)) - COMPOSE_PRIVACY_WARNING(); - gtk_widget_grab_focus(compose->text); if (!no_extedit && prefs_common.auto_exteditor) @@ -1468,10 +1343,6 @@ static Compose *compose_forward_multiple(PrefsAccount } compose = compose_create(account, ((MsgInfo *)msginfo_list->data)->folder, COMPOSE_FORWARD, FALSE); - compose_apply_folder_privacy_settings(compose, ((MsgInfo *)msginfo_list->data)->folder); - if (privacy_system_can_sign(compose->privacy_system) == FALSE && - (account->default_encrypt || account->default_sign)) - COMPOSE_PRIVACY_WARNING(); compose->updating = TRUE; @@ -1617,9 +1488,6 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean bat GtkTextMark *mark; GtkTextIter iter; FILE *fp; - gboolean use_signing = FALSE; - gboolean use_encryption = FALSE; - gchar *privacy_system = NULL; MsgInfo *replyinfo = NULL, *fwdinfo = NULL; gboolean autowrap = prefs_common.autowrap; gboolean autoindent = prefs_common.auto_indent; @@ -1668,31 +1536,8 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean bat account = account_find_from_address(queueheader_buf); g_free(queueheader_buf); } + if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Claws-Sign:")) { - param = atoi(&queueheader_buf[strlen("X-Claws-Sign:")]); - use_signing = param; - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Sylpheed-Sign:")) { - param = atoi(&queueheader_buf[strlen("X-Sylpheed-Sign:")]); - use_signing = param; - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Claws-Encrypt:")) { - param = atoi(&queueheader_buf[strlen("X-Claws-Encrypt:")]); - use_encryption = param; - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Sylpheed-Encrypt:")) { - param = atoi(&queueheader_buf[strlen("X-Sylpheed-Encrypt:")]); - use_encryption = param; - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, "X-Claws-Auto-Wrapping:")) { param = atoi(&queueheader_buf[strlen("X-Claws-Auto-Wrapping:")]); autowrap = param; @@ -1704,17 +1549,8 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean bat autoindent = param; g_free(queueheader_buf); } + if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Claws-Privacy-System:")) { - privacy_system = g_strdup(&queueheader_buf[strlen("X-Claws-Privacy-System:")]); - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, - "X-Sylpheed-Privacy-System:")) { - privacy_system = g_strdup(&queueheader_buf[strlen("X-Sylpheed-Privacy-System:")]); - g_free(queueheader_buf); - } - if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, "RMID:")) { gchar **tokens = g_strsplit(&queueheader_buf[strlen("RMID:")], "\t", 0); if (tokens && tokens[0] && tokens[1] && tokens[2]) { @@ -1787,19 +1623,6 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean bat compose->updating = TRUE; - if (privacy_system != NULL) { - compose->privacy_system = privacy_system; - compose_use_signing(compose, use_signing); - compose_use_encryption(compose, use_encryption); - compose_update_privacy_system_menu_item(compose, FALSE); - } else { - compose_activate_privacy_system(compose, account, FALSE); - } - compose_apply_folder_privacy_settings(compose, msginfo->folder); - if (privacy_system_can_sign(compose->privacy_system) == FALSE && - (account->default_encrypt || account->default_sign)) - COMPOSE_PRIVACY_WARNING(); - compose->targetinfo = procmsg_msginfo_copy(msginfo); compose->targetinfo->tags = g_slist_copy(msginfo->tags); @@ -1841,15 +1664,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean bat g_signal_handlers_block_by_func(G_OBJECT(textbuf), G_CALLBACK(compose_changed_cb), compose); - - if (MSG_IS_ENCRYPTED(msginfo->flags)) { - fp = procmime_get_first_encrypted_text_content(msginfo); - if (fp) { - compose_force_encryption(compose, account, TRUE, NULL); - } - } else { - fp = procmime_get_first_text_content(msginfo); - } + fp = procmime_get_first_text_content(msginfo); if (fp == NULL) { g_warning("can't get text part"); } @@ -1991,10 +1806,6 @@ Compose *compose_redirect(PrefsAccount *account, MsgIn gtk_widget_set_sensitive(compose->toolbar->linewrap_current_btn, FALSE); if (compose->toolbar->linewrap_all_btn) gtk_widget_set_sensitive(compose->toolbar->linewrap_all_btn, FALSE); - if (compose->toolbar->privacy_sign_btn) - gtk_widget_set_sensitive(compose->toolbar->privacy_sign_btn, FALSE); - if (compose->toolbar->privacy_encrypt_btn) - gtk_widget_set_sensitive(compose->toolbar->privacy_encrypt_btn, FALSE); compose->modified = FALSE; compose_set_title(compose); @@ -2710,7 +2521,6 @@ static void compose_reedit_set_entry(Compose *compose, SET_ADDRESS(COMPOSE_REPLYTO, compose->replyto); SET_ADDRESS(COMPOSE_FOLLOWUPTO, compose->followup_to); - compose_update_privacy_system_menu_item(compose, FALSE); compose_show_first_last_header(compose, TRUE); } @@ -2988,18 +2798,6 @@ static gboolean compose_attach_append(Compose *compose return TRUE; } -void compose_use_signing(Compose *compose, gboolean use_signing) -{ - compose->use_signing = use_signing; - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", use_signing); -} - -void compose_use_encryption(Compose *compose, gboolean use_encryption) -{ - compose->use_encryption = use_encryption; - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", use_encryption); -} - #define NEXT_PART_NOT_CHILD(info) \ { \ node = info->node; \ @@ -3013,7 +2811,6 @@ static void compose_attach_parts(Compose *compose, Msg MimeInfo *mimeinfo; MimeInfo *child; MimeInfo *firsttext = NULL; - MimeInfo *encrypted = NULL; GNode *node; gchar *outfile; const gchar *partname = NULL; @@ -3035,22 +2832,12 @@ static void compose_attach_parts(Compose *compose, Msg if (child->type == MIMETYPE_TEXT) { firsttext = child; debug_print("First text part found\n"); - } else if (compose->mode == COMPOSE_REEDIT && - child->type == MIMETYPE_APPLICATION && - !g_ascii_strcasecmp(child->subtype, "pgp-encrypted")) { - encrypted = (MimeInfo *)child->node->parent->data; } } child = (MimeInfo *) mimeinfo->node->children->data; while (child != NULL) { gint err; - if (child == encrypted) { - /* skip this part of tree */ - NEXT_PART_NOT_CHILD(child); - continue; - } - if (child->type == MIMETYPE_MULTIPART) { /* get the actual content */ child = procmime_mimeinfo_next(child); @@ -3065,30 +2852,6 @@ static void compose_attach_parts(Compose *compose, Msg outfile = procmime_get_tmp_file_name(child); if ((err = procmime_get_part(outfile, child)) < 0) g_warning("can't get the part of multipart message. (%s)", g_strerror(-err)); - else { - gchar *content_type; - - content_type = procmime_get_content_type_str(child->type, child->subtype); - - /* if we meet a pgp signature, we don't attach it, but - * we force signing. */ - if ((strcmp(content_type, "application/pgp-signature") && - strcmp(content_type, "application/pkcs7-signature") && - strcmp(content_type, "application/x-pkcs7-signature")) - || compose->mode == COMPOSE_REDIRECT) { - partname = procmime_mimeinfo_get_parameter(child, "filename"); - if (partname == NULL) - partname = procmime_mimeinfo_get_parameter(child, "name"); - if (partname == NULL) - partname = ""; - compose_attach_append(compose, outfile, - partname, content_type, - procmime_mimeinfo_get_parameter(child, "charset")); - } else { - compose_force_signing(compose, compose->account, NULL); - } - g_free(content_type); - } g_free(outfile); NEXT_PART_NOT_CHILD(child); } @@ -3097,8 +2860,6 @@ static void compose_attach_parts(Compose *compose, Msg #undef NEXT_PART_NOT_CHILD - - typedef enum { WAIT_FOR_INDENT_CHAR, WAIT_FOR_INDENT_CHAR_OR_SPACE, @@ -4053,19 +3814,6 @@ static void compose_select_account(Compose *compose, P compose_set_title(compose); - compose_activate_privacy_system(compose, account, FALSE); - - if (account->default_sign && privacy_system_can_sign(compose->privacy_system) && - compose->mode != COMPOSE_REDIRECT) - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", TRUE); - else - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", FALSE); - if (account->default_encrypt && privacy_system_can_encrypt(compose->privacy_system) && - compose->mode != COMPOSE_REDIRECT) - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", TRUE); - else - cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", FALSE); - if (!init && compose->mode != COMPOSE_REDIRECT) { undo_block(compose->undostruct); undo_unblock(compose->undostruct); @@ -4292,27 +4040,10 @@ static void _display_queue_error(ComposeQueueResult va alertpanel_error(_("Could not queue message:\n\n%s."), g_strerror(errno)); break; - case COMPOSE_QUEUE_ERROR_SIGNING_FAILED: - alertpanel_error(_("Could not queue message for sending:\n\n" - "Signature failed: %s"), - privacy_peek_error() ? privacy_get_error() : _("Unknown error")); - break; - case COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED: - alertpanel_error(_("Could not queue message for sending:\n\n" - "Encryption failed: %s"), - privacy_peek_error() ? privacy_get_error() : _("Unknown error")); - break; case COMPOSE_QUEUE_ERROR_CHAR_CONVERSION: alertpanel_error(_("Could not queue message for sending:\n\n" "Charset conversion failed.")); break; - case COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY: - alertpanel_error(_("Could not queue message for sending:\n\n" - "Couldn't get recipient encryption key.")); - break; - case COMPOSE_QUEUE_SIGNING_CANCELLED: - debug_print("signing cancelled\n"); - break; default: /* unhandled error */ debug_print("oops, unhandled compose_queue() return value %d\n", @@ -4624,9 +4355,7 @@ static gint compose_redirect_write_to_file(Compose *co "SSH:", "R:", "MAID:", "NAID:", "RMID:", "FMID:", "SCF:", "RRCPT:", "NG:", - "X-Claws-Privacy", "X-Claws-Sign:", "X-Claws-Encrypt", "X-Claws-End-Special-Headers:", "X-Claws-Account-Id:", - "X-Sylpheed-Privacy", "X-Sylpheed-Sign:", "X-Sylpheed-Encrypt", "X-Sylpheed-End-Special-Headers:", "X-Sylpheed-Account-Id:", "X-Claws-Auto-Wrapping:", "X-Claws-Auto-Indent:", NULL @@ -4849,12 +4578,6 @@ static gint compose_write_to_file(Compose *compose, FI g_hash_table_insert(mimetext->typeparameters, g_strdup("charset"), g_strdup(out_codeset)); - /* protect trailing spaces when signing message */ - if (action == COMPOSE_WRITE_FOR_SEND && compose->use_signing && - privacy_system_can_sign(compose->privacy_system)) { - encoding = ENC_QUOTED_PRINTABLE; - } - debug_print("main text: %" G_GSIZE_FORMAT " bytes encoded as %s in %d\n", strlen(buf), out_codeset, encoding); @@ -4904,68 +4627,10 @@ static gint compose_write_to_file(Compose *compose, FI } g_free(spec); } - /* sign message if sending */ - if (action == COMPOSE_WRITE_FOR_SEND && compose->use_signing && - privacy_system_can_sign(compose->privacy_system)) - if (!privacy_sign(compose->privacy_system, mimemsg, - compose->account, from_addr)) { - g_free(from_name); - g_free(from_addr); - if (!privacy_peek_error()) - return COMPOSE_QUEUE_SIGNING_CANCELLED; - else - return COMPOSE_QUEUE_ERROR_SIGNING_FAILED; - } + g_free(from_name); g_free(from_addr); - if (compose->use_encryption) { - if (compose->encdata != NULL && - strcmp(compose->encdata, "_DONT_ENCRYPT_")) { - - /* First, write an unencrypted copy and save it to outbox, if - * user wants that. */ - if (compose->account->save_encrypted_as_clear_text) { - debug_print("saving sent message unencrypted...\n"); - FILE *tmpfp = get_tmpfile_in_dir(get_mime_tmp_dir(), &tmp_enc_file); - if (tmpfp) { - fclose(tmpfp); - - /* fp now points to a file with headers written, - * let's make a copy. */ - rewind(fp); - content = file_read_stream_to_str(fp); - - str_write_to_file(content, tmp_enc_file); - g_free(content); - - /* Now write the unencrypted body. */ - if ((tmpfp = g_fopen(tmp_enc_file, "a")) != NULL) { - procmime_write_mimeinfo(mimemsg, tmpfp); - fclose(tmpfp); - - outbox = folder_find_item_from_identifier(compose_get_save_to(compose)); - if (!outbox) - outbox = folder_get_default_outbox(); - - procmsg_save_to_outbox(outbox, tmp_enc_file); - unlink(tmp_enc_file); - } else { - g_warning("can't open file '%s'", tmp_enc_file); - } - } else { - g_warning("couldn't get tempfile"); - } - } - if (!privacy_encrypt(compose->privacy_system, mimemsg, compose->encdata)) { - debug_print("Couldn't encrypt mime structure: %s.\n", - privacy_get_error()); - if (tmp_enc_file) - g_free(tmp_enc_file); - return COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED; - } - } - } if (tmp_enc_file) g_free(tmp_enc_file); @@ -5070,31 +4735,6 @@ ComposeQueueResult compose_queue(Compose *compose, gin return compose_queue_sub (compose, msgnum, item, msgpath, FALSE, remove_reedit_target); } -static gboolean compose_warn_encryption(Compose *compose) -{ - const gchar *warning = privacy_get_encrypt_warning(compose->privacy_system); - AlertValue val = G_ALERTALTERNATE; - - if (warning == NULL) - return TRUE; - - val = alertpanel_full(_("Encryption warning"), warning, - NULL, _("_Cancel"), NULL, _("C_ontinue"), NULL, NULL, - ALERTFOCUS_SECOND, TRUE, NULL, ALERT_WARNING); - if (val & G_ALERTDISABLE) { - val &= ~G_ALERTDISABLE; - if (val == G_ALERTALTERNATE) - privacy_inhibit_encrypt_warning(compose->privacy_system, - TRUE); - } - - if (val == G_ALERTALTERNATE) { - return TRUE; - } else { - return FALSE; - } -} - static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item, gchar **msgpath, gboolean perform_checks, gboolean remove_reedit_target) @@ -5175,44 +4815,6 @@ static ComposeQueueResult compose_queue_sub(Compose *c if (mailac) err |= (fprintf(fp, "MAID:%d\n", mailac->account_id) < 0); - if (compose->privacy_system != NULL) { - err |= (fprintf(fp, "X-Claws-Privacy-System:%s\n", compose->privacy_system) < 0); - err |= (fprintf(fp, "X-Claws-Sign:%d\n", compose->use_signing) < 0); - if (compose->use_encryption) { - if (!compose_warn_encryption(compose)) { - fclose(fp); - unlink(tmp); - g_free(tmp); - return COMPOSE_QUEUE_ERROR_NO_MSG; - } - if (mailac && mailac->encrypt_to_self) { - GSList *tmp_list = g_slist_copy(compose->to_list); - tmp_list = g_slist_append(tmp_list, compose->account->address); - compose->encdata = privacy_get_encrypt_data(compose->privacy_system, tmp_list); - g_slist_free(tmp_list); - } else { - compose->encdata = privacy_get_encrypt_data(compose->privacy_system, compose->to_list); - } - if (compose->encdata != NULL) { - if (strcmp(compose->encdata, "_DONT_ENCRYPT_")) { - err |= (fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption) < 0); - err |= (fprintf(fp, "X-Claws-Encrypt-Data:%s\n", - compose->encdata) < 0); - } /* else we finally dont want to encrypt */ - } else { - err |= (fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption) < 0); - /* and if encdata was null, it means there's been a problem in - * key selection */ - if (err == TRUE) - g_warning("failed to write queue message"); - fclose(fp); - unlink(tmp); - g_free(tmp); - return COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY; - } - } - } - /* Save copy folder */ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) { gchar *savefolderid; @@ -5416,7 +5018,7 @@ static int compose_add_attachments(Compose *compose, M if (mimepart->type == MIMETYPE_MESSAGE || mimepart->type == MIMETYPE_MULTIPART) ainfo->encoding = ENC_BINARY; - else if (compose->use_signing || compose->fwdinfo != NULL) { + else if (compose->fwdinfo != NULL) { if (ainfo->encoding == ENC_7BIT) ainfo->encoding = ENC_QUOTED_PRINTABLE; else if (ainfo->encoding == ENC_8BIT) @@ -6575,12 +6177,6 @@ static Compose *compose_create(PrefsAccount *account, MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "Sender", "Options/ReplyMode/Sender", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "List", "Options/ReplyMode/List", GTK_UI_MANAGER_MENUITEM) - MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator1", "Options/---", GTK_UI_MANAGER_SEPARATOR) - MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "PrivacySystem", "Options/PrivacySystem", GTK_UI_MANAGER_MENU) - MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/PrivacySystem", "PlaceHolder", "Options/PrivacySystem/PlaceHolder", GTK_UI_MANAGER_MENUITEM) - 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", "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) @@ -6795,9 +6391,6 @@ static Compose *compose_create(PrefsAccount *account, compose->autowrap = prefs_common.autowrap; compose->autoindent = prefs_common.auto_indent; - compose->use_signing = FALSE; - compose->use_encryption = FALSE; - compose->privacy_system = NULL; compose->encdata = NULL; compose->modified = FALSE; @@ -6844,10 +6437,6 @@ static Compose *compose_create(PrefsAccount *account, /* Actions menu */ compose_update_actions_menu(compose); - /* Privacy Systems menu */ - compose_update_privacy_systems_menu(compose); - compose_activate_privacy_system(compose, account, TRUE); - toolbar_set_style(compose->toolbar->toolbar, compose->handlebox, prefs_common.toolbar_style); if (batch) { gtk_widget_realize(window); @@ -6997,117 +6586,6 @@ static void compose_reply_change_mode_cb(GtkAction *ac compose_reply_change_mode(compose, value); } -static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data) -{ - Compose *compose = (Compose *) data; - gchar *systemid; - gboolean can_sign = FALSE, can_encrypt = FALSE; - - cm_return_if_fail(GTK_IS_CHECK_MENU_ITEM(widget)); - - if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) - return; - - systemid = g_object_get_data(G_OBJECT(widget), "privacy_system"); - g_free(compose->privacy_system); - compose->privacy_system = NULL; - g_free(compose->encdata); - compose->encdata = NULL; - if (systemid != NULL) { - compose->privacy_system = g_strdup(systemid); - - can_sign = privacy_system_can_sign(systemid); - can_encrypt = privacy_system_can_encrypt(systemid); - } - - debug_print("activated privacy system: %s\n", systemid != NULL ? systemid : "None"); - - cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Sign", can_sign); - cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Encrypt", can_encrypt); - if (compose->toolbar->privacy_sign_btn != NULL) { - gtk_widget_set_sensitive( - GTK_WIDGET(compose->toolbar->privacy_sign_btn), - can_sign); - gtk_toggle_tool_button_set_active( - GTK_TOGGLE_TOOL_BUTTON(compose->toolbar->privacy_sign_btn), - can_sign ? compose->use_signing : FALSE); - } - if (compose->toolbar->privacy_encrypt_btn != NULL) { - gtk_widget_set_sensitive( - GTK_WIDGET(compose->toolbar->privacy_encrypt_btn), - can_encrypt); - gtk_toggle_tool_button_set_active( - GTK_TOGGLE_TOOL_BUTTON(compose->toolbar->privacy_encrypt_btn), - can_encrypt ? compose->use_encryption : FALSE); - } -} - -static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn) -{ - static gchar *branch_path = "/Menu/Options/PrivacySystem"; - GtkWidget *menuitem = NULL; - GList *children, *amenu; - gboolean can_sign = FALSE, can_encrypt = FALSE; - gboolean found = FALSE; - - if (compose->privacy_system != NULL) { - gchar *systemid; - menuitem = gtk_menu_item_get_submenu(GTK_MENU_ITEM( - gtk_ui_manager_get_widget(compose->ui_manager, branch_path))); - cm_return_if_fail(menuitem != NULL); - - children = gtk_container_get_children(GTK_CONTAINER(GTK_MENU_SHELL(menuitem))); - amenu = children; - menuitem = NULL; - while (amenu != NULL) { - systemid = g_object_get_data(G_OBJECT(amenu->data), "privacy_system"); - if (systemid != NULL) { - if (strcmp(systemid, compose->privacy_system) == 0 && - GTK_IS_CHECK_MENU_ITEM(amenu->data)) { - menuitem = GTK_WIDGET(amenu->data); - - can_sign = privacy_system_can_sign(systemid); - can_encrypt = privacy_system_can_encrypt(systemid); - found = TRUE; - break; - } - } else if (strlen(compose->privacy_system) == 0 && - GTK_IS_CHECK_MENU_ITEM(amenu->data)) { - menuitem = GTK_WIDGET(amenu->data); - - can_sign = FALSE; - can_encrypt = FALSE; - found = TRUE; - break; - } - - amenu = amenu->next; - } - g_list_free(children); - if (menuitem != NULL) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); - - if (warn && !found && strlen(compose->privacy_system)) { - alertpanel_warning(_("The privacy system '%s' cannot be loaded. You " - "will not be able to sign or encrypt this message."), - compose->privacy_system); - } - } - - cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Sign", can_sign); - cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Encrypt", can_encrypt); - if (compose->toolbar->privacy_sign_btn != NULL) { - gtk_widget_set_sensitive( - GTK_WIDGET(compose->toolbar->privacy_sign_btn), - can_sign); - } - if (compose->toolbar->privacy_encrypt_btn != NULL) { - gtk_widget_set_sensitive( - GTK_WIDGET(compose->toolbar->privacy_encrypt_btn), - can_encrypt); - } -} - static void compose_set_out_encoding(Compose *compose) { CharSet out_encoding; @@ -7158,47 +6636,6 @@ void compose_update_actions_menu(Compose *compose) action_update_compose_menu(compose->ui_manager, "/Menu/Tools/Actions", compose); } -static void compose_update_privacy_systems_menu(Compose *compose) -{ - static gchar *branch_path = "/Menu/Options/PrivacySystem"; - GSList *systems, *cur; - GtkWidget *widget; - GtkWidget *system_none; - GSList *group; - GtkWidget *privacy_menuitem = gtk_ui_manager_get_widget(compose->ui_manager, branch_path); - GtkWidget *privacy_menu = gtk_menu_new(); - - system_none = gtk_radio_menu_item_new_with_mnemonic(NULL, _("_None")); - g_object_set_data_full(G_OBJECT(system_none), "privacy_system", NULL, NULL); - - g_signal_connect(G_OBJECT(system_none), "activate", - G_CALLBACK(compose_set_privacy_system_cb), compose); - - gtk_menu_shell_append(GTK_MENU_SHELL(privacy_menu), system_none); - gtk_widget_show(system_none); - - systems = privacy_get_system_ids(); - for (cur = systems; cur != NULL; cur = g_slist_next(cur)) { - gchar *systemid = cur->data; - - group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(system_none)); - widget = gtk_radio_menu_item_new_with_label(group, - privacy_system_get_name(systemid)); - g_object_set_data_full(G_OBJECT(widget), "privacy_system", - g_strdup(systemid), g_free); - g_signal_connect(G_OBJECT(widget), "activate", - G_CALLBACK(compose_set_privacy_system_cb), compose); - - gtk_menu_shell_append(GTK_MENU_SHELL(privacy_menu), widget); - gtk_widget_show(widget); - g_free(systemid); - } - g_slist_free(systems); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(privacy_menuitem), privacy_menu); - gtk_widget_show_all(privacy_menu); - gtk_widget_show_all(privacy_menuitem); -} - void compose_reflect_prefs_pixmap_theme(void) { GList *cur; @@ -7262,12 +6699,8 @@ static void compose_destroy(Compose *compose) undo_destroy(compose->undostruct); g_free(compose->sig_str); - g_free(compose->exteditor_file); - g_free(compose->orig_charset); - - g_free(compose->privacy_system); g_free(compose->encdata); if (addressbook_get_target_compose() == compose) @@ -7689,13 +7122,6 @@ static gboolean attach_property_key_pressed(GtkWidget return FALSE; } -static gboolean compose_can_autosave(Compose *compose) -{ - if (compose->privacy_system && compose->use_encryption) - return prefs_common.autosave && prefs_common.autosave_encrypted; - return prefs_common.autosave; -} - /** * compose_exec_ext_editor: * @@ -7842,7 +7268,7 @@ static void compose_ext_editor_closed_cb(GPid pid, gin compose_insert_file(compose, compose->exteditor_file); /* Check if we should save the draft or not */ - if (compose_can_autosave(compose)) + if (prefs_common.autosave) compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE); if (remove(compose->exteditor_file) < 0) @@ -8383,11 +7809,6 @@ gboolean compose_draft (gpointer data, guint action) err |= (fprintf(fp, "SCF:%s\n", savefolderid) < 0); g_free(savefolderid); } - 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); - err |= (fprintf(fp, "X-Claws-Privacy-System:%s\n", compose->privacy_system) < 0); - } /* Message-ID of message replying to */ if ((compose->replyinfo != NULL) && (compose->replyinfo->msgid != NULL)) { @@ -8738,7 +8159,7 @@ static void compose_close_cb(GtkAction *action, gpoint g_mutex_unlock(&compose->mutex); switch (val) { case G_ALERTDEFAULT: - if (compose_can_autosave(compose) && !reedit) + if (prefs_common.autosave && !reedit) compose_remove_draft(compose); break; case G_ALERTALTERNATE: @@ -9471,49 +8892,6 @@ static void compose_toggle_autoindent_cb(GtkToggleActi compose->autoindent = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); } -static void compose_toggle_sign_cb(GtkToggleAction *action, gpointer data) -{ - Compose *compose = (Compose *)data; - - compose->use_signing = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); - if (compose->toolbar->privacy_sign_btn != NULL) - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(compose->toolbar->privacy_sign_btn), compose->use_signing); -} - -static void compose_toggle_encrypt_cb(GtkToggleAction *action, gpointer data) -{ - Compose *compose = (Compose *)data; - - compose->use_encryption = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); - if (compose->toolbar->privacy_encrypt_btn != NULL) - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(compose->toolbar->privacy_encrypt_btn), compose->use_encryption); -} - -static void compose_activate_privacy_system(Compose *compose, PrefsAccount *account, gboolean warn) -{ - g_free(compose->privacy_system); - g_free(compose->encdata); - - compose->privacy_system = g_strdup(account->default_privacy_system); - compose_update_privacy_system_menu_item(compose, warn); -} - -static void compose_apply_folder_privacy_settings(Compose *compose, FolderItem *folder_item) -{ - if (folder_item != NULL) { - if (folder_item->prefs->always_sign != SIGN_OR_ENCRYPT_DEFAULT && - privacy_system_can_sign(compose->privacy_system)) { - compose_use_signing(compose, - (folder_item->prefs->always_sign == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE); - } - if (folder_item->prefs->always_encrypt != SIGN_OR_ENCRYPT_DEFAULT && - privacy_system_can_encrypt(compose->privacy_system)) { - compose_use_encryption(compose, - (folder_item->prefs->always_encrypt == SIGN_OR_ENCRYPT_ALWAYS) ? TRUE : FALSE); - } - } -} - static void compose_attach_drag_received_cb (GtkWidget *widget, GdkDragContext *context, gint x, @@ -9862,7 +9240,7 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTe compose); g_signal_stop_emission_by_name(G_OBJECT(buffer), "insert-text"); - if (compose_can_autosave(compose) && + if (prefs_common.autosave && gtk_text_buffer_get_char_count(buffer) % prefs_common.autosave_length == 0 && compose->draft_timeout_tag != COMPOSE_DRAFT_TIMEOUT_FORBIDDEN /* disabled while loading */) compose->draft_timeout_tag = g_timeout_add @@ -9976,8 +9354,6 @@ static void compose_reply_from_messageview_real(Messag gchar *body = NULL; GSList *new_msglist = NULL; MsgInfo *tmp_msginfo = NULL; - gboolean originally_enc = FALSE; - gboolean originally_sig = FALSE; Compose *compose = NULL; gchar *s_system = NULL; @@ -9994,10 +9370,6 @@ static void compose_reply_from_messageview_real(Messag if (tmp_msginfo != NULL) { new_msglist = g_slist_append(NULL, tmp_msginfo); - originally_enc = MSG_IS_ENCRYPTED(orig_msginfo->flags); - privacy_msginfo_get_signed_state(orig_msginfo, &s_system); - originally_sig = MSG_IS_SIGNED(orig_msginfo->flags); - tmp_msginfo->folder = orig_msginfo->folder; tmp_msginfo->msgnum = orig_msginfo->msgnum; if (orig_msginfo->tags) { @@ -10018,13 +9390,6 @@ static void compose_reply_from_messageview_real(Messag } else compose = compose_reply_mode((ComposeMode)action, msginfo_list, body); - if (compose && originally_enc) { - compose_force_encryption(compose, compose->account, FALSE, s_system); - } - - if (compose && originally_sig && compose->account->default_sign_reply) { - compose_force_signing(compose, compose->account, s_system); - } g_free(s_system); g_free(body); hooks_invoke(COMPOSE_CREATED_HOOKLIST, compose); blob - 1848373d50d8955767d43358a4eb1199d971e91e blob + 962199f084b6f033ee36deec9e9749216396c0c4 --- src/compose.h +++ src/compose.h @@ -186,9 +186,6 @@ struct _Compose CharSet out_encoding; /* privacy settings */ - gboolean use_signing; - gboolean use_encryption; - gchar *privacy_system; gchar *encdata; gboolean modified; @@ -333,7 +330,4 @@ void compose_clear_exit_drafts (void); void compose_reopen_exit_drafts (void); void compose_attach_from_list (Compose *compose, GList *file_list, gboolean free_data); -void compose_use_signing(Compose *compose, gboolean use_signing); -void compose_use_encryption(Compose *compose, gboolean use_encryption); - #endif /* __COMPOSE_H__ */ blob - aed37b1e72184630098e5bf555a469fce9dfa459 blob + 2cfbe1ce22e914480861b08fc15eea933f6ce28a --- src/folder.c +++ src/folder.c @@ -48,7 +48,6 @@ #include "compose.h" #include "main.h" #include "msgcache.h" -#include "privacy.h" #include "prefs_common.h" #include "file-utils.h" @@ -2691,16 +2690,7 @@ static void msginfo_set_mime_flags(GNode *node, gpoint if (mimeinfo->type == MIMETYPE_MESSAGE) return; - if (privacy_mimeinfo_is_signed(mimeinfo)) { - procmsg_msginfo_set_flags(msginfo, 0, MSG_SIGNED); - } - - if (privacy_mimeinfo_is_encrypted(mimeinfo)) { - procmsg_msginfo_set_flags(msginfo, 0, MSG_ENCRYPTED); - } else { - /* searching inside encrypted parts doesn't really make sense */ - g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_mime_flags, msginfo); - } + g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_mime_flags, msginfo); } gchar *folder_item_fetch_msg(FolderItem *item, gint num) blob - d5e806ba4ae15bd5c12308db40a651ca856b5fbd blob + ef6b875d12c1375c2c7a1ae9193783b4c9a1cf63 --- src/folder_item_prefs.c +++ src/folder_item_prefs.c @@ -65,10 +65,6 @@ static PrefParam param[] = { NULL, NULL, NULL}, {"default_account", NULL, &tmp_prefs.default_account, P_INT, NULL, NULL, NULL}, - {"always_sign", "0", &tmp_prefs.always_sign, P_ENUM, - NULL, NULL, NULL}, - {"always_encrypt", "0", &tmp_prefs.always_encrypt, P_ENUM, - NULL, NULL, NULL}, {"save_copy_to_folder", NULL, &tmp_prefs.save_copy_to_folder, P_BOOL, NULL, NULL, NULL}, {"enable_processing", "FALSE", &tmp_prefs.enable_processing, P_BOOL, @@ -164,8 +160,6 @@ static FolderItemPrefs *folder_item_prefs_clear(Folder prefs->folder_chmod = 0; prefs->enable_default_account = FALSE; prefs->default_account = 0; - prefs->always_sign = SIGN_OR_ENCRYPT_DEFAULT; - prefs->always_encrypt = SIGN_OR_ENCRYPT_DEFAULT; prefs->save_copy_to_folder = FALSE; prefs->enable_processing = FALSE; @@ -239,8 +233,6 @@ void folder_item_prefs_copy_prefs(FolderItem * src, Fo tmp_prefs.folder_chmod = src->prefs->folder_chmod; tmp_prefs.enable_default_account = src->prefs->enable_default_account; tmp_prefs.default_account = src->prefs->default_account; - tmp_prefs.always_sign = src->prefs->always_sign; - tmp_prefs.always_encrypt = src->prefs->always_encrypt; tmp_prefs.save_copy_to_folder = src->prefs->save_copy_to_folder; *dest->prefs = tmp_prefs; blob - de3bd78cc6e5a49e046513d94e76226b8d84b634 blob + e93b916a962baafb05cec67a43c54fcb471a1afb --- src/imap.c +++ src/imap.c @@ -18,6 +18,7 @@ #include "defs.h" +#include #include #include #include blob - 482e3ad47703b8af52341383fb0eb6a6299be0b8 blob + ee669ce3c65fbede914f96ccdc99323646ee7eda --- src/main.c +++ src/main.c @@ -1176,6 +1176,7 @@ static gint prohibit_duplicate_launch(int *argc, char char sockpath[PATH_MAX]; claws_socket_path(sockpath, sizeof(sockpath)); + fprintf(stderr, "using %s to prohibit duplicate process\n", sockpath); if (mkdir(dirname(sockpath), 0755) < 0) return -1; sock = fd_connect_unix(sockpath); blob - 800d05a64726997c5ebf54ab1b18b8be54a36c0d blob + 932b49942c546097d05379acf122f62b1237b1bf --- src/mainwindow.c +++ src/mainwindow.c @@ -377,7 +377,6 @@ static void save_part_as_cb(GtkAction *action, gpointe static void view_part_as_text_cb(GtkAction *action, gpointer data); static void open_part_cb(GtkAction *action, gpointer data); static void open_part_with_cb(GtkAction *action, gpointer data); -static void check_signature_cb(GtkAction *action, gpointer data); static void goto_next_part_cb(GtkAction *action, gpointer data); static void goto_prev_part_cb(GtkAction *action, gpointer data); #define DO_ACTION(name, act) { if (!strcmp(a_name, name)) action = act; } @@ -603,8 +602,6 @@ static GtkActionEntry mainwin_entries[] = {"Message/Reedit", NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) }, /*{"Message/---", NULL, "---", NULL, NULL, NULL },*/ - {"Message/CheckSignature", NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) }, - {"Tools/AddressBook", NULL, N_("_Address book"), "A", NULL, G_CALLBACK(addressbook_open_cb) }, {"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) }, @@ -1207,7 +1204,6 @@ MainWindow *main_window_create() MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR) - MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM) /* Tools menu */ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM) @@ -2354,7 +2350,6 @@ void main_window_set_menu_sensitive(MainWindow *mainwi SET_SENSITIVE("Menu/Message/Marks/Lock", M_TARGET_EXIST); SET_SENSITIVE("Menu/Message/Marks/Unlock", M_TARGET_EXIST); SET_SENSITIVE("Menu/Message/Reedit", M_HAVE_ACCOUNT, M_ALLOW_REEDIT); - SET_SENSITIVE("Menu/Message/CheckSignature", M_SINGLE_TARGET_EXIST); SET_SENSITIVE("Menu/Tools/AddSenderToAB", M_SINGLE_TARGET_EXIST); SET_SENSITIVE("Menu/Tools/Execute", M_DELAY_EXEC); @@ -2472,8 +2467,6 @@ void main_window_set_menu_sensitive(MainWindow *mainwi cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextPart", mimepart_selected); cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevPart", mimepart_selected); cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part", mimepart_selected); - cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature", - mimepart_selected && mainwin->messageview->mimeview->signed_part); sensitive = TRUE; if (mimepart_selected) { @@ -2837,8 +2830,6 @@ static void main_window_set_widgets(MainWindow *mainwi * and mimeview icon list/ctree lose track of their visibility states */ if (!noticeview_is_visible(mainwin->messageview->noticeview)) gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview)); - if (!noticeview_is_visible(mainwin->messageview->mimeview->siginfoview)) - gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->mimeview->siginfoview)); if (mainwin->messageview->mimeview->ctree_mode) gtk_widget_hide(mainwin->messageview->mimeview->icon_mainbox); else @@ -4169,15 +4160,6 @@ static void open_part_with_cb(GtkAction *action, gpoin mimeview_open_with(mainwin->messageview->mimeview); } -static void check_signature_cb(GtkAction *action, gpointer data) -{ - MainWindow *mainwin = (MainWindow *)data; - - if (mainwin->messageview - && mainwin->messageview->mimeview) - mimeview_check_signature(mainwin->messageview->mimeview); -} - static void goto_next_part_cb(GtkAction *action, gpointer data) { MainWindow *mainwin = (MainWindow *)data; blob - e07bfdd6458ceb82827970c0240c65921ae75d3a blob + d8f345024fd7f2814423fcd6e417be849fda3c47 --- src/messageview.c +++ src/messageview.c @@ -54,7 +54,6 @@ #include "hooks.h" #include "inc.h" #include "log.h" -#include "privacy.h" #include "combobox.h" #include "quoted-printable.h" #include "version.h" @@ -146,7 +145,6 @@ static void save_part_as_cb(GtkAction *action, gpointe static void view_part_as_text_cb(GtkAction *action, gpointer data); static void open_part_cb(GtkAction *action, gpointer data); static void open_part_with_cb(GtkAction *action, gpointer data); -static void check_signature_cb(GtkAction *action, gpointer data); static void goto_next_part_cb(GtkAction *action, gpointer data); static void goto_prev_part_cb(GtkAction *action, gpointer data); @@ -251,7 +249,6 @@ static GtkActionEntry msgview_entries[] = {"Message/Forward", NULL, N_("_Forward"), "F", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_INLINE */ {"Message/ForwardAtt", NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */ {"Message/Redirect", NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REDIRECT */ - {"Message/CheckSignature", NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) }, /* Tools menu */ {"Tools/AddressBook", NULL, N_("_Address book"), "A", NULL, G_CALLBACK(addressbook_open_cb) }, @@ -538,7 +535,6 @@ static void messageview_add_toolbar(MessageView *msgvi MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM) MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM) - MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM) /* Tools menu */ MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM) @@ -646,29 +642,6 @@ void messageview_init(MessageView *messageview) noticeview_hide(messageview->noticeview); } -static gboolean find_encrypted_func(GNode *node, gpointer data) -{ - MimeInfo *mimeinfo = (MimeInfo *) node->data; - MimeInfo **encinfo = (MimeInfo **) data; - - if (privacy_mimeinfo_is_encrypted(mimeinfo)) { - *encinfo = mimeinfo; - return TRUE; - } - - return FALSE; -} - -static MimeInfo *find_encrypted_part(MimeInfo *rootinfo) -{ - MimeInfo *encinfo = NULL; - - g_node_traverse(rootinfo->node, G_IN_ORDER, G_TRAVERSE_ALL, -1, - find_encrypted_func, &encinfo); - - return encinfo; -} - static gboolean find_broken_func(GNode *node, gpointer data) { MimeInfo *mimeinfo = (MimeInfo *) node->data; @@ -855,7 +828,7 @@ gint messageview_show(MessageView *messageview, MsgInf { gchar *text = NULL; gchar *file; - MimeInfo *mimeinfo, *encinfo, *root; + MimeInfo *mimeinfo, *root; gchar *subject = NULL; cm_return_val_if_fail(msginfo != NULL, -1); @@ -906,22 +879,6 @@ gint messageview_show(MessageView *messageview, MsgInf return -1; } - while ((encinfo = find_encrypted_part(mimeinfo)) != NULL) { - debug_print("decrypting message part\n"); - if (privacy_mimeinfo_decrypt(encinfo) < 0) { - text = g_strdup_printf(_("Couldn't decrypt: %s"), - privacy_get_error()); - noticeview_show(messageview->noticeview); - noticeview_set_icon(messageview->noticeview, - STOCK_PIXMAP_NOTICE_WARN); - noticeview_set_text(messageview->noticeview, text); - gtk_widget_hide(messageview->noticeview->button); - gtk_widget_hide(messageview->noticeview->button2); - g_free(text); - break; - } - } - if (messageview->msginfo != msginfo) { procmsg_msginfo_free(&(messageview->msginfo)); messageview->msginfo = NULL; @@ -2051,8 +2008,6 @@ void messageview_set_menu_sensitive(MessageView *messa cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3)); cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/PrevHistory", messageview_nav_has_prev(messageview)); cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/NextHistory", messageview_nav_has_next(messageview)); - - cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/Message/CheckSignature", messageview->mimeview->signed_part); } static void save_part_as_cb(GtkAction *action, gpointer data) @@ -2087,14 +2042,6 @@ static void open_part_with_cb(GtkAction *action, gpoin mimeview_open_with(messageview->mimeview); } -static void check_signature_cb(GtkAction *action, gpointer data) -{ - MessageView *messageview = (MessageView *)data; - - if (messageview->mimeview) - mimeview_check_signature(messageview->mimeview); -} - static void goto_next_part_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; blob - 60a5665333eb6607665c5b5665999d96accfa349 blob + c0d7cb489c996eda2ca8dc3c92cf2c18b424ff0a --- src/mimeview.c +++ src/mimeview.c @@ -43,7 +43,6 @@ #include "gtk/gtkvscrollbutton.h" #include "gtk/logwindow.h" #include "manage_window.h" -#include "privacy.h" #include "file-utils.h" typedef enum @@ -244,7 +243,6 @@ MimeView *mimeview_create(MainWindow *mainwin) GtkWidget *arrow; GtkWidget *scrollbutton; GtkWidget *hbox; - NoticeView *siginfoview; GtkTreeStore *model; GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -408,12 +406,6 @@ MimeView *mimeview_create(MainWindow *mainwin) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show(vbox); - siginfoview = noticeview_create(mainwin); - gtk_widget_set_name(GTK_WIDGET(siginfoview->vgrid), "siginfoview"); - noticeview_hide(siginfoview); - noticeview_set_icon_clickable(siginfoview, TRUE); - gtk_box_pack_start(GTK_BOX(vbox), mime_notebook, TRUE, TRUE, 0); - gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET_PTR(siginfoview), FALSE, FALSE, 0); paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL); gtk_widget_show(paned); @@ -441,7 +433,6 @@ MimeView *mimeview_create(MainWindow *mainwin) mimeview->icon_count = 0; mimeview->mainwin = mainwin; mimeview->mime_toggle = mime_toggle; - mimeview->siginfoview = siginfoview; mimeview->scrollbutton = scrollbutton; mimeview->arrow = arrow; mimeview->target_list = gtk_target_list_new(mimeview_mime_types, 1); @@ -459,17 +450,6 @@ void mimeview_init(MimeView *mimeview) GTK_WIDGET_PTR(mimeview->textview)); } -static gboolean any_part_is_signed(MimeInfo *mimeinfo) -{ - while (mimeinfo) { - if (privacy_mimeinfo_is_signed(mimeinfo)) - return TRUE; - mimeinfo = procmime_mimeinfo_next(mimeinfo); - } - - return FALSE; -} - void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo, const gchar *file) { @@ -487,11 +467,6 @@ void mimeview_show_message(MimeView *mimeview, MimeInf g_signal_handlers_block_by_func(G_OBJECT(ctree), mimeview_selected, mimeview); - /* check if the mail's signed - it can change the mail structure */ - - if (any_part_is_signed(mimeinfo)) - debug_print("signed mail\n"); - mimeview_set_multipart_tree(mimeview, mimeinfo, NULL); gtk_tree_view_expand_all(ctree); icon_list_clear(mimeview); @@ -520,14 +495,6 @@ void mimeview_destroy(MimeView *mimeview) g_slist_free(mimeview->viewers); gtk_target_list_unref(mimeview->target_list); - if (mimeview->sig_check_timeout_tag != 0) - g_source_remove(mimeview->sig_check_timeout_tag); - if (mimeview->sig_check_cancellable != NULL) { - /* Set last_sig_check_task to NULL to discard results in async_cb */ - mimeview->siginfo->last_sig_check_task = NULL; - g_cancellable_cancel(mimeview->sig_check_cancellable); - g_object_unref(mimeview->sig_check_cancellable); - } mimeview_free_mimeinfo(mimeview); gtk_tree_path_free(mimeview->opened); g_free(mimeview->file); @@ -917,25 +884,9 @@ void mimeview_clear(MimeView *mimeview) if (!mimeview) return; - if (g_slist_find(mimeviews, mimeview) == NULL) return; - if (mimeview->sig_check_timeout_tag != 0) { - g_source_remove(mimeview->sig_check_timeout_tag); - mimeview->sig_check_timeout_tag = 0; - } - - if (mimeview->sig_check_cancellable != NULL) { - /* Set last_sig_check_task to NULL to discard results in async_cb */ - mimeview->siginfo->last_sig_check_task = NULL; - g_cancellable_cancel(mimeview->sig_check_cancellable); - g_object_unref(mimeview->sig_check_cancellable); - mimeview->sig_check_cancellable = NULL; - } - - noticeview_hide(mimeview->siginfoview); - model = gtk_tree_view_get_model(GTK_TREE_VIEW(mimeview->ctree)); gtk_tree_store_clear(GTK_TREE_STORE(model)); @@ -957,251 +908,6 @@ void mimeview_clear(MimeView *mimeview) mimeview_change_view_type(mimeview, MIMEVIEW_TEXT); } -gchar * get_message_check_signature_shortcut(MessageView *messageview) { - GtkUIManager *ui_manager; - - if (messageview->window != NULL) - ui_manager = messageview->ui_manager; - else - ui_manager = messageview->mainwin->ui_manager; - - return cm_menu_item_get_shortcut(ui_manager, "Menu/Message/CheckSignature"); -} - -static void check_signature_cb(GtkWidget *widget, gpointer user_data); -static void display_full_info_cb(GtkWidget *widget, gpointer user_data); - -static void update_signature_noticeview(MimeView *mimeview, gboolean special, SignatureStatus code) -{ - gchar *text = NULL, *button_text = NULL; - void *func = NULL; - StockPixmap icon = STOCK_PIXMAP_PRIVACY_SIGNED; - SignatureStatus mycode = SIGNATURE_UNCHECKED; - - if (mimeview == NULL || mimeview->siginfo == NULL) - g_error("bad call to update noticeview"); - - mycode = privacy_mimeinfo_get_sig_status(mimeview->siginfo); - if (special) - mycode = code; - - switch (mycode) { - case SIGNATURE_UNCHECKED: - button_text = _("Check signature"); - func = check_signature_cb; - icon = STOCK_PIXMAP_PRIVACY_SIGNED; - break; - case SIGNATURE_OK: - button_text = _("View full information"); - func = display_full_info_cb; - icon = STOCK_PIXMAP_PRIVACY_PASSED; - break; - case SIGNATURE_WARN: - button_text = _("View full information"); - func = display_full_info_cb; - icon = STOCK_PIXMAP_PRIVACY_WARN; - break; - case SIGNATURE_KEY_EXPIRED: - button_text = _("View full information"); - func = display_full_info_cb; - icon = STOCK_PIXMAP_PRIVACY_EXPIRED; - break; - case SIGNATURE_INVALID: - button_text = _("View full information"); - func = display_full_info_cb; - icon = STOCK_PIXMAP_PRIVACY_FAILED; - break; - case SIGNATURE_CHECK_ERROR: - case SIGNATURE_CHECK_FAILED: - case SIGNATURE_CHECK_TIMEOUT: - button_text = _("Check again"); - func = check_signature_cb; - icon = STOCK_PIXMAP_PRIVACY_UNKNOWN; - break; - default: - break; - } - - if (mycode == SIGNATURE_UNCHECKED) { - gchar *tmp = privacy_mimeinfo_get_sig_info(mimeview->siginfo, FALSE); - gchar *shortcut = get_message_check_signature_shortcut(mimeview->messageview); - - if (*shortcut == '\0') - text = g_strdup_printf(_("%s Click the icon to check it."), tmp); - else - text = g_strdup_printf(_("%s Click the icon or hit '%s' to check it."), tmp, shortcut); - - g_free(shortcut); - } else if (mycode == SIGNATURE_CHECK_TIMEOUT) { - gchar *shortcut = get_message_check_signature_shortcut(mimeview->messageview); - - if (*shortcut == '\0') - text = g_strdup(_("Timeout checking the signature. Click the icon to try again.")); - else - text = g_strdup_printf(_("Timeout checking the signature. Click the icon or hit '%s' to try again."), shortcut); - - g_free(shortcut); - } else if (mycode == SIGNATURE_CHECK_ERROR) { - gchar *shortcut = get_message_check_signature_shortcut(mimeview->messageview); - - if (*shortcut == '\0') - text = g_strdup(_("Error checking the signature. Click the icon to try again.")); - else - text = g_strdup_printf(_("Error checking the signature. Click the icon or hit '%s' to try again."), shortcut); - - g_free(shortcut); - } else { - text = g_strdup(privacy_mimeinfo_get_sig_info(mimeview->siginfo, FALSE)); - } - - noticeview_set_text(mimeview->siginfoview, text); - gtk_label_set_selectable(GTK_LABEL(mimeview->siginfoview->text), TRUE); - g_free(text); - - noticeview_set_button_text(mimeview->siginfoview, NULL); - noticeview_set_button_press_callback( - mimeview->siginfoview, - G_CALLBACK(func), - (gpointer) mimeview); - noticeview_set_icon(mimeview->siginfoview, icon); - noticeview_set_tooltip(mimeview->siginfoview, button_text); - - icon_list_clear(mimeview); - icon_list_create(mimeview, mimeview->mimeinfo); -} - -static void check_signature_async_cb(GObject *source_object, - GAsyncResult *async_result, - gpointer user_data) -{ - GTask *task = G_TASK(async_result); - GCancellable *cancellable; - MimeView *mimeview = (MimeView *)user_data; - gboolean cancelled; - SigCheckTaskResult *result; - GError *error = NULL; - - if (mimeview->siginfo == NULL) { - debug_print("discarding stale sig check task result task:%p\n", task); - return; - } else if (task != mimeview->siginfo->last_sig_check_task) { - debug_print("discarding stale sig check task result last_task:%p task:%p\n", - mimeview->siginfo->last_sig_check_task, task); - return; - } else { - debug_print("using sig check task result task:%p\n", task); - mimeview->siginfo->last_sig_check_task = NULL; - } - - cancellable = g_task_get_cancellable(task); - cancelled = g_cancellable_set_error_if_cancelled(cancellable, &error); - if (cancelled) { - debug_print("sig check task was cancelled: task:%p GError: domain:%s code:%d message:\"%s\"\n", - task, g_quark_to_string(error->domain), error->code, error->message); - g_error_free(error); - update_signature_noticeview(mimeview, TRUE, SIGNATURE_CHECK_TIMEOUT); - return; - } else { - if (mimeview->sig_check_cancellable == NULL) - g_error("bad cancellable"); - if (mimeview->sig_check_timeout_tag == 0) - g_error("bad cancel source tag"); - - g_source_remove(mimeview->sig_check_timeout_tag); - mimeview->sig_check_timeout_tag = 0; - g_object_unref(mimeview->sig_check_cancellable); - mimeview->sig_check_cancellable = NULL; - } - - result = g_task_propagate_pointer(task, &error); - - if (mimeview->siginfo->sig_data) { - privacy_free_signature_data(mimeview->siginfo->sig_data); - mimeview->siginfo->sig_data = NULL; - } - - if (result == NULL) { - debug_print("sig check task propagated NULL task:%p GError: domain:%s code:%d message:\"%s\"\n", - task, g_quark_to_string(error->domain), error->code, error->message); - g_error_free(error); - update_signature_noticeview(mimeview, TRUE, SIGNATURE_CHECK_ERROR); - return; - } - - mimeview->siginfo->sig_data = result->sig_data; - update_signature_noticeview(mimeview, FALSE, 0); - - if (result->newinfo) { - g_warning("Check sig task returned an unexpected new MimeInfo"); - procmime_mimeinfo_free_all(&result->newinfo); - } - - g_free(result); -} - -gboolean mimeview_check_sig_timeout(gpointer user_data) -{ - MimeView *mimeview = (MimeView *)user_data; - GCancellable *cancellable = mimeview->sig_check_cancellable; - - mimeview->sig_check_timeout_tag = 0; - - if (cancellable == NULL) { - return G_SOURCE_REMOVE; - } - - mimeview->sig_check_cancellable = NULL; - g_cancellable_cancel(cancellable); - g_object_unref(cancellable); - - return G_SOURCE_REMOVE; -} - -static void check_signature_cb(GtkWidget *widget, gpointer user_data) -{ - MimeView *mimeview = (MimeView *) user_data; - MimeInfo *mimeinfo = mimeview->siginfo; - gint ret; - - if (mimeinfo == NULL || !noticeview_is_visible(mimeview->siginfoview)) - return; - - noticeview_set_text(mimeview->siginfoview, _("Checking signature...")); - GTK_EVENTS_FLUSH(); - - if (mimeview->sig_check_cancellable != NULL) { - if (mimeview->sig_check_timeout_tag == 0) - g_error("bad cancel source tag"); - g_source_remove(mimeview->sig_check_timeout_tag); - g_cancellable_cancel(mimeview->sig_check_cancellable); - g_object_unref(mimeview->sig_check_cancellable); - } - - mimeview->sig_check_cancellable = g_cancellable_new(); - - ret = privacy_mimeinfo_check_signature(mimeview->siginfo, - mimeview->sig_check_cancellable, - check_signature_async_cb, - mimeview); - if (ret == 0) { - mimeview->sig_check_timeout_tag = g_timeout_add_seconds(prefs_common.io_timeout_secs, - mimeview_check_sig_timeout, mimeview); - } else if (ret < 0) { - g_object_unref(mimeview->sig_check_cancellable); - mimeview->sig_check_cancellable = NULL; - update_signature_noticeview(mimeview, TRUE, SIGNATURE_CHECK_ERROR); - } else { - g_object_unref(mimeview->sig_check_cancellable); - mimeview->sig_check_cancellable = NULL; - update_signature_noticeview(mimeview, FALSE, 0); - } -} - -void mimeview_check_signature(MimeView *mimeview) -{ - check_signature_cb(NULL, mimeview); -} - static void redisplay_email(GtkWidget *widget, gpointer user_data) { MimeView *mimeview = (MimeView *) user_data; @@ -1211,63 +917,6 @@ static void redisplay_email(GtkWidget *widget, gpointe GTK_TREE_VIEW(mimeview->ctree)), mimeview); } -static void display_full_info_cb(GtkWidget *widget, gpointer user_data) -{ - MimeView *mimeview = (MimeView *) user_data; - - textview_set_text(mimeview->textview, privacy_mimeinfo_get_sig_info(mimeview->siginfo, TRUE)); - noticeview_set_button_text(mimeview->siginfoview, NULL); - noticeview_set_button_press_callback( - mimeview->siginfoview, - G_CALLBACK(redisplay_email), - (gpointer) mimeview); - noticeview_set_tooltip(mimeview->siginfoview, _("Go back to email")); -} - -static void update_signature_info(MimeView *mimeview, MimeInfo *selected) -{ - MimeInfo *siginfo; - MimeInfo *first_text; - - cm_return_if_fail(mimeview != NULL); - cm_return_if_fail(selected != NULL); - - if (selected->type == MIMETYPE_MESSAGE - && !g_ascii_strcasecmp(selected->subtype, "rfc822")) { - /* if the first text part is signed, check that */ - first_text = selected; - while (first_text && first_text->type != MIMETYPE_TEXT) { - first_text = procmime_mimeinfo_next(first_text); - } - if (first_text) { - update_signature_info(mimeview, first_text); - return; - } - } - - siginfo = selected; - while (siginfo != NULL) { - if (privacy_mimeinfo_is_signed(siginfo)) - break; - siginfo = procmime_mimeinfo_parent(siginfo); - } - mimeview->siginfo = siginfo; - - /* This shortcut boolean is there to correctly set the menu's - * CheckSignature item sensitivity without killing performance - * each time the menu sensitiveness is updated (a lot). - */ - mimeview->signed_part = (siginfo != NULL); - - if (siginfo == NULL) { - noticeview_hide(mimeview->siginfoview); - return; - } - - update_signature_noticeview(mimeview, FALSE, 0); - noticeview_show(mimeview->siginfoview); -} - void mimeview_show_part_as_text(MimeView *mimeview, MimeInfo *partinfo) { cm_return_if_fail(mimeview != NULL); @@ -1319,8 +968,6 @@ static void mimeview_selected(GtkTreeSelection *select mimeview->textview->default_text = FALSE; - update_signature_info(mimeview, partinfo); - if (!mimeview_show_part(mimeview, partinfo)) { switch (partinfo->type) { case MIMETYPE_TEXT: @@ -1340,11 +987,6 @@ static void mimeview_selected(GtkTreeSelection *select mainwin = mainwindow_get_mainwindow(); if (mainwin) main_window_set_menu_sensitive(mainwin); - - if (mimeview->siginfo && privacy_auto_check_signatures(mimeview->siginfo) - && privacy_mimeinfo_get_sig_status(mimeview->siginfo) == SIGNATURE_UNCHECKED) { - mimeview_check_signature(mimeview); - } } static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event, @@ -2240,10 +1882,6 @@ static gint icon_key_pressed(GtkWidget *button, GdkEve BREAK_ON_MODIFIER_KEY(); mimeview_open_with(mimeview); return TRUE; - case GDK_KEY_c: - BREAK_ON_MODIFIER_KEY(); - mimeview_check_signature(mimeview); - return TRUE; case GDK_KEY_a: BREAK_ON_MODIFIER_KEY(); mimeview_select_next_part(mimeview); @@ -2280,8 +1918,6 @@ static void icon_list_append_icon (MimeView *mimeview, gchar *content_type; StockPixmap stockp; MimeInfo *partinfo; - MimeInfo *siginfo = NULL; - MimeInfo *encrypted = NULL; if (!prefs_common.show_inline_attachments && mimeinfo->id) return; @@ -2337,48 +1973,10 @@ static void icon_list_append_icon (MimeView *mimeview, partinfo = mimeinfo; while (partinfo != NULL) { - if (privacy_mimeinfo_is_signed(partinfo)) { - siginfo = partinfo; - break; - } - if (privacy_mimeinfo_is_encrypted(partinfo)) { - encrypted = partinfo; - break; - } partinfo = procmime_mimeinfo_parent(partinfo); } + pixmap = stock_pixmap_widget_with_overlay(stockp, 0, OVERLAY_NONE, 6, 3); - if (siginfo != NULL) { - switch (privacy_mimeinfo_get_sig_status(siginfo)) { - case SIGNATURE_UNCHECKED: - case SIGNATURE_CHECK_ERROR: - case SIGNATURE_CHECK_FAILED: - case SIGNATURE_CHECK_TIMEOUT: - pixmap = stock_pixmap_widget_with_overlay(stockp, - STOCK_PIXMAP_PRIVACY_EMBLEM_SIGNED, OVERLAY_BOTTOM_RIGHT, 6, 3); - break; - case SIGNATURE_OK: - pixmap = stock_pixmap_widget_with_overlay(stockp, - STOCK_PIXMAP_PRIVACY_EMBLEM_PASSED, OVERLAY_BOTTOM_RIGHT, 6, 3); - break; - case SIGNATURE_WARN: - case SIGNATURE_KEY_EXPIRED: - pixmap = stock_pixmap_widget_with_overlay(stockp, - STOCK_PIXMAP_PRIVACY_EMBLEM_WARN, OVERLAY_BOTTOM_RIGHT, 6, 3); - break; - case SIGNATURE_INVALID: - pixmap = stock_pixmap_widget_with_overlay(stockp, - STOCK_PIXMAP_PRIVACY_EMBLEM_FAILED, OVERLAY_BOTTOM_RIGHT, 6, 3); - break; - } - sigshort = privacy_mimeinfo_get_sig_info(siginfo, FALSE); - } else if (encrypted != NULL) { - pixmap = stock_pixmap_widget_with_overlay(stockp, - STOCK_PIXMAP_PRIVACY_EMBLEM_ENCRYPTED, OVERLAY_BOTTOM_RIGHT, 6, 3); - } else { - pixmap = stock_pixmap_widget_with_overlay(stockp, 0, - OVERLAY_NONE, 6, 3); - } gtk_container_add(GTK_CONTAINER(button), pixmap); if (!desc) { if (prefs_common.attach_desc) blob - f62b4f6e6e8bf7dd0009b3572fb4c6c5dd1811a2 blob + d40b340e19bbd25e1bccce465a77aad292d47664 --- src/mimeview.h +++ src/mimeview.h @@ -75,15 +75,9 @@ struct _MimeView gint icon_count; MainWindow *mainwin; - NoticeView *siginfoview; - MimeInfo *siginfo; MimeInfo *spec_part; GtkUIManager *ui_manager; GtkActionGroup *action_group; - gboolean signed_part; - - GCancellable *sig_check_cancellable; - guint sig_check_timeout_tag; }; struct _MimeViewerFactory blob - 2378da0af60415b9fb279cf6bdede0697d0db9a6 blob + 8514434eef77319399e56820bc6bc860ec0aabd0 --- src/prefs_account.c +++ src/prefs_account.c @@ -55,7 +55,6 @@ #include "combobox.h" #include "setup.h" #include "hooks.h" -#include "privacy.h" #include "inputdialog.h" #include "common/ssl_certificate.h" #include "passwordstore.h" @@ -197,21 +196,6 @@ typedef struct ComposePage GtkWidget *autoreplyto_entry; } ComposePage; -typedef struct PrivacyPage -{ - PrefsPage page; - - GtkWidget *vbox; - - GtkWidget *default_privacy_system; - GtkWidget *default_encrypt_checkbtn; - GtkWidget *default_encrypt_reply_checkbtn; - GtkWidget *default_sign_checkbtn; - GtkWidget *default_sign_reply_checkbtn; - GtkWidget *save_clear_text_checkbtn; - GtkWidget *encrypt_to_self_checkbtn; -} PrivacyPage; - typedef struct SSLPage { PrefsPage page; @@ -275,7 +259,6 @@ static BasicPage basic_page; static ReceivePage receive_page; static SendPage send_page; static ComposePage compose_page; -static PrivacyPage privacy_page; static SSLPage ssl_page; static AdvancedPage advanced_page; @@ -299,7 +282,6 @@ static void prefs_account_protocol_set_optmenu (PrefP static void prefs_account_protocol_changed (GtkComboBox *combobox, gpointer data); static void prefs_account_set_string_from_combobox (PrefParam *pparam); -static void prefs_account_set_privacy_combobox_from_string (PrefParam *pparam); static void prefs_account_imap_auth_type_set_data_from_optmenu (PrefParam *pparam); static void prefs_account_imap_auth_type_set_optmenu (PrefParam *pparam); @@ -317,8 +299,6 @@ static void prefs_account_enum_set_radiobtn (PrefPara static void prefs_account_mailcmd_toggled(GtkToggleButton *button, gpointer user_data); static void prefs_account_showpwd_toggled(GtkEntry *entry, gpointer user_data); -static gchar *privacy_prefs; - static PrefParam basic_param[] = { {"account_name", NULL, &tmp_ac_prefs.account_name, P_STRING, &basic_page.acname_entry, prefs_set_data_from_entry, prefs_set_entry}, @@ -504,47 +484,6 @@ static PrefParam compose_param[] = { {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} }; -static PrefParam privacy_param[] = { - {"default_privacy_system", "", &tmp_ac_prefs.default_privacy_system, P_STRING, - &privacy_page.default_privacy_system, - prefs_account_set_string_from_combobox, - prefs_account_set_privacy_combobox_from_string}, - - {"default_encrypt", "FALSE", &tmp_ac_prefs.default_encrypt, P_BOOL, - &privacy_page.default_encrypt_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"default_encrypt_reply", "TRUE", &tmp_ac_prefs.default_encrypt_reply, P_BOOL, - &privacy_page.default_encrypt_reply_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"default_sign", "FALSE", &tmp_ac_prefs.default_sign, P_BOOL, - &privacy_page.default_sign_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, -#ifdef G_OS_UNIX - {"default_sign_reply", "TRUE", &tmp_ac_prefs.default_sign_reply, P_BOOL, - &privacy_page.default_sign_reply_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, -#else - /* Bug 2367: disturbing for Win32 users with no keypair */ - {"default_sign_reply", "FALSE", &tmp_ac_prefs.default_sign_reply, P_BOOL, - &privacy_page.default_sign_reply_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, -#endif - {"save_clear_text", "FALSE", &tmp_ac_prefs.save_encrypted_as_clear_text, P_BOOL, - &privacy_page.save_clear_text_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"encrypt_to_self", "FALSE", &tmp_ac_prefs.encrypt_to_self, P_BOOL, - &privacy_page.encrypt_to_self_checkbtn, - prefs_set_data_from_toggle, prefs_set_toggle}, - - {"privacy_prefs", "", &privacy_prefs, P_STRING, - NULL, NULL, NULL}, - - {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} -}; - static PrefParam ssl_param[] = { {"ssl_pop", "1", &tmp_ac_prefs.ssl_pop, P_ENUM, &ssl_page.pop_nossl_radiobtn, @@ -686,54 +625,6 @@ static void prefs_account_receive_itv_spinbutton_value #define COMBOBOX_PRIVACY_PLUGIN_ID 3 -/* Enable/disable necessary preference widgets based on current privacy - * system choice. */ -static void privacy_system_activated(GtkWidget *combobox) -{ - gtk_widget_set_sensitive (privacy_page.save_clear_text_checkbtn, - !gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(privacy_page.encrypt_to_self_checkbtn))); -} - -/* Populate the privacy system choice combobox with valid choices */ -static void update_privacy_system_menu() { - GtkListStore *menu; - GtkTreeIter iter; - GSList *system_ids, *cur; - - menu = GTK_LIST_STORE(gtk_combo_box_get_model( - GTK_COMBO_BOX(privacy_page.default_privacy_system))); - - /* First add "None", as that one is always available. :) */ - gtk_list_store_append(menu, &iter); - gtk_list_store_set(menu, &iter, - COMBOBOX_TEXT, _("None"), - COMBOBOX_DATA, 0, - COMBOBOX_SENS, TRUE, - COMBOBOX_PRIVACY_PLUGIN_ID, "", - -1); - - /* Now go through list of available privacy systems and add an entry - * for each. */ - system_ids = privacy_get_system_ids(); - for (cur = system_ids; cur != NULL; cur = g_slist_next(cur)) { - gchar *id = (gchar *) cur->data; - const gchar *name; - - name = privacy_system_get_name(id); - gtk_list_store_append(menu, &iter); - gtk_list_store_set(menu, &iter, - COMBOBOX_TEXT, name, - COMBOBOX_DATA, 1, - COMBOBOX_SENS, TRUE, - COMBOBOX_PRIVACY_PLUGIN_ID, id, - -1); - g_free(id); - } - g_slist_free(system_ids); - -} - #define TABLE_YPAD 2 static void basic_create_widget_func(PrefsPage * _page, @@ -1639,8 +1530,6 @@ static void compose_create_widget_func(PrefsPage * _pa PrefsAccount *ac_prefs = (PrefsAccount *) data; GtkWidget *vbox1; - GtkWidget *hbox1; - GtkWidget *hbox2; GtkWidget *frame; GtkWidget *table; GtkWidget *autocc_checkbtn; @@ -1718,107 +1607,6 @@ static void compose_create_widget_func(PrefsPage * _pa page->page.widget = vbox1; } -static void privacy_create_widget_func(PrefsPage * _page, - GtkWindow * window, - gpointer data) -{ - PrivacyPage *page = (PrivacyPage *) _page; - PrefsAccount *ac_prefs = (PrefsAccount *) data; - - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *hbox1; - GtkWidget *label; - GtkWidget *default_privacy_system; - GtkListStore *menu; - GtkCellRenderer *rend; - GtkWidget *default_encrypt_checkbtn; - GtkWidget *default_encrypt_reply_checkbtn; - GtkWidget *default_sign_checkbtn; - GtkWidget *default_sign_reply_checkbtn; - GtkWidget *save_clear_text_checkbtn; - GtkWidget *encrypt_to_self_checkbtn; - - vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING); - gtk_widget_show (vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER(vbox2), hbox1); - - label = gtk_label_new(_("Default privacy system")); - gtk_widget_show(label); - gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); - - /* Can't use gtkut_sc_combobox_create() here, because model for this - * combobox needs an extra string column to store privacy plugin id. */ - menu = gtk_list_store_new(4, - G_TYPE_STRING, - G_TYPE_INT, - G_TYPE_BOOLEAN, - G_TYPE_STRING); /* This is where we store the privacy plugin id. */ - default_privacy_system = gtk_combo_box_new_with_model(GTK_TREE_MODEL(menu)); - - rend = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(default_privacy_system), rend, TRUE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(default_privacy_system), rend, - "text", COMBOBOX_TEXT, - "sensitive", COMBOBOX_SENS, - NULL); - gtk_widget_set_focus_on_click(GTK_WIDGET(default_privacy_system), FALSE); - - gtk_widget_show (default_privacy_system); - gtk_box_pack_start (GTK_BOX(hbox1), default_privacy_system, FALSE, TRUE, 0); - - g_signal_connect(G_OBJECT(default_privacy_system), "changed", - G_CALLBACK(privacy_system_activated), - NULL); - - PACK_CHECK_BUTTON (vbox2, default_sign_checkbtn, - _("Always sign messages")); - PACK_CHECK_BUTTON (vbox2, default_encrypt_checkbtn, - _("Always encrypt messages")); - PACK_CHECK_BUTTON (vbox2, default_sign_reply_checkbtn, - _("Always sign messages when replying to a " - "signed message")); - PACK_CHECK_BUTTON (vbox2, default_encrypt_reply_checkbtn, - _("Always encrypt messages when replying to an " - "encrypted message")); - PACK_CHECK_BUTTON (vbox2, encrypt_to_self_checkbtn, - _("Encrypt sent messages with your own key in addition to recipient's")); - PACK_CHECK_BUTTON (vbox2, save_clear_text_checkbtn, - _("Save sent encrypted messages as clear text")); - - SET_TOGGLE_SENSITIVITY_REVERSE(encrypt_to_self_checkbtn, save_clear_text_checkbtn); - SET_TOGGLE_SENSITIVITY_REVERSE(save_clear_text_checkbtn, encrypt_to_self_checkbtn); - - page->default_privacy_system = default_privacy_system; - page->default_encrypt_checkbtn = default_encrypt_checkbtn; - page->default_encrypt_reply_checkbtn = default_encrypt_reply_checkbtn; - page->default_sign_reply_checkbtn = default_sign_reply_checkbtn; - page->default_sign_checkbtn = default_sign_checkbtn; - page->save_clear_text_checkbtn = save_clear_text_checkbtn; - page->encrypt_to_self_checkbtn = encrypt_to_self_checkbtn; - - update_privacy_system_menu(); - - tmp_ac_prefs = *ac_prefs; - - if (new_account) { - prefs_set_dialog_to_default(privacy_param); - } else - prefs_set_dialog(privacy_param); - - page->vbox = vbox1; - - page->page.widget = vbox1; -} - #define CREATE_RADIO_BUTTON(box, btn, btn_p, label, data) \ { \ btn = gtk_radio_button_new_with_label_from_widget \ @@ -2469,12 +2257,6 @@ static gint prefs_compose_apply(void) return 0; } -static gint prefs_privacy_apply(void) -{ - prefs_set_data_from_dialog(privacy_param); - return 0; -} - static gint prefs_ssl_apply(void) { prefs_set_data_from_dialog(ssl_param); @@ -2544,11 +2326,6 @@ static void compose_destroy_widget_func(PrefsPage *_pa /* ComposePage *page = (ComposePage *) _page; */ } -static void privacy_destroy_widget_func(PrefsPage *_page) -{ - /* PrivacyPage *page = (PrivacyPage *) _page; */ -} - static void ssl_destroy_widget_func(PrefsPage *_page) { /* SSLPage *page = (SSLPage *) _page; */ @@ -2599,16 +2376,6 @@ static gboolean compose_can_close_func(PrefsPage *_pag return prefs_compose_apply() >= 0; } -static gboolean privacy_can_close_func(PrefsPage *_page) -{ - PrivacyPage *page = (PrivacyPage *) _page; - - if (!page->page.page_open) - return TRUE; - - return prefs_privacy_apply() >= 0; -} - static gboolean ssl_can_close_func(PrefsPage *_page) { SSLPage *page = (SSLPage *) _page; @@ -2673,17 +2440,6 @@ static void compose_save_func(PrefsPage *_page) cancelled = FALSE; } -static void privacy_save_func(PrefsPage *_page) -{ - PrivacyPage *page = (PrivacyPage *) _page; - - if (!page->page.page_open) - return; - - if (prefs_privacy_apply() >= 0) - cancelled = FALSE; -} - static void ssl_save_func(PrefsPage *_page) { SSLPage *page = (SSLPage *) _page; @@ -2778,24 +2534,6 @@ static void register_compose_page(void) prefs_account_register_page((PrefsPage *) &compose_page); } -static void register_privacy_page(void) -{ - static gchar *path[3]; - - path[0] = _("Account"); - path[1] = _("Privacy"); - path[2] = NULL; - - privacy_page.page.path = path; - privacy_page.page.weight = 1000.0; - privacy_page.page.create_widget = privacy_create_widget_func; - privacy_page.page.destroy_widget = privacy_destroy_widget_func; - privacy_page.page.save_page = privacy_save_func; - privacy_page.page.can_close = privacy_can_close_func; - - prefs_account_register_page((PrefsPage *) &privacy_page); -} - static void register_ssl_page(void) { static gchar *path[3]; @@ -2902,7 +2640,6 @@ void prefs_account_init() register_receive_page(); register_send_page(); register_compose_page(); - register_privacy_page(); register_ssl_page(); hooks_register_hook(SSLCERT_GET_CLIENT_CERT_HOOKLIST, sslcert_get_client_cert_hook, NULL); hooks_register_hook(SSL_CERT_GET_PASSWORD, sslcert_get_password, NULL); @@ -2919,14 +2656,10 @@ PrefsAccount *prefs_account_new(void) prefs_set_default(receive_param); prefs_set_default(send_param); prefs_set_default(compose_param); - prefs_set_default(privacy_param); prefs_set_default(ssl_param); prefs_set_default(advanced_param); *ac_prefs = tmp_ac_prefs; ac_prefs->account_id = prefs_account_get_new_id(); - - ac_prefs->privacy_prefs = g_hash_table_new(g_str_hash, g_str_equal); - return ac_prefs; } @@ -2935,8 +2668,6 @@ PrefsAccount *prefs_account_new_from_config(const gcha const gchar *p = label; gchar *rcpath; gint id; - gchar **strv, **cur; - gsize len; PrefsAccount *ac_prefs; cm_return_val_if_fail(label != NULL, NULL); @@ -2949,7 +2680,6 @@ PrefsAccount *prefs_account_new_from_config(const gcha prefs_set_default(receive_param); prefs_set_default(send_param); prefs_set_default(compose_param); - prefs_set_default(privacy_param); prefs_set_default(ssl_param); prefs_set_default(advanced_param); @@ -2959,7 +2689,6 @@ PrefsAccount *prefs_account_new_from_config(const gcha prefs_read_config(receive_param, label, rcpath, NULL); prefs_read_config(send_param, label, rcpath, NULL); prefs_read_config(compose_param, label, rcpath, NULL); - prefs_read_config(privacy_param, label, rcpath, NULL); prefs_read_config(ssl_param, label, rcpath, NULL); prefs_read_config(advanced_param, label, rcpath, NULL); g_free(rcpath); @@ -2971,30 +2700,6 @@ PrefsAccount *prefs_account_new_from_config(const gcha if (id < 0) g_warning("wrong account id: %d", id); ac_prefs->account_id = id; - /* Now parse privacy_prefs. */ - ac_prefs->privacy_prefs = g_hash_table_new(g_str_hash, g_str_equal); - if (privacy_prefs != NULL) { - strv = g_strsplit(privacy_prefs, ",", 0); - for (cur = strv; *cur != NULL; cur++) { - gchar *encvalue, *tmp; - - encvalue = strchr(*cur, '='); - if (encvalue == NULL) - continue; - encvalue[0] = '\0'; - encvalue++; - - tmp = g_base64_decode_zero(encvalue, &len); - if (len > 0) - g_hash_table_insert(ac_prefs->privacy_prefs, g_strdup(*cur), tmp); - else - g_free(tmp); - } - g_strfreev(strv); - g_free(privacy_prefs); - privacy_prefs = NULL; - } - /* For older configurations, move stored passwords into the * password store. */ gboolean passwords_migrated = FALSE; @@ -3040,26 +2745,10 @@ PrefsAccount *prefs_account_new_from_config(const gcha return ac_prefs; } -static void create_privacy_prefs(gpointer key, gpointer _value, gpointer user_data) -{ - GString *str = (GString *) user_data; - gchar *encvalue; - gchar *value = (gchar *) _value; - - if (str->len > 0) - g_string_append_c(str, ','); - - encvalue = g_base64_encode(value, strlen(value)); - g_string_append_printf(str, "%s=%s", (gchar *) key, encvalue); - g_free(encvalue); -} - #define WRITE_PARAM(PARAM_TABLE) \ if (prefs_write_param(PARAM_TABLE, pfile->fp) < 0) { \ g_warning("failed to write configuration to file"); \ prefs_file_close_revert(pfile); \ - g_free(privacy_prefs); \ - privacy_prefs = NULL; \ g_free(rcpath); \ return; \ } @@ -3077,31 +2766,20 @@ void prefs_account_write_config_all(GList *account_lis } for (cur = account_list; cur != NULL; cur = cur->next) { - GString *str; - tmp_ac_prefs = *(PrefsAccount *)cur->data; - if (fprintf(pfile->fp, "[Account: %d]\n", - tmp_ac_prefs.account_id) <= 0) { + if (fprintf(pfile->fp, "[Account: %d]\n", tmp_ac_prefs.account_id) <= 0) { g_free(pfile); g_free(rcpath); return; - } + } - str = g_string_sized_new(32); - g_hash_table_foreach(tmp_ac_prefs.privacy_prefs, create_privacy_prefs, str); - privacy_prefs = g_string_free(str, FALSE); - WRITE_PARAM(basic_param) WRITE_PARAM(receive_param) WRITE_PARAM(send_param) WRITE_PARAM(compose_param) - WRITE_PARAM(privacy_param) WRITE_PARAM(ssl_param) WRITE_PARAM(advanced_param) - g_free(privacy_prefs); - privacy_prefs = NULL; - if (cur->next) { if (fputc('\n', pfile->fp) == EOF) { FILE_OP_ERROR(rcpath, "fputc"); @@ -3120,50 +2798,19 @@ void prefs_account_write_config_all(GList *account_lis } #undef WRITE_PARAM -static gboolean free_privacy_prefs(gpointer key, gpointer value, gpointer user_data) -{ - g_free(key); - g_free(value); - - return TRUE; -} - void prefs_account_free(PrefsAccount *ac_prefs) { if (!ac_prefs) return; - g_hash_table_foreach_remove(ac_prefs->privacy_prefs, free_privacy_prefs, NULL); - tmp_ac_prefs = *ac_prefs; prefs_free(basic_param); prefs_free(receive_param); prefs_free(send_param); prefs_free(compose_param); - prefs_free(privacy_param); prefs_free(ssl_param); prefs_free(advanced_param); } -const gchar *prefs_account_get_privacy_prefs(PrefsAccount *account, gchar *id) -{ - return g_hash_table_lookup(account->privacy_prefs, id); -} - -void prefs_account_set_privacy_prefs(PrefsAccount *account, gchar *id, gchar *new_value) -{ - gchar *orig_key = NULL, *value; - - if (g_hash_table_lookup_extended(account->privacy_prefs, id, (gpointer *)(gchar *) &orig_key, (gpointer *)(gchar *) &value)) { - g_hash_table_remove(account->privacy_prefs, id); - - g_free(orig_key); - g_free(value); - } - - if (new_value != NULL) - g_hash_table_insert(account->privacy_prefs, g_strdup(id), g_strdup(new_value)); -} - static gint prefs_account_get_new_id(void) { GList *ac_list; @@ -3634,83 +3281,6 @@ static void prefs_account_set_string_from_combobox(Pre -1); } -/* Context struct and internal function called by gtk_tree_model_foreach(). - * This is used in prefs_account_set_privacy_combobox_from_string() to find - * correct combobox entry to activate when account preferences are displayed - * and their values are set according to preferences. */ -typedef struct _privacy_system_set_ctx { - GtkWidget *combobox; - gchar *prefsid; - gboolean found; -} PrivacySystemSetCtx; - -static gboolean _privacy_system_set_func(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, PrivacySystemSetCtx *ctx) -{ - GtkWidget *combobox = ctx->combobox; - gchar *prefsid = ctx->prefsid; - gchar *curid; - - /* We're searching for correct privacy plugin ID. */ - gtk_tree_model_get(model, iter, COMBOBOX_PRIVACY_PLUGIN_ID, &curid, -1); - if( strcmp(prefsid, curid) == 0 ) { - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combobox), iter); - g_free(curid); - ctx->found = TRUE; - return TRUE; - } - - g_free(curid); - return FALSE; -} - -static void prefs_account_set_privacy_combobox_from_string(PrefParam *pparam) -{ - GtkWidget *optionmenu; - GtkListStore *menu; - GtkTreeIter iter; - gboolean found = FALSE; - gchar *prefsid; - PrivacySystemSetCtx *ctx = NULL; - - cm_return_if_fail(*pparam->widget != NULL); - - prefsid = *((gchar **) pparam->data); - if (prefsid == NULL) - return; - - optionmenu = *pparam->widget; - menu = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optionmenu))); - - ctx = g_new(PrivacySystemSetCtx, sizeof(PrivacySystemSetCtx)); - ctx->combobox = optionmenu; - ctx->prefsid = prefsid; - ctx->found = FALSE; - - gtk_tree_model_foreach(GTK_TREE_MODEL(menu), - (GtkTreeModelForeachFunc)_privacy_system_set_func, ctx); - found = ctx->found; - g_free(ctx); - - /* If chosen privacy system is not available, add a dummy entry with - * "not loaded" note and make it active. */ - if (!found) { - gchar *name; - - name = g_strdup_printf(_("%s (plugin not loaded)"), prefsid); - gtk_list_store_append(menu, &iter); - gtk_list_store_set(menu, &iter, - COMBOBOX_TEXT, name, - COMBOBOX_DATA, 0, - COMBOBOX_SENS, TRUE, - COMBOBOX_PRIVACY_PLUGIN_ID, prefsid, - -1); - g_free(name); - - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optionmenu), &iter); - } -} - static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data) { RecvProtocol protocol; blob - f1442e9f99b7f513f98b2b1f628c38e2d6adafab blob + 21cb54adddefcf4e188a735904313a9cf26d50e5 --- src/prefs_account.h +++ src/prefs_account.h @@ -129,15 +129,6 @@ struct _PrefsAccount gboolean set_autoreplyto; gchar *auto_replyto; - /* Privacy */ - gchar *default_privacy_system; - gboolean default_encrypt; - gboolean default_encrypt_reply; - gboolean default_sign; - gboolean default_sign_reply; - gboolean save_encrypted_as_clear_text; - gboolean encrypt_to_self; - /* Advanced */ gboolean set_smtpport; gushort smtpport; @@ -181,7 +172,6 @@ struct _PrefsAccount gint account_id; struct _Folder *folder; - GHashTable *privacy_prefs; SMTPSession *session; gint config_version; @@ -198,8 +188,6 @@ void prefs_account_free (PrefsAccount *ac_prefs); PrefsAccount *prefs_account_open (PrefsAccount *ac_prefs, gboolean *dirty); -const gchar *prefs_account_get_privacy_prefs(PrefsAccount *account, gchar *id); -void prefs_account_set_privacy_prefs(PrefsAccount *account, gchar *id, gchar *new_value); gchar *prefs_account_generate_msgid(PrefsAccount *account); void prefs_account_register_page (PrefsPage *page); blob - f190952d31c3c6464ef074c5fedb031fadac7165 blob + c95b48af5d97ecfb672fae8c3ea1bb2ea2fa134c --- src/prefs_common.c +++ src/prefs_common.c @@ -171,8 +171,6 @@ static PrefParam param[] = { P_BOOL, NULL, NULL, NULL}, {"autosave_length", "50", &prefs_common.autosave_length, P_INT, NULL, NULL, NULL}, - {"autosave_encrypted", "FALSE", &prefs_common.autosave_encrypted, - P_BOOL, NULL, NULL, NULL}, {"warn_large_insert", "TRUE", &prefs_common.warn_large_insert, P_BOOL, NULL, NULL, NULL}, {"warn_large_insert_size", "500", &prefs_common.warn_large_insert_size, @@ -886,7 +884,6 @@ static PrefParam param[] = { NULL, NULL, NULL}, {"address_search_wildcard", "TRUE", &prefs_common.address_search_wildcard, P_BOOL, NULL, NULL, NULL}, - {"enable_avatars", "3", &prefs_common.enable_avatars, P_INT, NULL, NULL, NULL}, {"master_passphrase", "", &prefs_common.primary_passphrase, P_STRING, NULL, NULL, NULL }, {"master_passphrase_salt", "", &prefs_common.primary_passphrase_salt, P_STRING, NULL, NULL, NULL }, {"master_passphrase_pbkdf2_rounds", "50000", &prefs_common.primary_passphrase_pbkdf2_rounds, P_INT, NULL, NULL, NULL}, blob - 5fbbb3419415c60c4811b5bbcbb53026eed655a1 blob + 79e793702dbb795c6cc47162f773635f687cf8bb --- src/prefs_common.h +++ src/prefs_common.h @@ -187,7 +187,6 @@ struct _PrefsCommon gboolean reedit_account_autosel; gboolean autosave; gint autosave_length; - gboolean autosave_encrypted; gboolean warn_large_insert; gint warn_large_insert_size; gboolean compose_no_markup; @@ -490,8 +489,6 @@ struct _PrefsCommon gboolean folder_search_wildcard; gboolean address_search_wildcard; - guint enable_avatars; - gboolean use_primary_passphrase; gchar *primary_passphrase; gchar *primary_passphrase_salt; blob - 52ebb26dbbe2dbee304169e32f0fa5570379fb89 blob + 591242a46eb00173fdfd875a016e3e5d14353642 --- src/prefs_compose_writing.c +++ src/prefs_compose_writing.c @@ -52,7 +52,6 @@ typedef struct _WritingPage GtkWidget *checkbtn_redirect_keep_from; GtkWidget *checkbtn_autosave; GtkWidget *spinbtn_autosave_length; - GtkWidget *checkbtn_autosave_encrypted; GtkWidget *checkbtn_warn_large_insert; GtkWidget *spinbtn_warn_large_insert_size; GtkWidget *optmenu_dnd_insert_or_attach; @@ -92,9 +91,6 @@ static void prefs_compose_writing_create_widget(PrefsP GtkWidget *spinbtn_autosave_length; GtkWidget *label_autosave_length; - GtkWidget *hbox_autosave_encrypted; - GtkWidget *checkbtn_autosave_encrypted; - GtkWidget *hbox_dnd_insert_or_attach; GtkWidget *label_dnd_insert_or_attach; GtkWidget *optmenu_dnd_insert_or_attach; @@ -133,15 +129,6 @@ static void prefs_compose_writing_create_widget(PrefsP gtk_widget_show (label_autosave_length); gtk_box_pack_start (GTK_BOX (hbox_autosave), label_autosave_length, FALSE, FALSE, 0); - /* Editing: automatically save draft when encrypted */ - hbox_autosave_encrypted = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); - gtk_box_pack_start(GTK_BOX(hbox_autosave_encrypted), gtk_label_new(" "), FALSE, FALSE, 0); - gtk_widget_show_all (hbox_autosave_encrypted); - gtk_box_pack_start (GTK_BOX (vbox2), hbox_autosave_encrypted, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (hbox_autosave_encrypted, checkbtn_autosave_encrypted, - _("Even if message is to be encrypted")); - /* Editing: undo level */ hbox_undolevel = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); gtk_widget_show (hbox_undolevel); @@ -215,7 +202,6 @@ static void prefs_compose_writing_create_widget(PrefsP SET_TOGGLE_SENSITIVITY (checkbtn_autosave, spinbtn_autosave_length); SET_TOGGLE_SENSITIVITY (checkbtn_autosave, label_autosave_length); - SET_TOGGLE_SENSITIVITY (checkbtn_autosave, checkbtn_autosave_encrypted); SET_TOGGLE_SENSITIVITY (checkbtn_warn_large_insert, spinbtn_warn_large_insert_size); SET_TOGGLE_SENSITIVITY (checkbtn_warn_large_insert, label_warn_large_insert_size); @@ -227,8 +213,6 @@ static void prefs_compose_writing_create_widget(PrefsP prefs_writing->checkbtn_autosave = checkbtn_autosave; prefs_writing->spinbtn_autosave_length = spinbtn_autosave_length; - prefs_writing->checkbtn_autosave_encrypted = checkbtn_autosave_encrypted; - prefs_writing->checkbtn_warn_large_insert = checkbtn_warn_large_insert; prefs_writing->spinbtn_warn_large_insert_size = spinbtn_warn_large_insert_size; @@ -249,8 +233,6 @@ static void prefs_compose_writing_create_widget(PrefsP prefs_common.redirect_keep_from); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_writing->checkbtn_autosave), prefs_common.autosave); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_writing->checkbtn_autosave_encrypted), - prefs_common.autosave_encrypted); gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_writing->spinbtn_autosave_length), prefs_common.autosave_length); gtk_spin_button_set_value(GTK_SPIN_BUTTON(prefs_writing->spinbtn_undolevel), @@ -283,8 +265,6 @@ static void prefs_compose_writing_save(PrefsPage *_pag gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_redirect_keep_from)); prefs_common.autosave = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autosave)); - prefs_common.autosave_encrypted = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_autosave_encrypted)); prefs_common.autosave_length = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->spinbtn_autosave_length)); prefs_common.undolevels = blob - c67dcea932a578dbb7a438699c5758bfb3799b9b blob + 7c2d567641bc7fb76bc5adcfeafc96c7f7dc379f --- src/prefs_folder_item.c +++ src/prefs_folder_item.c @@ -114,8 +114,6 @@ struct _FolderItemComposePage GtkWidget *entry_default_replyto; GtkWidget *checkbtn_enable_default_account; GtkWidget *optmenu_default_account; - GtkWidget *always_sign; - GtkWidget *always_encrypt; /* apply to sub folders */ GtkWidget *save_copy_to_folder_rec_checkbtn; @@ -126,8 +124,6 @@ struct _FolderItemComposePage GtkWidget *default_bcc_rec_checkbtn; GtkWidget *default_replyto_rec_checkbtn; GtkWidget *default_account_rec_checkbtn; - GtkWidget *always_sign_rec_checkbtn; - GtkWidget *always_encrypt_rec_checkbtn; }; static void general_save_folder_prefs(FolderItem *folder, FolderItemGeneralPage *page); @@ -776,10 +772,6 @@ static void prefs_folder_item_compose_create_widget_fu GtkWidget *optmenu_default_account = NULL; GtkListStore *optmenu_default_account_menu = NULL; GtkTreeIter iter; - GtkWidget *always_sign; - GtkListStore *always_sign_menu; - GtkWidget *always_encrypt; - GtkListStore *always_encrypt_menu; GtkWidget *save_copy_to_folder_rec_checkbtn = NULL; GtkWidget *default_from_rec_checkbtn = NULL; GtkWidget *default_to_rec_checkbtn = NULL; @@ -788,8 +780,6 @@ static void prefs_folder_item_compose_create_widget_fu GtkWidget *default_bcc_rec_checkbtn = NULL; GtkWidget *default_replyto_rec_checkbtn = NULL; GtkWidget *default_account_rec_checkbtn = NULL; - GtkWidget *always_sign_rec_checkbtn = NULL; - GtkWidget *always_encrypt_rec_checkbtn = NULL; GList *cur_ac; GList *account_list; @@ -1018,68 +1008,6 @@ static void prefs_folder_item_compose_create_widget_fu gtk_grid_attach(GTK_GRID(table), default_account_rec_checkbtn, 2, rowcount, 1, 1); rowcount++; - /* PGP sign? */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); - gtk_box_set_spacing(GTK_BOX(hbox), 8); - gtk_widget_show (hbox); - gtk_grid_attach(GTK_GRID(table), hbox, 0, rowcount, 1, 1); - - label = gtk_label_new(_("Always sign messages")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0); - - always_sign = gtkut_sc_combobox_create (NULL, FALSE); - gtk_widget_show (always_sign); - gtk_box_pack_start (GTK_BOX(hbox), always_sign, FALSE, FALSE, 0); - - always_sign_menu = GTK_LIST_STORE(gtk_combo_box_get_model( - GTK_COMBO_BOX(always_sign))); - COMBOBOX_ADD (always_sign_menu, _("Default"), SIGN_OR_ENCRYPT_DEFAULT); - COMBOBOX_ADD (always_sign_menu, _("No"), SIGN_OR_ENCRYPT_NEVER); - COMBOBOX_ADD (always_sign_menu, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS); - - combobox_select_by_data(GTK_COMBO_BOX(always_sign), - item->prefs->always_sign); - - CLAWS_SET_TIP(hbox, _("\"Default\" will follow the applicable account preference")); - - always_sign_rec_checkbtn = gtk_check_button_new(); - gtk_widget_show (always_sign_rec_checkbtn); - gtk_grid_attach(GTK_GRID(table), always_sign_rec_checkbtn, 2, rowcount, 1, 1); - - rowcount++; - - /* PGP encrypt? */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); - gtk_box_set_spacing(GTK_BOX(hbox), 8); - gtk_widget_show (hbox); - gtk_grid_attach(GTK_GRID(table), hbox, 0, rowcount, 1, 1); - - label = gtk_label_new(_("Always encrypt messages")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0); - - always_encrypt = gtkut_sc_combobox_create (NULL, FALSE); - gtk_widget_show (always_encrypt); - gtk_box_pack_start (GTK_BOX(hbox), always_encrypt, FALSE, FALSE, 0); - - always_encrypt_menu = GTK_LIST_STORE(gtk_combo_box_get_model( - GTK_COMBO_BOX(always_encrypt))); - COMBOBOX_ADD (always_encrypt_menu, _("Default"), SIGN_OR_ENCRYPT_DEFAULT); - COMBOBOX_ADD (always_encrypt_menu, _("No"), SIGN_OR_ENCRYPT_NEVER); - COMBOBOX_ADD (always_encrypt_menu, _("Yes"), SIGN_OR_ENCRYPT_ALWAYS); - - combobox_select_by_data(GTK_COMBO_BOX(always_encrypt), - item->prefs->always_encrypt); - - CLAWS_SET_TIP(hbox, _("\"Default\" will follow the applicable account preference")); - - always_encrypt_rec_checkbtn = gtk_check_button_new(); - gtk_widget_show (always_encrypt_rec_checkbtn); - gtk_grid_attach(GTK_GRID(table), always_encrypt_rec_checkbtn, 2, rowcount, 1, 1); - - rowcount++; - gtk_widget_show_all(table); page->window = GTK_WIDGET(window); @@ -1100,8 +1028,6 @@ static void prefs_folder_item_compose_create_widget_fu page->entry_default_replyto = entry_default_replyto; page->checkbtn_enable_default_account = checkbtn_enable_default_account; page->optmenu_default_account = optmenu_default_account; - page->always_sign = always_sign; - page->always_encrypt = always_encrypt; page->save_copy_to_folder_rec_checkbtn = save_copy_to_folder_rec_checkbtn; page->default_from_rec_checkbtn = default_from_rec_checkbtn; @@ -1111,8 +1037,6 @@ static void prefs_folder_item_compose_create_widget_fu page->default_bcc_rec_checkbtn = default_bcc_rec_checkbtn; page->default_replyto_rec_checkbtn = default_replyto_rec_checkbtn; page->default_account_rec_checkbtn = default_account_rec_checkbtn; - page->always_sign_rec_checkbtn = always_sign_rec_checkbtn; - page->always_encrypt_rec_checkbtn = always_encrypt_rec_checkbtn; page->page.widget = table; } @@ -1224,15 +1148,6 @@ static void compose_save_folder_prefs(FolderItem *fold GTK_COMBO_BOX(page->optmenu_default_account)); } - if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_sign_rec_checkbtn))) { - prefs->always_sign = - combobox_get_active_data(GTK_COMBO_BOX(page->always_sign)); - } - if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn))) { - prefs->always_encrypt = - combobox_get_active_data(GTK_COMBO_BOX(page->always_encrypt)); - } - folder_item_prefs_save_config(folder); } @@ -1257,15 +1172,11 @@ static gboolean compose_save_recurse_func(GNode *node, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_cc_rec_checkbtn)) || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_bcc_rec_checkbtn)) || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_replyto_rec_checkbtn)) || - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_sign_rec_checkbtn)) || - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn)) || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn)) )) return TRUE; else if ((node == page->item->node) && !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) - || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_sign_rec_checkbtn)) - || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->always_encrypt_rec_checkbtn)) )) return TRUE; else blob - d6a2bfcde3ce2100bc0fe44829e08af52712ba1d (mode 644) blob + /dev/null --- src/privacy.c +++ /dev/null @@ -1,540 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#include -#include - -#include "privacy.h" -#include "procmime.h" -#include "procmsg.h" - -static GSList *systems = NULL; -static gchar *privacy_last_error = NULL; - -void privacy_set_error(const gchar *format, ...) -{ - va_list args; - gchar buf[BUFSIZ]; - - va_start(args, format); - g_vsnprintf(buf, BUFSIZ, format, args); - va_end(args); - g_free(privacy_last_error); - privacy_last_error = g_strdup(buf); -} - -static gchar tmp_privacy_error[BUFSIZ]; - -void privacy_reset_error(void) -{ - g_free(privacy_last_error); - privacy_last_error = NULL; -} - -gboolean privacy_peek_error(void) -{ - return (privacy_last_error != NULL); -} - -const gchar *privacy_get_error (void) -{ - if (privacy_last_error) { - strncpy2(tmp_privacy_error, privacy_last_error, BUFSIZ-1); - privacy_reset_error(); - return tmp_privacy_error; - } else { - return _("Unknown error"); - } -} - -static PrivacySystem *privacy_data_get_system(PrivacyData *data) -{ - /* Make sure the cached system is still registered */ - if (data->system && g_slist_find(systems, data->system)) - return data->system; - else - return NULL; -} -/** - * Register a new Privacy System - * - * \param system The Privacy System that should be registered - */ -void privacy_register_system(PrivacySystem *system) -{ - systems = g_slist_append(systems, system); -} - -/** - * Unregister a new Privacy System. The system must not be in - * use anymore when it is unregistered. - * - * \param system The Privacy System that should be unregistered - */ -void privacy_unregister_system(PrivacySystem *system) -{ - systems = g_slist_remove(systems, system); -} - -/** - * Free a PrivacyData of a PrivacySystem - * - * \param privacydata The data to free - */ -void privacy_free_privacydata(PrivacyData *privacydata) -{ - PrivacySystem *system = NULL; - - cm_return_if_fail(privacydata != NULL); - - system = privacy_data_get_system(privacydata); - if (!system) - return; - system->free_privacydata(privacydata); -} - -void privacy_free_signature_data(SignatureData *sig_data) -{ - cm_return_if_fail(sig_data != NULL); - - g_free(sig_data->info_short); - g_free(sig_data->info_full); - g_free(sig_data); -} - -void privacy_free_sig_check_task_result(gpointer data) -{ - SigCheckTaskResult *result = (SigCheckTaskResult *)data; - - privacy_free_signature_data(result->sig_data); - if (result->newinfo) - procmime_mimeinfo_free_all(&result->newinfo); - g_free(result); -} - -/** - * Check if a MimeInfo is signed with one of the available - * privacy system. If a privacydata is set in the MimeInfo - * it will directory return the return value by the system - * set in the privacy data or check all available privacy - * systems otherwise. - * - * \return True if the MimeInfo has a signature - */ -gboolean privacy_mimeinfo_is_signed(MimeInfo *mimeinfo) -{ - GSList *cur; - cm_return_val_if_fail(mimeinfo != NULL, FALSE); - - if (mimeinfo->privacy != NULL) { - PrivacySystem *system = - privacy_data_get_system(mimeinfo->privacy); - - if (system == NULL) { - mimeinfo->privacy = NULL; - goto try_others; - } - - if (system->is_signed != NULL) - return system->is_signed(mimeinfo); - else - return FALSE; - } -try_others: - for(cur = systems; cur != NULL; cur = g_slist_next(cur)) { - PrivacySystem *system = (PrivacySystem *) cur->data; - - if(system->is_signed != NULL && system->is_signed(mimeinfo)) - return TRUE; - } - - return FALSE; -} - -struct SignedState { - MsgInfo *msginfo; - gchar **system; -}; - -static void msginfo_set_signed_flag(GNode *node, gpointer data) -{ - struct SignedState *sstate = (struct SignedState *)data; - MsgInfo *msginfo = sstate->msginfo; - MimeInfo *mimeinfo = node->data; - - if (privacy_mimeinfo_is_signed(mimeinfo)) { - procmsg_msginfo_set_flags(msginfo, 0, MSG_SIGNED); - if (sstate->system && !*(sstate->system) && mimeinfo->privacy) - *(sstate->system) = g_strdup(mimeinfo->privacy->system->id); - } - if (privacy_mimeinfo_is_encrypted(mimeinfo)) { - procmsg_msginfo_set_flags(msginfo, 0, MSG_ENCRYPTED); - if (sstate->system && !*(sstate->system) && mimeinfo->privacy) - *(sstate->system) = g_strdup(mimeinfo->privacy->system->id); - } else { - /* searching inside encrypted parts doesn't really make sense */ - g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_signed_flag, sstate); - } -} - -void privacy_msginfo_get_signed_state(MsgInfo *msginfo, gchar **system) -{ - struct SignedState sstate; - MimeInfo *mimeinfo = procmime_scan_message(msginfo); - if (!mimeinfo) - return; - sstate.msginfo = msginfo; - sstate.system = system; - g_node_children_foreach(mimeinfo->node, G_TRAVERSE_ALL, msginfo_set_signed_flag, &sstate); -} - -/** - * Check the signature of a MimeInfo. privacy_mimeinfo_is_signed - * should be called before otherwise it is done by this function. - * If the MimeInfo is not signed an error code will be returned. - * - * \return Error code indicating the result of the check, - * < 0 if an error occurred - */ -gint privacy_mimeinfo_check_signature(MimeInfo *mimeinfo, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - PrivacySystem *system; - - if (mimeinfo == NULL) - g_error("siginfo was NULL"); - - if (mimeinfo->privacy == NULL) { - g_warning("mimeinfo->privacy was NULL"); - - privacy_mimeinfo_is_signed(mimeinfo); - if (mimeinfo->privacy == NULL) { - g_error("failed to set up PrivacyData"); - } - } - - system = privacy_data_get_system(mimeinfo->privacy); - if (system == NULL) - g_error("failed to get privacy system"); - else if (system->check_signature == NULL) - g_error("didn't find check_signature function"); - - return system->check_signature(mimeinfo, cancellable, callback, user_data); -} - -SignatureStatus privacy_mimeinfo_get_sig_status(MimeInfo *mimeinfo) -{ - PrivacySystem *system; - - cm_return_val_if_fail(mimeinfo != NULL, -1); - - if (mimeinfo->privacy == NULL) { - privacy_mimeinfo_is_signed(mimeinfo); - - if (mimeinfo->privacy == NULL) - return SIGNATURE_UNCHECKED; - } - - system = privacy_data_get_system(mimeinfo->privacy); - if (system == NULL) - return SIGNATURE_UNCHECKED; - - if (mimeinfo->sig_data == NULL) - return SIGNATURE_UNCHECKED; - else - return mimeinfo->sig_data->status; -} - -gchar *privacy_mimeinfo_get_sig_info(MimeInfo *mimeinfo, gboolean full) -{ - PrivacySystem *system; - gchar *info; - - cm_return_val_if_fail(mimeinfo != NULL, NULL); - - if (mimeinfo->privacy == NULL) { - privacy_mimeinfo_is_signed(mimeinfo); - - if (mimeinfo->privacy == NULL) - return _("No signature found"); - } - - system = privacy_data_get_system(mimeinfo->privacy); - if (system == NULL) - return _("No signature found"); - - if (mimeinfo->sig_data == NULL) - return _("No information available"); - - info = full ? mimeinfo->sig_data->info_full : mimeinfo->sig_data->info_short; - if (info == NULL) - return _("No information available"); - - return info; -} - -gboolean privacy_mimeinfo_is_encrypted(MimeInfo *mimeinfo) -{ - GSList *cur; - cm_return_val_if_fail(mimeinfo != NULL, FALSE); - - for(cur = systems; cur != NULL; cur = g_slist_next(cur)) { - PrivacySystem *system = (PrivacySystem *) cur->data; - - if(system->is_encrypted != NULL && system->is_encrypted(mimeinfo)) - return TRUE; - } - - return FALSE; -} - -static gint decrypt(MimeInfo *mimeinfo, PrivacySystem *system) -{ - MimeInfo *decryptedinfo, *parentinfo; - gint childnumber; - - cm_return_val_if_fail(system->decrypt != NULL, -1); - - decryptedinfo = system->decrypt(mimeinfo); - if (decryptedinfo == NULL) - return -1; - - parentinfo = procmime_mimeinfo_parent(mimeinfo); - if (parentinfo == NULL) - return -1; - - childnumber = g_node_child_index(parentinfo->node, mimeinfo); - - procmime_mimeinfo_free_all(&mimeinfo); - - g_node_insert(parentinfo->node, childnumber, decryptedinfo->node); - - return 0; -} - -gint privacy_mimeinfo_decrypt(MimeInfo *mimeinfo) -{ - GSList *cur; - cm_return_val_if_fail(mimeinfo != NULL, FALSE); - - procmime_decode_content(mimeinfo); - - for(cur = systems; cur != NULL; cur = g_slist_next(cur)) { - PrivacySystem *system = (PrivacySystem *) cur->data; - - if(system->is_encrypted != NULL && system->is_encrypted(mimeinfo)) - return decrypt(mimeinfo, system); - } - - return -1; -} - -GSList *privacy_get_system_ids() -{ - GSList *cur; - GSList *ret = NULL; - - for(cur = systems; cur != NULL; cur = g_slist_next(cur)) { - PrivacySystem *system = (PrivacySystem *) cur->data; - - ret = g_slist_append(ret, g_strdup(system->id)); - } - - return ret; -} - -static PrivacySystem *privacy_get_system(const gchar *id) -{ - GSList *cur; - - cm_return_val_if_fail(id != NULL, NULL); - - for(cur = systems; cur != NULL; cur = g_slist_next(cur)) { - PrivacySystem *system = (PrivacySystem *) cur->data; - - if(strcmp(id, system->id) == 0) - return system; - } - - return NULL; -} - -const gchar *privacy_system_get_name(const gchar *id) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, NULL); - - system = privacy_get_system(id); - if (system == NULL) - return NULL; - - return system->name; -} - -gboolean privacy_system_can_sign(const gchar *id) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, FALSE); - - system = privacy_get_system(id); - if (system == NULL) - return FALSE; - - return system->can_sign; -} - -gboolean privacy_system_can_encrypt(const gchar *id) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, FALSE); - - system = privacy_get_system(id); - if (system == NULL) - return FALSE; - - return system->can_encrypt; -} - -gboolean privacy_sign(const gchar *id, MimeInfo *target, PrefsAccount *account, const gchar *from_addr) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, FALSE); - cm_return_val_if_fail(target != NULL, FALSE); - - system = privacy_get_system(id); - if (system == NULL) - return FALSE; - if (!system->can_sign) - return FALSE; - if (system->sign == NULL) - return FALSE; - - return system->sign(target, account, from_addr); -} - -gchar *privacy_get_encrypt_data(const gchar *id, GSList *recp_names) -{ - PrivacySystem *system; - gchar *ret = NULL; - GSList *uniq_names = NULL, *cur; - - cm_return_val_if_fail(id != NULL, NULL); - cm_return_val_if_fail(recp_names != NULL, NULL); - - system = privacy_get_system(id); - if (system == NULL) - return NULL; - if (!system->can_encrypt) - return NULL; - if (system->get_encrypt_data == NULL) - return NULL; - - for (cur = recp_names; cur; cur = cur->next) { - if (!g_slist_find_custom(uniq_names, cur->data, (GCompareFunc)strcmp)) { - uniq_names = g_slist_prepend(uniq_names, cur->data); - } - } - ret = system->get_encrypt_data(uniq_names); - - g_slist_free(uniq_names); - return ret; -} - -const gchar *privacy_get_encrypt_warning(const gchar *id) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, NULL); - - system = privacy_get_system(id); - if (system == NULL) - return NULL; - if (!system->can_encrypt) - return NULL; - if (system->get_encrypt_warning == NULL) - return NULL; - - return system->get_encrypt_warning(); -} - -void privacy_inhibit_encrypt_warning(const gchar *id, gboolean inhibit) -{ - PrivacySystem *system; - - cm_return_if_fail(id != NULL); - - system = privacy_get_system(id); - if (system == NULL) - return; - if (!system->can_encrypt) - return; - if (system->inhibit_encrypt_warning == NULL) - return; - - system->inhibit_encrypt_warning(inhibit); -} - -gboolean privacy_encrypt(const gchar *id, MimeInfo *mimeinfo, const gchar *encdata) -{ - PrivacySystem *system; - - cm_return_val_if_fail(id != NULL, FALSE); - cm_return_val_if_fail(mimeinfo != NULL, FALSE); - if (encdata == NULL) { - privacy_set_error(_("No recipient keys defined.")); - return FALSE; - } - - system = privacy_get_system(id); - if (system == NULL) - return FALSE; - if (!system->can_encrypt) - return FALSE; - if (system->encrypt == NULL) - return FALSE; - - return system->encrypt(mimeinfo, encdata); -} - -gboolean privacy_auto_check_signatures(MimeInfo *mimeinfo) -{ - PrivacySystem *system; - - cm_return_val_if_fail(mimeinfo != NULL, FALSE); - - if (mimeinfo->privacy == NULL) - privacy_mimeinfo_is_signed(mimeinfo); - - if (mimeinfo->privacy == NULL) - return FALSE; - - system = privacy_data_get_system(mimeinfo->privacy); - if (system == NULL) - return FALSE; - if (system->auto_check_signatures == NULL) - return FALSE; - - return system->auto_check_signatures(); -} blob - afe168ef00edaf09a2fd1e5788aebc6d1d9bfd5c (mode 644) blob + /dev/null --- src/privacy.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef PRIVACY_H -#define PRIVACY_H - -typedef struct _PrivacySystem PrivacySystem; -typedef struct _PrivacyData PrivacyData; - -typedef enum { - SIGNATURE_UNCHECKED, - SIGNATURE_OK, - SIGNATURE_WARN, - SIGNATURE_KEY_EXPIRED, - SIGNATURE_INVALID, - SIGNATURE_CHECK_FAILED, - SIGNATURE_CHECK_TIMEOUT, - SIGNATURE_CHECK_ERROR -} SignatureStatus; - -typedef struct _SignatureData { - SignatureStatus status; - gchar *info_short; - gchar *info_full; -} SignatureData; - -typedef struct _SigCheckTaskResult { - SignatureData *sig_data; - struct _MimeInfo *newinfo; -} SigCheckTaskResult; - -#include - -#include "procmime.h" -#include "prefs_account.h" - -void privacy_register_system (PrivacySystem *system); -void privacy_unregister_system (PrivacySystem *system); - -void privacy_free_privacydata (PrivacyData *); -void privacy_free_signature_data (SignatureData *sig_data); -void privacy_free_sig_check_task_result (gpointer); - -void privacy_msginfo_get_signed_state (MsgInfo *, gchar **system); -gboolean privacy_mimeinfo_is_signed (MimeInfo *); -gint privacy_mimeinfo_check_signature (MimeInfo *mimeinfo, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -SignatureStatus privacy_mimeinfo_get_sig_status (MimeInfo *); -gchar *privacy_mimeinfo_get_sig_info (MimeInfo *, gboolean); - -gboolean privacy_mimeinfo_is_encrypted (MimeInfo *); -gint privacy_mimeinfo_decrypt (MimeInfo *); - -GSList *privacy_get_system_ids (); -const gchar *privacy_system_get_name (const gchar *); -gboolean privacy_system_can_sign (const gchar *); -gboolean privacy_system_can_encrypt (const gchar *); - -gboolean privacy_sign (const gchar *system, - MimeInfo *mimeinfo, - PrefsAccount *account, - const gchar *from_addr); -gchar *privacy_get_encrypt_data (const gchar *system, - GSList *recp_names); -const gchar *privacy_get_encrypt_warning (const gchar *system); -gboolean privacy_encrypt (const gchar *system, - MimeInfo *mimeinfo, - const gchar *encdata); - -void privacy_set_error (const gchar *format, ...) G_GNUC_PRINTF(1, 2); -void privacy_reset_error (void); -gboolean privacy_peek_error (void); -const gchar *privacy_get_error (void); - -struct _PrivacySystem { - /** Identifier for the PrivacySystem that can use in config files */ - gchar *id; - /** Human readable name for the PrivacySystem for the user interface */ - gchar *name; - - void (*free_privacydata) (PrivacyData *data); - - gboolean (*is_signed) (MimeInfo *mimeinfo); - gint (*check_signature) (MimeInfo *mimeinfo, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - - gboolean (*is_encrypted) (MimeInfo *mimeinfo); - MimeInfo *(*decrypt) (MimeInfo *mimeinfo); - - gboolean can_sign; - gboolean (*sign) (MimeInfo *mimeinfo, - PrefsAccount *account, - const gchar *from_addr); - - gboolean can_encrypt; - gchar *(*get_encrypt_data) (GSList *recp_names); - gboolean (*encrypt) (MimeInfo *mimeinfo, - const gchar *encrypt_data); - const gchar *(*get_encrypt_warning) (void); - void (*inhibit_encrypt_warning) (gboolean inhibit); - gboolean (*auto_check_signatures)(void); -}; - -struct _PrivacyData { - PrivacySystem *system; -}; - -void privacy_inhibit_encrypt_warning (const gchar *id, - gboolean inhibit); -gboolean privacy_auto_check_signatures(MimeInfo *mimeinfo); - -#endif /* PRIVACY_H */ blob - 5b90ad6c2f30e636e5e30c6762ee157b7d56038c blob + 4f3098ef8509b3259ebbbff28289f6fcda79a7bd --- src/procheader.c +++ src/procheader.c @@ -539,22 +539,6 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags fl return parse_stream(fp, FALSE, flags, full, decrypted); } -static gboolean avatar_from_some_face(gpointer source, gpointer userdata) -{ - AvatarCaptureData *acd = (AvatarCaptureData *)source; - - if (*(acd->content) == '\0') /* won't be null, but may be empty */ - return FALSE; - - if (!strcmp(acd->header, hentry_full[H_FACE].name)) { - debug_print("avatar_from_some_face: found 'Face' header\n"); - procmsg_msginfo_add_avatar(acd->msginfo, AVATAR_FACE, acd->content); - } - return FALSE; -} - -static gulong avatar_hook_id = HOOK_NONE; - static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, gboolean full, gboolean decrypted) { @@ -609,16 +593,6 @@ static MsgInfo *parse_stream(void *data, gboolean isst msginfo->inreplyto = NULL; - if (avatar_hook_id == HOOK_NONE && - (prefs_common.enable_avatars & (AVATARS_ENABLE_CAPTURE | AVATARS_ENABLE_RENDER))) { - avatar_hook_id = hooks_register_hook(AVATAR_HEADER_UPDATE_HOOKLIST, - avatar_from_some_face, NULL); - } else if (avatar_hook_id != HOOK_NONE && - !(prefs_common.enable_avatars & AVATARS_ENABLE_CAPTURE)) { - hooks_unregister_hook(AVATAR_HEADER_UPDATE_HOOKLIST, avatar_hook_id); - avatar_hook_id = HOOK_NONE; - } - while ((hnum = get_one_field(&buf, data, hentry)) != -1) { hp = buf + strlen(hentry[hnum].name); while (*hp == ' ' || *hp == '\t') hp++; @@ -1278,16 +1252,10 @@ gboolean procheader_header_is_internal(const gchar *hd "PT:", "S:", "RQ:", "SSV:", "NSV:", "SSH:", "R:", "MAID:", "SCF:", "RRCPT:", "RMID:", "FMID:", "NAID:", "X-Claws-Account-Id:", - "X-Claws-Sign:", - "X-Claws-Encrypt:", - "X-Claws-Privacy-System:", "X-Claws-Auto-Wrapping:", "X-Claws-Auto-Indent:", "X-Claws-End-Special-Headers:", "X-Sylpheed-Account-Id:", - "X-Sylpheed-Sign:", - "X-Sylpheed-Encrypt:", - "X-Sylpheed-Privacy-System:", "X-Sylpheed-End-Special-Headers:", NULL }; blob - 8c986a8c7b2bb9a500988114c2b73b0cddd7087f blob + c4bbadf945aa8eab72922dd4b41bc15d4ba843fb --- src/procmime.c +++ src/procmime.c @@ -39,7 +39,6 @@ #include "prefs_common.h" #include "prefs_gtk.h" #include "alertpanel.h" -#include "privacy.h" #include "account.h" #include "file-utils.h" @@ -125,12 +124,6 @@ static gboolean free_func(GNode *node, gpointer data) procmime_mimeinfo_parameters_destroy, NULL); g_hash_table_destroy(mimeinfo->dispositionparameters); - if (mimeinfo->privacy) - privacy_free_privacydata(mimeinfo->privacy); - - if (mimeinfo->sig_data) - privacy_free_signature_data(mimeinfo->sig_data); - g_free(mimeinfo); return FALSE; @@ -881,87 +874,6 @@ scan_again: return outfp; } - -static gboolean find_encrypted_func(GNode *node, gpointer data) -{ - MimeInfo *mimeinfo = (MimeInfo *) node->data; - MimeInfo **encinfo = (MimeInfo **) data; - - if (privacy_mimeinfo_is_encrypted(mimeinfo)) { - *encinfo = mimeinfo; - return TRUE; - } - - return FALSE; -} - -static MimeInfo *find_encrypted_part(MimeInfo *rootinfo) -{ - MimeInfo *encinfo = NULL; - - g_node_traverse(rootinfo->node, G_IN_ORDER, G_TRAVERSE_ALL, -1, - find_encrypted_func, &encinfo); - - return encinfo; -} - -/* search the first encrypted text part of (multipart) MIME message, - decode, convert it and output to outfp. */ -FILE *procmime_get_first_encrypted_text_content(MsgInfo *msginfo) -{ - FILE *outfp = NULL; - MimeInfo *mimeinfo, *partinfo, *encinfo; - - cm_return_val_if_fail(msginfo != NULL, NULL); - - mimeinfo = procmime_scan_message(msginfo); - if (!mimeinfo) { - return NULL; - } - - partinfo = mimeinfo; - if ((encinfo = find_encrypted_part(partinfo)) != NULL) { - debug_print("decrypting message part\n"); - if (privacy_mimeinfo_decrypt(encinfo) < 0) { - alertpanel_error(_("Couldn't decrypt: %s"), - privacy_get_error()); - return NULL; - } - } - partinfo = mimeinfo; - while (partinfo && partinfo->type != MIMETYPE_TEXT) { - partinfo = procmime_mimeinfo_next(partinfo); - if (privacy_mimeinfo_is_signed(partinfo)) - procmsg_msginfo_set_flags(msginfo, 0, MSG_SIGNED); - } - - if (partinfo) - outfp = procmime_get_text_content(partinfo); - - procmime_mimeinfo_free_all(&mimeinfo); - - return outfp; -} - -gboolean procmime_msginfo_is_encrypted(MsgInfo *msginfo) -{ - MimeInfo *mimeinfo, *partinfo; - gboolean result = FALSE; - - cm_return_val_if_fail(msginfo != NULL, FALSE); - - mimeinfo = procmime_scan_message(msginfo); - if (!mimeinfo) { - return FALSE; - } - - partinfo = mimeinfo; - result = (find_encrypted_part(partinfo) != NULL); - procmime_mimeinfo_free_all(&mimeinfo); - - return result; -} - gchar *procmime_get_tmp_file_name(MimeInfo *mimeinfo) { static guint32 id = 0; blob - 97393833f2d852f83ae0624b93f17d13ed4cf9f8 blob + bf8a997c149689d791b691de9cd9a1d23f994028 --- src/procmime.h +++ src/procmime.h @@ -25,7 +25,7 @@ #include "utils.h" #include "proctypes.h" -#include "privacy.h" + typedef enum { ENC_7BIT, @@ -69,8 +69,6 @@ typedef enum #include #include -struct _PrivacyData; - struct _MimeType { gchar *type; @@ -120,7 +118,6 @@ struct _MimeInfo GNode *node; - /* --- NEW MIME STUFF --- */ /* Content-Type */ MimeMediaType type; gchar *subtype; @@ -146,11 +143,6 @@ struct _MimeInfo DispositionType disposition; GHashTable *dispositionparameters; - /* Privacy */ - struct _PrivacyData *privacy; - GTask *last_sig_check_task; - SignatureData *sig_data; - gboolean broken; }; @@ -195,8 +187,6 @@ gboolean procmime_encode_content (MimeInfo *mimeinfo, gint procmime_get_part (const gchar *outfile, MimeInfo *mimeinfo); FILE *procmime_get_first_text_content (MsgInfo *msginfo); -FILE *procmime_get_first_encrypted_text_content - (MsgInfo *msginfo); gchar *procmime_get_tmp_file_name (MimeInfo *mimeinfo); gchar *procmime_get_part_file_name (MimeInfo *mimeinfo); @@ -217,7 +207,7 @@ gchar *procmime_get_content_type_str (MimeMediaType const gchar *subtype); void procmime_force_charset (const gchar *str); void procmime_force_encoding (EncodingType encoding); -gboolean procmime_msginfo_is_encrypted (MsgInfo *msginfo); + int procmime_write_mime_header (MimeInfo *mimeinfo, FILE *fp); void renderer_read_config(void); blob - 663f1dd2a2fb3fbaef5a67588f74bea5734ad191 blob + 192eff678ce66e93a85441860a72059a88144214 --- src/procmsg.c +++ src/procmsg.c @@ -46,7 +46,6 @@ #include "summaryview.h" #include "log.h" #include "inc.h" -#include "privacy.h" #include "file-utils.h" static gint procmsg_send_message_queue_full(const gchar *file, gboolean keep_session, gchar **errstr, @@ -600,13 +599,7 @@ static PrefsAccount *procmsg_get_account_from_file(con {"SCF:", NULL, FALSE}, {"RMID:", NULL, FALSE}, {"FMID:", NULL, FALSE}, - {"X-Claws-Privacy-System:", NULL, FALSE}, - {"X-Claws-Encrypt:", NULL, FALSE}, - {"X-Claws-Encrypt-Data:", NULL, FALSE}, {"X-Claws-End-Special-Headers", NULL, FALSE}, - {"X-Sylpheed-Privacy-System:", NULL, FALSE}, - {"X-Sylpheed-Encrypt:", NULL, FALSE}, - {"X-Sylpheed-Encrypt-Data:", NULL, FALSE}, {NULL, NULL, FALSE}}; cm_return_val_if_fail(file != NULL, NULL); @@ -632,36 +625,6 @@ static PrefsAccount *procmsg_get_account_from_file(con return mailac; } -gchar *procmsg_msginfo_get_avatar(MsgInfo *msginfo, gint type) -{ - GSList *mia; - - if (!msginfo || !msginfo->extradata || !msginfo->extradata->avatars) - return NULL; - - for (mia = msginfo->extradata->avatars; mia; mia = mia->next) { - MsgInfoAvatar *avatar = (MsgInfoAvatar *)mia->data; - if (avatar->avatar_id == type) - return avatar->avatar_src; - } - - return NULL; -} - -void procmsg_msginfo_add_avatar(MsgInfo *msginfo, gint type, const gchar *data) -{ - MsgInfoAvatar *av; - - if (!msginfo->extradata) - msginfo->extradata = g_new0(MsgInfoExtraData, 1); - - av = g_new0(MsgInfoAvatar, 1); - av->avatar_id = type; - av->avatar_src = g_strdup(data); - - msginfo->extradata->avatars = g_slist_append(msginfo->extradata->avatars, av); -} - gchar *procmsg_msginfo_get_identifier(MsgInfo *msginfo) { gchar *folder_id; @@ -1031,28 +994,6 @@ MsgInfo *procmsg_msginfo_new(void) return newmsginfo; } -static MsgInfoAvatar *procmsg_msginfoavatar_copy(MsgInfoAvatar *avatar) -{ - MsgInfoAvatar *newavatar; - - if (avatar == NULL) return NULL; - - newavatar = g_new0(MsgInfoAvatar, 1); - newavatar->avatar_id = avatar->avatar_id; - newavatar->avatar_src = g_strdup(avatar->avatar_src); - - return newavatar; -} - -static void procmsg_msginfoavatar_free(MsgInfoAvatar *avatar) -{ - if (avatar != NULL) { - if (avatar->avatar_src != NULL) - g_free(avatar->avatar_src); - g_free(avatar); - } -} - MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo) { MsgInfo *newmsginfo; @@ -1091,10 +1032,6 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo) if (msginfo->extradata) { newmsginfo->extradata = g_new0(MsgInfoExtraData, 1); - if (msginfo->extradata->avatars) { - newmsginfo->extradata->avatars = g_slist_copy_deep(msginfo->extradata->avatars, - (GCopyFunc) procmsg_msginfoavatar_copy, NULL); - } MEMBDUP(extradata->dispositionnotificationto); MEMBDUP(extradata->returnreceiptto); MEMBDUP(extradata->partial_recv); @@ -1154,9 +1091,6 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file(MsgIn msginfo->extradata->list_archive= g_strdup(full_msginfo->extradata->list_archive); if (!msginfo->extradata->list_owner) msginfo->extradata->list_owner = g_strdup(full_msginfo->extradata->list_owner); - if (!msginfo->extradata->avatars) - msginfo->extradata->avatars = g_slist_copy_deep(full_msginfo->extradata->avatars, - (GCopyFunc) procmsg_msginfoavatar_copy, NULL); if (!msginfo->extradata->dispositionnotificationto) msginfo->extradata->dispositionnotificationto = g_strdup(full_msginfo->extradata->dispositionnotificationto); @@ -1232,13 +1166,6 @@ void procmsg_msginfo_free(MsgInfo **msginfo_ptr) FREENULL(msginfo->xref); if (msginfo->extradata) { - if (msginfo->extradata->avatars) { - g_slist_foreach(msginfo->extradata->avatars, - (GFunc)procmsg_msginfoavatar_free, - NULL); - g_slist_free(msginfo->extradata->avatars); - msginfo->extradata->avatars = NULL; - } FREENULL(msginfo->extradata->returnreceiptto); FREENULL(msginfo->extradata->dispositionnotificationto); FREENULL(msginfo->extradata->list_post); @@ -1300,13 +1227,6 @@ guint procmsg_msginfo_memusage(MsgInfo *msginfo) } if (msginfo->extradata) { memusage += sizeof(MsgInfoExtraData); - if (msginfo->extradata->avatars) { - for (tmp = msginfo->extradata->avatars; tmp; tmp = tmp->next) { - MsgInfoAvatar *avt = (MsgInfoAvatar *)tmp->data; - memusage += (avt->avatar_src)? strlen(avt->avatar_src): 0; - memusage += sizeof(MsgInfoAvatar) + sizeof(GSList); - } - } if (msginfo->extradata->dispositionnotificationto) memusage += strlen(msginfo->extradata->dispositionnotificationto); if (msginfo->extradata->returnreceiptto) @@ -1350,13 +1270,7 @@ static gint procmsg_send_message_queue_full(const gcha {"SCF:", NULL, FALSE}, {"RMID:", NULL, FALSE}, {"FMID:", NULL, FALSE}, - {"X-Claws-Privacy-System:", NULL, FALSE}, - {"X-Claws-Encrypt:", NULL, FALSE}, /* 10 */ - {"X-Claws-Encrypt-Data:", NULL, FALSE}, {"X-Claws-End-Special-Headers:", NULL, FALSE}, - {"X-Sylpheed-Privacy-System:", NULL, FALSE}, - {"X-Sylpheed-Encrypt:", NULL, FALSE}, - {"X-Sylpheed-Encrypt-Data:", NULL, FALSE}, /* 15 */ {"X-Sylpheed-End-Special-Headers:", NULL, FALSE}, {NULL, NULL, FALSE}}; FILE *fp; @@ -1371,7 +1285,6 @@ static gint procmsg_send_message_queue_full(const gcha gchar *buf; gint hnum; PrefsAccount *mailac = NULL; - gboolean encrypt = FALSE; FolderItem *outbox; cm_return_val_if_fail(file != NULL, -1); @@ -1415,11 +1328,6 @@ static gint procmsg_send_message_queue_full(const gcha if (fwdmessageid == NULL) fwdmessageid = g_strdup(p); break; - case Q_ENCRYPT: - case Q_ENCRYPT_OLD: - if (p[0] == '1') - encrypt = TRUE; - break; case Q_CLAWS_HDRS: case Q_CLAWS_HDRS_OLD: /* end of special headers reached */ @@ -1503,40 +1411,36 @@ send_mail: /* save message to outbox */ if (mailval == 0 && savecopyfolder) { debug_print("saving sent message to %s...\n", savecopyfolder); - - if (!encrypt || !mailac->save_encrypted_as_clear_text) { - outbox = folder_find_item_from_identifier(savecopyfolder); - if (!outbox) { - gchar *id; - outbox = folder_get_default_outbox(); - if (outbox != NULL) { - id = folder_item_get_identifier(outbox); - debug_print("%s not found, using %s\n", savecopyfolder, id); - g_free(id); - } else { - debug_print("could not find outbox\n"); - } + outbox = folder_find_item_from_identifier(savecopyfolder); + if (!outbox) { + gchar *id; + outbox = folder_get_default_outbox(); + if (outbox != NULL) { + id = folder_item_get_identifier(outbox); + debug_print("%s not found, using %s\n", savecopyfolder, id); + g_free(id); + } else { + debug_print("could not find outbox\n"); } - /* Mail was not saved to outbox before encrypting, save it now. */ - gboolean saved = FALSE; - *queued_removed = FALSE; - if (queue && msgnum > 0) { - MsgInfo *queued_mail = folder_item_get_msginfo(queue, msgnum); - if (folder_item_move_msg(outbox, queued_mail) >= 0) { - debug_print("moved queued mail %d to sent folder\n", msgnum); - saved = TRUE; - *queued_removed = TRUE; - } else if (folder_item_copy_msg(outbox, queued_mail) >= 0) { - debug_print("copied queued mail %d to sent folder\n", msgnum); - saved = TRUE; - } - procmsg_msginfo_free(&queued_mail); + } + gboolean saved = FALSE; + *queued_removed = FALSE; + if (queue && msgnum > 0) { + MsgInfo *queued_mail = folder_item_get_msginfo(queue, msgnum); + if (folder_item_move_msg(outbox, queued_mail) >= 0) { + debug_print("moved queued mail %d to sent folder\n", msgnum); + saved = TRUE; + *queued_removed = TRUE; + } else if (folder_item_copy_msg(outbox, queued_mail) >= 0) { + debug_print("copied queued mail %d to sent folder\n", msgnum); + saved = TRUE; } - if (!saved) { - debug_print("resaving queued mail to sent folder\n"); - procmsg_save_to_outbox(outbox, file); - } + procmsg_msginfo_free(&queued_mail); } + if (!saved) { + debug_print("resaving queued mail to sent folder\n"); + procmsg_save_to_outbox(outbox, file); + } } if (replymessageid != NULL || fwdmessageid != NULL) { blob - dcb5581070469d1c90b24ac2a162bf6bfdaa6d09 blob + 1dbb8d58f7f8d2279a1cf4c67df6fe620f58b99e --- src/procmsg.h +++ src/procmsg.h @@ -213,9 +213,10 @@ struct _MsgInfo gint score; /* used only for encrypted messages */ - gchar *plaintext_file; + // TODO(otl): really? + char *plaintext_file; - gint hidden; + gint hidden; /* used only for partially received messages */ gint total_size; @@ -250,12 +251,6 @@ struct _MsgInfoExtraData gchar *list_owner; }; -struct _MsgInfoAvatar -{ - gint avatar_id; - gchar *avatar_src; -}; - struct _MsgFileInfo { MsgInfo *msginfo; @@ -368,6 +363,4 @@ void procmsg_msginfo_commit_tags(GSList *msglist); MsgInfo *procmsg_get_msginfo_from_identifier(const gchar *id); gchar *procmsg_msginfo_get_identifier(MsgInfo *msginfo); -gchar *procmsg_msginfo_get_avatar(MsgInfo *msginfo, gint type); -void procmsg_msginfo_add_avatar(MsgInfo *msginfo, gint type, const gchar *data); #endif /* __PROCMSG_H__ */ blob - 8ba8f709f94ef81194373b978abd6b4b5d4cf20c blob + 356a4a733d3ebd347ca2255e21b3107ea61756f6 --- src/proctypes.h +++ src/proctypes.h @@ -43,9 +43,6 @@ typedef struct _AvatarCaptureData AvatarCaptureData; struct _MsgInfoExtraData; typedef struct _MsgInfoExtraData MsgInfoExtraData; -struct _MsgInfoAvatar; -typedef struct _MsgInfoAvatar MsgInfoAvatar; - typedef GSList MsgInfoList; typedef GSList MsgNumberList; blob - 5f6f15bfbebeb3ecbf2a71caaefacd07c1910460 blob + 2178b3267aa30592c424a826b7a57dec78f9adfe --- src/toolbar.c +++ src/toolbar.c @@ -1706,48 +1706,6 @@ static void toolbar_linewrap_all_cb(GtkWidget *widget, compose_toolbar_cb(A_LINEWRAP_ALL, data); } -static void toolbar_privacy_sign_cb(GtkWidget *widget, gpointer data) -{ - ToolbarItem *toolbar_item = (ToolbarItem*)data; - Compose *compose = (Compose *)toolbar_item->parent; - gboolean state = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget)); - - cm_return_if_fail(compose != NULL); - compose_use_signing(compose, state); -} - -/* Any time the toggle button gets toggled, we want to update its tooltip. */ -static void toolbar_privacy_sign_toggled_cb(GtkWidget *widget, gpointer data) -{ - gboolean state = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget)); - - if (state) - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Message will be signed")); - else - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Message will not be signed")); -} - -static void toolbar_privacy_encrypt_cb(GtkWidget *widget, gpointer data) -{ - ToolbarItem *toolbar_item = (ToolbarItem*)data; - Compose *compose = (Compose *)toolbar_item->parent; - gboolean state = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget)); - - cm_return_if_fail(compose != NULL); - compose_use_encryption(compose, state); -} - -/* Any time the toggle button gets toggled, we want to update its tooltip. */ -static void toolbar_privacy_encrypt_toggled_cb(GtkWidget *widget, gpointer data) -{ - gboolean state = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget)); - - if (state) - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Message will be encrypted")); - else - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Message will not be encrypted")); -} - /* * Execute actions from toolbar */ @@ -1880,8 +1838,6 @@ static void toolbar_buttons_cb(GtkWidget *widget, { A_LINEWRAP_CURRENT, toolbar_linewrap_current_cb }, { A_LINEWRAP_ALL, toolbar_linewrap_all_cb }, { A_ADDRBOOK, toolbar_addrbook_cb }, - { A_PRIVACY_SIGN, toolbar_privacy_sign_cb }, - { A_PRIVACY_ENCRYPT, toolbar_privacy_encrypt_cb }, { A_CLAWS_ACTIONS, toolbar_actions_execute_cb }, { A_CANCEL_INC, toolbar_cancel_inc_cb }, { A_CANCEL_SEND, toolbar_cancel_send_cb }, @@ -2197,23 +2153,6 @@ Toolbar *toolbar_create(ToolbarType type, TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Address book")); toolbar_data->addrbook_btn = item; break; - case A_PRIVACY_SIGN: - TOOLBAR_TOGGLE_ITEM(item,icon_wid,toolbar_item->text,_("Sign")); - g_signal_connect (G_OBJECT(item), "toggled", - G_CALLBACK(toolbar_privacy_sign_toggled_cb), NULL); - /* Call the "toggled" handler to set correct tooltip. */ - toolbar_privacy_sign_toggled_cb(item, NULL); - toolbar_data->privacy_sign_btn = item; - break; - case A_PRIVACY_ENCRYPT: - TOOLBAR_TOGGLE_ITEM(item,icon_wid,toolbar_item->text,_("Encrypt")); - g_signal_connect (G_OBJECT(item), "toggled", - G_CALLBACK(toolbar_privacy_encrypt_toggled_cb), NULL); - /* Call the "toggled" handler to set correct tooltip. */ - toolbar_privacy_encrypt_toggled_cb(item, NULL); - toolbar_data->privacy_encrypt_btn = item; - break; - case A_CLAWS_ACTIONS: TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,toolbar_item->text); action_item = g_new0(ToolbarClawsActions, 1); @@ -2581,9 +2520,6 @@ static void toolbar_init(Toolbar * toolbar) toolbar->action_list = NULL; toolbar->item_list = NULL; - toolbar->privacy_sign_btn = NULL; - toolbar->privacy_encrypt_btn = NULL; - toolbar_destroy(toolbar); } blob - 3e5dadc0919c8a8f9546abed7c23065e9cba9f02 blob + 8d19458e8316018c0d955fa1be097b995dc0f7b0 --- src/toolbar.h +++ src/toolbar.h @@ -93,9 +93,6 @@ struct _Toolbar { GSList *action_list; GSList *item_list; - - GtkWidget *privacy_sign_btn; - GtkWidget *privacy_encrypt_btn; }; struct _ToolbarItem {