From c8e9242de36d7aa6e3bb2e446f57ef2a14e4c889 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 5 Apr 2007 23:13:36 +0200 Subject: [PATCH] Drop useless functions with gpgme (auto import is a gpg capability already). also drop the send-key function, it's rather useless, and can be provided as a third party script (or at least will be possible in the future fore sure). Signed-off-by: Pierre Habouzit --- OPS | 1 - commands.c | 12 +----------- compose.c | 25 ------------------------- copy.c | 6 +++--- crypt.c | 23 ----------------------- crypt.h | 6 ------ functions.def | 4 ---- lib-ui/curs_main.c | 7 ------- mutt.h | 5 ++--- pager.c | 8 -------- postpone.c | 4 ++-- recvattach.c | 3 --- send.c | 25 +++++++------------------ 13 files changed, 15 insertions(+), 114 deletions(-) diff --git a/OPS b/OPS index cacf0c5..d8e4db6 100644 --- a/OPS +++ b/OPS @@ -204,7 +204,6 @@ OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail" OP_SIDEBAR_PREV "go to previous mailbox" OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail" OP_SIDEBAR_OPEN "open hilighted mailbox" -OP_COMPOSE_ATTACH_KEY "attach a PGP public key" OP_COMPOSE_PGP_MENU "show PGP options" OP_MAIL_KEY "mail a PGP public key" OP_VERIFY_KEY "verify a PGP public key" diff --git a/commands.c b/commands.c index 4e810c9..cf56023 100644 --- a/commands.c +++ b/commands.c @@ -91,8 +91,6 @@ int mutt_display_message (HEADER * cur) /* see if crytpo is needed for this message. if so, we should exit curses */ if (cur->security) { if (cur->security & ENCRYPT) { - if (cur->security & APPLICATION_SMIME) - crypt_smime_getkeys (cur->env); cmflags |= M_CM_VERIFY; } else if (cur->security & SIGN) { @@ -105,15 +103,7 @@ int mutt_display_message (HEADER * cur) } if (cmflags & M_CM_VERIFY || cur->security & ENCRYPT) { - if (cur->security & APPLICATION_PGP) { - if (cur->env->from) - crypt_pgp_invoke_getkeys (cur->env->from); - - crypt_invoke_message (APPLICATION_PGP); - } - - if (cur->security & APPLICATION_SMIME) - crypt_invoke_message (APPLICATION_SMIME); + crypt_invoke_message(cur->security); } res = _mutt_copy_message (fpout, msg->fp, cur, cur->content, cmflags, diff --git a/compose.c b/compose.c index d8e0694..4d4cc8b 100644 --- a/compose.c +++ b/compose.c @@ -686,31 +686,6 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ mutt_message_hook (NULL, msg, M_SEND2HOOK); break; - case OP_COMPOSE_ATTACH_KEY: - if (idxlen == idxmax) { - p_realloc(&idx, idxmax += 5); - menu->data = idx; - } - - idx[idxlen] = p_new(ATTACHPTR, 1); - if ((idx[idxlen]->content = - crypt_pgp_make_key_attachment (NULL)) != NULL) { - update_idx (menu, idx, idxlen++); - menu->redraw |= REDRAW_INDEX; - } - else - p_delete(&idx[idxlen]); - - menu->redraw |= REDRAW_STATUS; - - if (option (OPTNEEDREDRAW)) { - menu->redraw = REDRAW_FULL; - unset_option (OPTNEEDREDRAW); - } - - mutt_message_hook (NULL, msg, M_SEND2HOOK); - break; - case OP_COMPOSE_ATTACH_FILE: { char *prompt, **files; diff --git a/copy.c b/copy.c index c3299f0..f865d8a 100644 --- a/copy.c +++ b/copy.c @@ -451,7 +451,7 @@ mutt_copy_header (FILE * in, HEADER * h, FILE * out, int flags, } if (flags & CH_UPDATE_LEN && (flags & CH_NOLEN) == 0) { - fprintf (out, "Content-Length: %lld\n", h->content->length); + fprintf (out, "Content-Length: %zu\n", h->content->length); if (h->lines != 0 || h->content->length == 0) fprintf (out, "Lines: %d\n", h->lines); } @@ -555,7 +555,7 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body, if (mutt_copy_header (fpin, hdr, fpout, chflags | CH_NOLEN | CH_NONEWLINE, NULL)) return -1; - fprintf (fpout, "Content-Length: %lld\n", new_length); + fprintf (fpout, "Content-Length: %zu\n", new_length); if (new_lines <= 0) new_lines = 0; else @@ -768,7 +768,7 @@ static int copy_delete_attach (BODY * b, FILE * fpin, FILE * fpout, if (part->deleted) { fprintf (fpout, "Content-Type: message/external-body; access-type=x-mutt-deleted;\n" - "\texpiration=%s; length=%lld\n" + "\texpiration=%s; length=%zu\n" "\n", date + 5, part->length); if (ferror (fpout)) return -1; diff --git a/crypt.c b/crypt.c index 2fc0924..bf8c81d 100644 --- a/crypt.c +++ b/crypt.c @@ -3891,29 +3891,6 @@ void crypt_pgp_extract_keys_from_attachment_list(FILE * fp, int tag, BODY * top) unset_option (OPTDONTHANDLEPGPKEYS); } - -/* TODO */ - -/* fixme: needs documentation. */ -void crypt_pgp_invoke_getkeys (address_t * addr) -{ -} - -/* Generate a PGP public key attachment. */ -BODY *crypt_pgp_make_key_attachment (char *tempf) -{ - return NULL; -} - -/* S/MIME */ - -/* fixme: Needs documentation. */ -void crypt_smime_getkeys (ENVELOPE * env) -{ -} - -/***************************************************************************/ - void crypt_invoke_message (int type) { if (type & APPLICATION_PGP) { diff --git a/crypt.h b/crypt.h index e6db9b7..2858136 100644 --- a/crypt.h +++ b/crypt.h @@ -89,9 +89,6 @@ int crypt_pgp_application_pgp_handler (BODY * m, STATE * s); /* MIME handler for an PGP/MIME encrypted message. */ int crypt_pgp_encrypted_handler (BODY * a, STATE * s); -/* fixme: needs documentation. */ -void crypt_pgp_invoke_getkeys (address_t * addr); - /* Check for a traditional PGP message in body B. */ int crypt_pgp_check_traditional (FILE * fp, BODY * b, int tagged_only); @@ -109,9 +106,6 @@ int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d); /* MIME handler for the application/smime content-type. */ int crypt_smime_application_smime_handler (BODY * m, STATE * s); -/* fixme: Needs documentation. */ -void crypt_smime_getkeys (ENVELOPE * env); - /* Check that the sender matches. */ int crypt_smime_verify_sender (HEADER * h); diff --git a/functions.def b/functions.def index 59ad2f9..60ca042 100644 --- a/functions.def +++ b/functions.def @@ -369,12 +369,8 @@ LIST(OpCompose) ITEM("view-attach", OP_VIEW_ATTACH, M_ENTER_S) ITEM("send-message", OP_COMPOSE_SEND_MESSAGE, "y") ITEM("pipe-entry", OP_PIPE, "|") - - ITEM("attach-key", OP_COMPOSE_ATTACH_KEY, "\033k") ITEM("pgp-menu", OP_COMPOSE_PGP_MENU, "p") - ITEM("smime-menu", OP_COMPOSE_SMIME_MENU, "S") - #ifdef MIXMASTER ITEM("mix", OP_COMPOSE_MIX, "M") #endif diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 4893833..c7d4712 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -2030,13 +2030,6 @@ int mutt_index_menu (void) menu->redraw = REDRAW_FULL; break; - case OP_MAIL_KEY: - CHECK_ATTACH; - ci_send_message (SENDKEY, NULL, NULL, NULL, NULL); - menu->redraw = REDRAW_FULL; - break; - - case OP_EXTRACT_KEYS: CHECK_MSGCOUNT; CHECK_VISIBLE; diff --git a/mutt.h b/mutt.h index 678bbbd..43d7ffb 100644 --- a/mutt.h +++ b/mutt.h @@ -196,9 +196,8 @@ enum { #define SENDFORWARD (1<<3) #define SENDPOSTPONED (1<<4) #define SENDBATCH (1<<5) -#define SENDKEY (1<<6) -#define SENDRESEND (1<<7) -#define SENDNEWS (1<<8) +#define SENDRESEND (1<<6) +#define SENDNEWS (1<<7) /* flags to _mutt_select_file() */ #define M_SEL_BUFFY (1<<0) diff --git a/pager.c b/pager.c index 348e679..966955c 100644 --- a/pager.c +++ b/pager.c @@ -2470,14 +2470,6 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) redraw = REDRAW_FULL; break; - - case OP_MAIL_KEY: - CHECK_MODE (IsHeader (extra)); - CHECK_ATTACH; - ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; - break; - case OP_EXTRACT_KEYS: CHECK_MODE (IsHeader (extra)); crypt_extract_keys_from_messages (extra->hdr); diff --git a/postpone.c b/postpone.c index 485b44f..1145bf6 100644 --- a/postpone.c +++ b/postpone.c @@ -514,8 +514,8 @@ int mutt_prepare_template (FILE * fp, CONTEXT * ctx, HEADER * newhdr, && crypt_pgp_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) || ((ccap & APPLICATION_SMIME) && crypt_smime_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) - || b == NULL) { - err: + || b == NULL) + { mx_close_message (&msg); envelope_delete(&newhdr->env); body_list_wipe(&newhdr->content); diff --git a/recvattach.c b/recvattach.c index e2fbd41..3339226 100644 --- a/recvattach.c +++ b/recvattach.c @@ -826,9 +826,6 @@ void mutt_view_attachments (HEADER * hdr) need_secured = 1; if (hdr->security & APPLICATION_SMIME) { - if (hdr->env) - crypt_smime_getkeys (hdr->env); - if (mutt_is_application_smime (hdr->content)) { secured = !crypt_smime_decrypt_mime (msg->fp, &fp, hdr->content, &cur); diff --git a/send.c b/send.c index 67f0d7c..91ed81b 100644 --- a/send.c +++ b/send.c @@ -900,15 +900,6 @@ static int generate_body (FILE * tempfp, /* stream for outgoing message * else if (i == -1) return -1; } - else if (flags & SENDKEY) { - BODY *btmp; - - if ((btmp = crypt_pgp_make_key_attachment (NULL)) == NULL) - return -1; - - btmp->next = msg->content; - msg->content = btmp; - } mutt_clear_error (); @@ -1210,7 +1201,7 @@ int ci_send_message (int flags, /* send mode */ address_list_wipe(&msg->env->from); } - if (!(flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) { + if (!(flags & (SENDPOSTPONED | SENDRESEND))) { pbody = body_new(); pbody->next = msg->content; /* don't kill command-line attachments */ msg->content = pbody; @@ -1344,8 +1335,7 @@ int ci_send_message (int flags, /* send mode */ && generate_body (tempfp, msg, flags, ctx, cur) == -1) goto cleanup; - if (!(flags & SENDKEY)) - append_signature (tempfp); + append_signature (tempfp); /* * this wants to be done _after_ generate_body, so message-hooks @@ -1414,8 +1404,7 @@ int ci_send_message (int flags, /* send mode */ && !(flags & (SENDRESEND | SENDPOSTPONED))) msg->env->from->personal = m_strdup(Realname); - if (!(flags & SENDKEY)) - m_fclose(&tempfp); + m_fclose(&tempfp); if (!(flags & SENDBATCH)) { struct stat st; @@ -1433,11 +1422,11 @@ int ci_send_message (int flags, /* send mode */ * setting of $forward_edit because the user probably needs to add the * recipients. */ - if (!(flags & SENDKEY) && - ((flags & SENDFORWARD) == 0 || + if (((flags & SENDFORWARD) == 0 || (option (OPTEDITHDRS) && option (OPTAUTOEDIT)) || query_quadoption (OPT_FORWEDIT, - _("Edit forwarded message?")) == M_YES)) { + _("Edit forwarded message?")) == M_YES)) + { /* If the this isn't a text message, look for a mailcap edit command */ if (rfc1524_mailcap_isneeded(msg->content)) { if (!mutt_edit_attachment (msg->content)) @@ -1463,7 +1452,7 @@ int ci_send_message (int flags, /* send mode */ mutt_message_hook (NULL, msg, M_SEND2HOOK); } - if (!(flags & (SENDPOSTPONED | SENDFORWARD | SENDKEY | SENDRESEND))) { + if (!(flags & (SENDPOSTPONED | SENDFORWARD | SENDRESEND))) { if (stat (msg->content->filename, &st) == 0) { /* if the file was not modified, bail out now */ if (mtime == st.st_mtime && !msg->content->next && -- 2.20.1