0.9.6claws32
[claws.git] / src / rfc2015.c
index 120fc27d9e9883ec6f769a35cc5d6af06cebbd4d..cbe5351cb56460c7fcb9fab7209775751ccf927d 100644 (file)
@@ -116,14 +116,6 @@ static void dump_part ( MimeInfo *mimeinfo, FILE *fp )
 }
 #endif
 
-void
-rfc2015_disable_all (void)
-{
-    /* FIXME: set a flag, so that we don't bother the user with failed
-     * gpgme messages */
-}
-
-
 void
 rfc2015_secure_remove (const char *fname)
 {
@@ -524,55 +516,6 @@ leave:
     return plain;
 }
 
-#if 0 /* UNUSED */
-MimeInfo * rfc2015_find_signature (MimeInfo *mimeinfo)
-{
-    MimeInfo *partinfo;
-    int n = 0;
-
-    if (!mimeinfo)
-        return NULL;
-    if (!((mimeinfo->type == MIMETYPE_MULTIPART) && !g_strcasecmp(mimeinfo->subtype, "signed")))
-        return NULL;
-
-    debug_print ("** multipart/signed encountered\n");
-
-    /* check that we have at least 2 parts of the correct type */
-    for (partinfo = mimeinfo->children;
-         partinfo != NULL; partinfo = partinfo->next) {
-        if (++n > 1 && (partinfo->type == MIMETYPE_APPLICATION && 
-               !g_strcasecmp (partinfo->subtype, "pgp-signature")))
-            break;
-    }
-
-    return partinfo;
-}
-
-gboolean rfc2015_has_signature (MimeInfo *mimeinfo)
-{
-    return rfc2015_find_signature (mimeinfo) != NULL;
-}
-
-void rfc2015_check_signature (MimeInfo *mimeinfo, FILE *fp)
-{
-    MimeInfo *partinfo;
-
-    partinfo = rfc2015_find_signature (mimeinfo);
-    if (!partinfo)
-        return;
-
-#if 0
-    g_message ("** yep, it is a pgp signature");
-    dump_mimeinfo ("gpg-signature", partinfo );
-    dump_part (partinfo, fp );
-    dump_mimeinfo ("signed text", mimeinfo->children );
-    dump_part (mimeinfo->children, fp);
-#endif
-
-    check_signature (mimeinfo, partinfo, fp);
-}
-#endif
-
 int rfc2015_is_encrypted (MimeInfo *mimeinfo)
 {
     if (!mimeinfo || mimeinfo->type != MIMETYPE_MULTIPART)
@@ -1465,89 +1408,4 @@ failure:
     return -1;
 }
 
-static gboolean rfc2015_is_signed(MimeInfo *mimeinfo)
-{
-       MimeInfo *parent;
-       MimeInfo *signature;
-       gchar *protocol;
-
-       g_return_val_if_fail(mimeinfo != NULL, FALSE);
-       
-       /* check parent */
-       parent = procmime_mimeinfo_parent(mimeinfo);
-       if (parent == NULL)
-               return FALSE;
-       if ((parent->type != MIMETYPE_MULTIPART) ||
-           g_strcasecmp(parent->subtype, "signed"))
-               return FALSE;
-       protocol = g_hash_table_lookup(parent->parameters, "protocol");
-       if ((protocol == NULL) || g_strcasecmp(protocol, "application/pgp-signature"))
-               return FALSE;
-
-       /* check if mimeinfo is the first child */
-       if (parent->node->children->data != mimeinfo)
-               return FALSE;
-
-       /* check signature */
-       signature = parent->node->children->next != NULL ? 
-           (MimeInfo *) parent->node->children->next->data : NULL;
-       if (signature == NULL)
-               return FALSE;
-       if ((signature->type != MIMETYPE_APPLICATION) ||
-           g_strcasecmp(signature->subtype, "pgp-signature"))
-               return FALSE;
-
-       return TRUE;
-}
-
-static void idle_function_for_gpgme(void)
-{
-       while (gtk_events_pending())
-               gtk_main_iteration();
-}
-
-static PrivacySystem rfc2015_system = {
-       "PGP/Mime",             /* name */
-
-       g_free,                 /* free_privacydata */
-
-       rfc2015_is_signed,      /* is_signed(MimeInfo *) */
-       NULL,                   /* get_signer(MimeInfo *) */
-       NULL,                   /* check_signature(MimeInfo *) */
-
-       /* NOT YET */
-       NULL,                   /* is_encrypted(MimeInfo *) */
-       NULL,                   /* decrypt(MimeInfo *) */
-};
-
-void rfc2015_init()
-{
-       if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) != 
-                       GPGME_No_Error) {  /* Also does some gpgme init */
-               rfc2015_disable_all();
-               debug_print("gpgme_engine_version:\n%s\n",
-                           gpgme_get_engine_info());
-
-               if (prefs_common.gpg_warning) {
-                       AlertValue val;
-
-                       val = alertpanel_message_with_disable
-                               (_("Warning"),
-                                _("GnuPG is not installed properly, or needs to be upgraded.\n"
-                                  "OpenPGP support disabled."));
-                       if (val & G_ALERTDISABLE)
-                               prefs_common.gpg_warning = FALSE;
-               }
-       } else
-               privacy_register_system(&rfc2015_system);
-
-       gpgme_register_idle(idle_function_for_gpgme);
-}
-
-void rfc2015_done()
-{
-       privacy_unregister_system(&rfc2015_system);
-        gpgmegtk_free_passphrase();
-}
-
 #endif /* USE_GPGME */