if (*plaintext) { err = set_message_body (message, ""); if (!err) set_message_body (message, signedtext); if (err) goto leave; }
GpgMsgImpl::sign (HWND hwnd){  const char *plaintext;  char *signedtext = NULL;  int err = 0;  gpgme_key_t sign_key = NULL;  log_debug ("%s:%s: enter\n", __FILE__, __func__);    /* We don't sign an empty body - a signature on a zero length string     is pretty much useless. */  if (!*(plaintext = getOrigText ()) && !hasAttachments ())     {      log_debug ("%s:%s: leave (empty)", __FILE__, __func__);      return 0;     }  /* Pop up a dialog box to ask for the signer of the message. */  if (signer_dialog_box (&sign_key, NULL) == -1)    {      log_debug ("%s.%s: leave (dialog failed)\n", __FILE__, __func__);      return gpg_error (GPG_ERR_CANCELED);      }  if (*plaintext)    {      err = op_sign (plaintext, &signedtext,                      OP_SIG_CLEAR, sign_key, opt.passwd_ttl);      if (err)        {          MessageBox (NULL, op_strerror (err),                      "GPG Sign", MB_ICONERROR|MB_OK);          goto leave;        }      setSignedText (signedtext);      signedtext = NULL;    }  if (opt.auto_sign_attach && hasAttachments ())    {      unsigned int n;            n = getAttachments ();      log_debug ("%s:%s: message has %u attachments\n", __FILE__, __func__, n);      for (int i=0; i < n; i++)         signAttachment (hwnd, i, sign_key, opt.passwd_ttl);      /* FIXME: we should throw an error if signing of any attachment         failed. */    } leave:  xfree (signedtext);  gpgme_key_release (sign_key);  log_debug ("%s:%s: leave (err=%s)\n", __FILE__, __func__, op_strerror (err));  return err;}