/[winpt]/trunk/Src/wptFileManager.cpp
ViewVC logotype

Diff of /trunk/Src/wptFileManager.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 76 by twoaday, Thu Nov 10 14:07:06 2005 UTC revision 119 by twoaday, Fri Dec 9 08:04:51 2005 UTC
# Line 21  Line 21 
21  /* TODO:  /* TODO:
22   *    check_armor_type: we should check the whole file and not only the first line!   *    check_armor_type: we should check the whole file and not only the first line!
23   */   */
   
24  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
25  #include <config.h>  #include <config.h>
26  #endif  #endif
27    
28  #include <sys/types.h>  #include <sys/types.h>
 #include <sys/types.h>  
29  #include <windows.h>  #include <windows.h>
30  #include <commdlg.h>  #include <commdlg.h>
31  #include <io.h>  #include <io.h>
# Line 51  Line 49 
49  #include "wptRegistry.h"  #include "wptRegistry.h"
50  #include "wptImport.h"  #include "wptImport.h"
51  #include "wptCrypto.h"  #include "wptCrypto.h"
   
52  #include "openpgp.h"  #include "openpgp.h"
53    
54  #define op_begin()  SetCursor (LoadCursor (NULL, IDC_WAIT))  #define op_begin()  SetCursor (LoadCursor (NULL, IDC_WAIT))
# Line 275  leave: Line 272  leave:
272    
273  /* Extract file type from @fname. If @r_type is valid,  /* Extract file type from @fname. If @r_type is valid,
274     it contains the PGP type on success. */     it contains the PGP type on success. */
275  static const char *  static const char*
276  fm_get_file_type (const char *fname, int *r_type)  fm_get_file_type (const char *fname, int *r_type)
277  {          {        
278      gpg_iobuf_t inp;      gpg_iobuf_t inp;
279      armor_filter_context_t afx;      armor_filter_context_t afx;
280      PACKET *pkt;      PACKET *pkt;
281      const char *s = NULL;      const char *s = NULL;
282      int rc=0;      size_t count = 0, compr = 0;
283        int rc = 0;
284    
285      if (r_type)      if (r_type)
286          *r_type = PGP_NONE;          *r_type = PGP_NONE;
# Line 296  fm_get_file_type (const char *fname, int Line 294  fm_get_file_type (const char *fname, int
294    
295      inp = gpg_iobuf_open (fname);      inp = gpg_iobuf_open (fname);
296      if (!inp) {      if (!inp) {
297          const char *s = winpt_strerror (WPTERR_FILE_OPEN);          const char *err = winpt_strerror (WPTERR_FILE_OPEN);
298          log_box (_("File Manager"), MB_ERR, "\"%s\": %s", fname, s);          log_box (_("File Manager"), MB_ERR, "\"%s\": %s", fname, err);
299          return NULL;          return NULL;
300      }      }
301      gpg_iobuf_ioctl (inp, 3, 1, NULL); /* disable cache */      gpg_iobuf_ioctl (inp, 3, 1, NULL); /* disable cache */
# Line 339  fm_get_file_type (const char *fname, int Line 337  fm_get_file_type (const char *fname, int
337              s = "SECKEY";   rc = -2;              s = "SECKEY";   rc = -2;
338              if (r_type) *r_type = PGP_SECKEY;              if (r_type) *r_type = PGP_SECKEY;
339              break;              break;
340                
341            case PKT_COMPRESSED:
342                /* If we only find 1 packet and it is compressed,
343                   we assume a compress one-pass signature. */
344                if (count != 0)
345                    break;
346                s = "SIGNED";   rc = -2;
347                compr = 1;
348                break;
349    
350          default:          default:
351              break;              break;
352          }          }
353            count++;
354          gpg_free_packet (pkt);          gpg_free_packet (pkt);
355          gpg_init_packet (pkt);          gpg_init_packet (pkt);
356          if (rc == -2)          if (rc == -2)
# Line 354  fm_get_file_type (const char *fname, int Line 362  fm_get_file_type (const char *fname, int
362          s = fm_check_armor_type (fname, r_type);          s = fm_check_armor_type (fname, r_type);
363      if (!s)      if (!s)
364          s = "UNKNOWN";          s = "UNKNOWN";
365      if (!strcmp (s, "SIGNED")      if (!strcmp (s, "SIGNED") && !compr
366          && strcmp (fm_check_armor_type (fname, r_type), "SIGNED-CLEAR ")) {          && strcmp (fm_check_armor_type (fname, r_type), "SIGNED-CLEAR ")) {
367          if (r_type) *r_type = PGP_SIG;          if (r_type) *r_type = PGP_SIG;
368          s = "SIGNED-DETACH";          s = "SIGNED-DETACH";
# Line 363  fm_get_file_type (const char *fname, int Line 371  fm_get_file_type (const char *fname, int
371  }  }
372    
373    
374    /* Build the File Manager list view control. */
375  int  int
376  fm_build (listview_ctrl_t *lv, HWND ctrl)  fm_build (listview_ctrl_t *lv, HWND ctrl)
377  {  {
378      int i, rc = 0;      int i, rc = 0;
379      listview_ctrl_t c;      listview_ctrl_t c;
380      struct listview_column_s col[] =      struct listview_column_s col[] = {
     {  
381          {0,  80, (char *)_("Status") },          {0,  80, (char *)_("Status") },
382          {1, 256, (char *)_("Name") },          {1, 256, (char *)_("Name") },
383          {2, 128, (char *)_("Operation") },          {2, 128, (char *)_("Operation") },
384          {0,   0, NULL }          {0,   0, NULL }
385      };      };
386                    
387      rc = listview_new( &c );      rc = listview_new (&c);
388      if( rc )      if (rc)
389          BUG( NULL );          BUG (NULL);
390      c->ctrl = ctrl;      c->ctrl = ctrl;
391      for ( i = 0; col[i].width; i++ )      for (i = 0; col[i].width; i++)
392          listview_add_column( c, &col[i] );          listview_add_column (c, &col[i]);
393      listview_set_ext_style( c );      listview_set_ext_style (c);
394      if( lv )      if (lv)
395          *lv = c;          *lv = c;
396      return 0;      return 0;
397  } /* fm_build */  }
398    
399    
400    /* Release the File Manager listview control. */
401  void  void
402  fm_delete( listview_ctrl_t lv )  fm_delete (listview_ctrl_t lv)
403  {  {
404      if( lv ) {      if (lv) {
405          listview_release( lv );          listview_release(lv);  
406      }      }
407  } /* fm_delete */  }
408    
409    
410  int  int
# Line 424  fm_state_release (fm_state_t c) Line 433  fm_state_release (fm_state_t c)
433  {  {
434      if (!c)      if (!c)
435          return;          return;
     if (c->recp)  
         free (c->recp);  
436      if (c->ctx) {      if (c->ctx) {
437          gpgme_release (c->ctx);          gpgme_release (c->ctx);
438          c->ctx = NULL;            c->ctx = NULL;  
439      }      }
440        safe_free (c->recp);
441      free_if_alloc (c->opaque);      free_if_alloc (c->opaque);
442      free_if_alloc (c->output);      free_if_alloc (c->output);
443      delete c; c = NULL;          delete c; c = NULL;    
# Line 504  int Line 512  int
512  fm_add_dropped_files (listview_ctrl_t lv, HDROP dd_files)  fm_add_dropped_files (listview_ctrl_t lv, HDROP dd_files)
513  {  {
514      char name[384+4];      char name[384+4];
515      int nfiles, i;      int nfiles;
516      int rc=0;      int rc = 0;
517        int i;
518            
519      memset (name, 0, sizeof (name));      memset (name, 0, sizeof (name));
520      nfiles = DragQueryFile (dd_files, 0xFFFFFFFF, NULL, 0);      nfiles = DragQueryFile (dd_files, 0xFFFFFFFF, NULL, 0);
# Line 629  fm_assume_onepass_sig (const char * fnam Line 638  fm_assume_onepass_sig (const char * fnam
638          gpg_free_packet (pkt);          gpg_free_packet (pkt);
639          safe_free (pkt);          safe_free (pkt);
640          gpg_iobuf_close (fp);          gpg_iobuf_close (fp);
641          unlink ("gpgme.tmp");          remove ("gpgme.tmp");
642      }      }
643      /* XXX: implement it for real files */      /* XXX: implement it for real files */
644      return check;      return check;
# Line 731  fm_check_file_type (listview_ctrl_t lv, Line 740  fm_check_file_type (listview_ctrl_t lv,
740  } /* fm_check_file_type */  } /* fm_check_file_type */
741    
742    
743    /* Set the file status of the given command @fm_cmd.
744       @success is 0 on success. */
745  static void  static void
746  fm_set_status (listview_ctrl_t lv, int pos, int fm_cmd, int success,  fm_set_status (listview_ctrl_t lv, int pos, int fm_cmd,
747                 const char * output)                 gpgme_sig_mode_t sigmode, int success, const char *output)
748  {  {
749      char status[128], operat[128];      char status[128], operat[128];
750      int update = 1;      int update = 1;
751      const char *s;      const char *s;
752    
753      if ( fm_cmd == FM_LIST )      if (fm_cmd == FM_LIST)
754          return;          return;
755      success ? s = "SUCCESS" : s = "FAILED";      success ? s = "SUCCESS" : s = "FAILED";
756      strcpy( operat, s );      strcpy (operat, s);
757    
758      switch (fm_cmd) {      switch (fm_cmd) {
759      case FM_ENCRYPT:      case FM_ENCRYPT:
760      case FM_ENCRYPT_DIR:      case FM_ENCRYPT_DIR:
761      case FM_SIGNENCRYPT: strcpy( status, "ENCRYPTED" ); break;      case FM_SIGNENCRYPT: strcpy (status, "ENCRYPTED"); break;
762      case FM_DECRYPT:     strcpy( status, "UNKNOWN" );   break;      case FM_DECRYPT:     strcpy (status, "UNKNOWN");   break;
763      case FM_SIGN:        strcpy( status, "SIGNED" );    break;      case FM_SIGN:
764            if (sigmode == GPGME_SIG_MODE_DETACH)
765                strcpy (status, "SIGNED-DETACH");
766            else if (sigmode == GPGME_SIG_MODE_CLEAR)
767                strcpy (status, "SIGNED-CLEAR");
768            else
769                strcpy (status, "SIGNED");
770            break;
771      case FM_VERIFY:      update = 0;                    break;      case FM_VERIFY:      update = 0;                    break;
772      case FM_SYMENC:      strcpy( status, "SYMKEYENC" ); break;      case FM_SYMENC:      strcpy (status, "SYMKEYENC"); break;
773      case FM_IMPORT:      update = 0;                    break;      case FM_IMPORT:      update = 0;                    break;
774      case FM_WIPE:        strcpy( status, "WIPED" );     break;      case FM_WIPE:        strcpy (status, "WIPED");     break;
775      default:             strcpy( status, "UNKNOWN");    break;      default:             strcpy (status, "UNKNOWN");    break;
776      }      }
777    
778      if (success) {      if (success && update) {
779          if (update) {          listview_add_sub_item (lv, pos, 0, status);
780              listview_add_sub_item (lv, pos, 0, status);          listview_add_sub_item (lv, pos, 1, output);
             listview_add_sub_item (lv, pos, 1, output);  
         }  
781      }      }
782      listview_add_sub_item( lv, pos, 2, operat );      listview_add_sub_item( lv, pos, 2, operat );
783  } /* fm_set_status */  }
784    
785    
786  int  int
# Line 812  fm_parse_files (listview_ctrl_t lv, HWND Line 828  fm_parse_files (listview_ctrl_t lv, HWND
828            
829      switch (cmd) {      switch (cmd) {
830      case ID_FILEMISC_ENCRYPT: fm_cmd = FM_ENCRYPT; break;      case ID_FILEMISC_ENCRYPT: fm_cmd = FM_ENCRYPT; break;
831        case ID_FILEMISC_ENCRYPT_ZIP:fm_cmd = FM_ENCRYPT_ZIP; break;
832      case ID_FILEMISC_DECRYPT: fm_cmd = FM_DECRYPT; break;      case ID_FILEMISC_DECRYPT: fm_cmd = FM_DECRYPT; break;
833      case ID_FILEMISC_SYMENC:  fm_cmd = FM_SYMENC;  break;      case ID_FILEMISC_SYMENC:  fm_cmd = FM_SYMENC;  break;
834      case ID_FILEMISC_SIGN:    fm_cmd = FM_SIGN;    break;          case ID_FILEMISC_SIGN:    fm_cmd = FM_SIGN;    break;    
# Line 824  fm_parse_files (listview_ctrl_t lv, HWND Line 841  fm_parse_files (listview_ctrl_t lv, HWND
841      }      }
842            
843      if (fm_get_current_pos (lv) == -1)      if (fm_get_current_pos (lv) == -1)
844          return WPTERR_GENERAL;              return WPTERR_GENERAL;
845      rc = fm_state_new (&ctx);      rc = fm_state_new (&ctx);
846      if (rc)      if (rc)
847          BUG (0);          BUG (0);
# Line 845  fm_parse_files (listview_ctrl_t lv, HWND Line 862  fm_parse_files (listview_ctrl_t lv, HWND
862            
863      /* Commands we need before we can perform the main command */      /* Commands we need before we can perform the main command */
864      switch (fm_cmd) {      switch (fm_cmd) {
865        case FM_ENCRYPT_ZIP:
866      case FM_ENCRYPT:      case FM_ENCRYPT:
867      case FM_SIGNENCRYPT:      case FM_SIGNENCRYPT:
868          if (fm_cmd == FM_SIGNENCRYPT)          if (fm_cmd == FM_SIGNENCRYPT)
869              ctx->req_signer = 1;              ctx->req_signer = 1;
870          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILE_ENCRYPT, ctx->dlg,          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILE_ENCRYPT,
871                          file_encrypt_dlg_proc, (LPARAM)ctx);                          ctx->dlg, file_encrypt_dlg_proc, (LPARAM)ctx);
872          if (ctx->cancel == 1) {          if (ctx->cancel == 1) {
873              rc = WPTERR_GENERAL;              rc = WPTERR_GENERAL;
874              goto leave;              goto leave;
875          }          }
876          break;          break;
# Line 891  fm_parse_files (listview_ctrl_t lv, HWND Line 909  fm_parse_files (listview_ctrl_t lv, HWND
909          memset (&confirm, 0, sizeof confirm);          memset (&confirm, 0, sizeof confirm);
910          confirm.lv_files = lv;          confirm.lv_files = lv;
911          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILES_SECDEL, ctx->dlg,          DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILES_SECDEL, ctx->dlg,
912                              file_secdel_confirm_dlg_proc, (LPARAM)&confirm);                          file_secdel_confirm_dlg_proc, (LPARAM)&confirm);
913          if (!confirm.yes)          if (!confirm.yes)
914              goto leave;              goto leave;
915      }      }
916        
917      for( i = 0; i < listview_count_items( lv, 0 ); i++ ) {      if (fm_cmd == FM_ENCRYPT_ZIP)
918            fm_encrypt_into_zip (ctx, lv);
919    
920        for (i = 0; i < listview_count_items (lv, 0); i++) {
921          if( !listview_get_item_state( lv, i ) )          if( !listview_get_item_state( lv, i ) )
922              continue;              continue;
923          listview_get_item_text( lv, i, 1, fname, sizeof (fname) - 1 );          listview_get_item_text(lv, i, 1, fname, sizeof (fname) - 1);
924          if( file_exist_check( fname ) && !is_directory( fname ) ) {          if( file_exist_check (fname) && !is_directory (fname)) {
925              log_box( _("File Manager"), MB_ERR, _("\"%s\" does not exist"), fname );              log_box (_("File Manager"), MB_ERR,
926                         _("\"%s\" does not exist"), fname);
927              continue;              continue;
928          }          }
929          if( is_directory( fname ) )          if (is_directory (fname))
930              fm_cmd = FM_ENCRYPT_DIR;                      fm_cmd = FM_ENCRYPT_DIR;        
931          if( !fm_check_file_type( lv, i, fm_cmd ) )          if (!fm_check_file_type (lv, i, fm_cmd))
932              continue;              continue;
933          sig_detached = fm_check_detached_sig( lv, i );          sig_detached = fm_check_detached_sig (lv, i);
934          switch( fm_cmd ) {          switch (fm_cmd) {
935          case FM_LIST:        rc = fm_list( fname, dlg );       break;          case FM_LIST:        rc = fm_list( fname, dlg );       break;
936          case FM_WIPE:        rc = fm_wipe( fname );            break;          case FM_WIPE:        rc = fm_wipe( fname );            break;
937          case FM_ENCRYPT:     rc = fm_encrypt( ctx, fname, 0 ); break;          case FM_ENCRYPT:     rc = fm_encrypt( ctx, fname, 0 ); break;
# Line 931  fm_parse_files (listview_ctrl_t lv, HWND Line 953  fm_parse_files (listview_ctrl_t lv, HWND
953              rc = fm_import (ctx, fname);              rc = fm_import (ctx, fname);
954              break;              break;
955          }          }
956          fm_set_status (lv, i, fm_cmd, !rc, ctx->output);          fm_set_status (lv, i, fm_cmd, ctx->sigmode, !rc, ctx->output);
957          free_if_alloc (ctx->output);          free_if_alloc (ctx->output);
958          progress_cleanup (&pfx);          progress_cleanup (&pfx);
959      }      }
960    
961      if (fm_cmd == FM_WIPE) {      if (fm_cmd == FM_WIPE) {
962          secure_unlink_set_cb (NULL, NULL);          secure_unlink_set_cb (NULL, NULL);
963          progress_cleanup (&pfx2);          progress_cleanup (&pfx2);
# Line 947  fm_parse_files (listview_ctrl_t lv, HWND Line 970  fm_parse_files (listview_ctrl_t lv, HWND
970      /* remove wipe files from the list */      /* remove wipe files from the list */
971      n = listview_count_items (lv, 0);      n = listview_count_items (lv, 0);
972      while (n--) {      while (n--) {
         char status[128];  
973          listview_get_item_text (lv, n, 0, status, sizeof (status) - 1);          listview_get_item_text (lv, n, 0, status, sizeof (status) - 1);
974          if( !strcmp (status, "WIPED"))          if (!strcmp (status, "WIPED"))
975              listview_del_item (lv, n);              listview_del_item (lv, n);
976      }      }
977            
# Line 993  ask_filename (fm_state_t c, const char * Line 1015  ask_filename (fm_state_t c, const char *
1015  {  {
1016      const char * s;      const char * s;
1017    
1018      s = get_filename_dlg (c->dlg, FILE_SAVE, msg, NULL, NULL);      s = get_filesave_dlg (c->dlg, msg, NULL, NULL);
1019      if (!s)      if (!s)
1020          return WPTERR_GENERAL;          return WPTERR_GENERAL;
1021    
# Line 1025  fm_encrypt (fm_state_t c, const char *na Line 1047  fm_encrypt (fm_state_t c, const char *na
1047          BUG (0);          BUG (0);
1048      strcpy (ext, file_get_extension (ctx, c->sigmode));      strcpy (ext, file_get_extension (ctx, c->sigmode));
1049      strcpy (c->output, name);      strcpy (c->output, name);
1050      strcat (c->output, ext);              strcat (c->output, ext);
1051            
1052      if (!overwrite_file (c->output)) {      if (!overwrite_file (c->output)) {
1053          rc = ask_filename (c, _("Enter filename for encrypted file"), NULL);          rc = ask_filename (c, _("Enter filename for encrypted file"), NULL);
# Line 1033  fm_encrypt (fm_state_t c, const char *na Line 1055  fm_encrypt (fm_state_t c, const char *na
1055              goto leave;              goto leave;
1056      }      }
1057    
1058      err = gpg_file_data_new (name, 1, &in);      err = gpg_file_data_new (name, F_DATA_READ, &in);
1059      if (err)      if (err)
1060          goto leave;          goto leave;
1061      err = gpg_file_data_new (c->output, 0, &out);      remove_crit_file_attrs (c->output, 0);
1062        err = gpg_file_data_new (c->output, F_DATA_WRITE, &out);
1063      if (err)      if (err)
1064          goto leave;          goto leave;
1065    
# Line 1047  fm_encrypt (fm_state_t c, const char *na Line 1070  fm_encrypt (fm_state_t c, const char *na
1070      }      }
1071      */      */
1072            
1073      /* XXX      /* XXX: disable compression for multi-media files.
1074      no_compr = is_multi_media (name);      no_compr = is_multi_media (name);
1075      gpgme_control (ctx, GPGME_CTRL_NO_COMPR, no_compr);      gpgme_control (ctx, GPGME_CTRL_NO_COMPR, no_compr);
1076      */      */
# Line 1066  fm_encrypt (fm_state_t c, const char *na Line 1089  fm_encrypt (fm_state_t c, const char *na
1089              gpgme_signers_add (ctx, key);              gpgme_signers_add (ctx, key);
1090          }          }
1091          else {          else {
1092              gpgme_key_t key = gpgme_signers_enum (ctx, 0);              gpgme_key_t sigkey = gpgme_signers_enum (ctx, 0);
1093              if (key && key->subkeys) {              if (sigkey && sigkey->subkeys) {
1094                  keyid = m_strdup (key->subkeys->keyid);                  keyid = m_strdup (sigkey->subkeys->keyid);
1095                  if (!keyid)                  if (!keyid)
1096                      BUG (NULL);                      BUG (NULL);
1097              }              }
# Line 1113  leave: Line 1136  leave:
1136          gpg_file_data_release (in);          gpg_file_data_release (in);
1137      if (out)      if (out)
1138          gpg_file_data_release (out);          gpg_file_data_release (out);
1139        free_if_alloc (keyid);
1140      if (!rc && c->wipe)      if (!rc && c->wipe)
1141          secure_unlink (name, WIPE_MODE_SIMPLE);          secure_unlink (name, WIPE_MODE_SIMPLE);
     free_if_alloc (keyid);  
1142      return rc;      return rc;
1143  }  }
1144    
# Line 1176  leave: Line 1199  leave:
1199          gpg_file_data_release (out);          gpg_file_data_release (out);
1200      sfree_if_alloc (pass);      sfree_if_alloc (pass);
1201      return rc;      return rc;
1202  } /* fm_sym_encrypt */  }
1203    
1204    
1205  /* Show the human readable verify result from @sigres. */  /* Show the human readable verify result from @sigres. */
# Line 1194  show_verify_result (gpgme_verify_result_ Line 1217  show_verify_result (gpgme_verify_result_
1217      sigok = sig->summary & GPGME_SIGSUM_GREEN;      sigok = sig->summary & GPGME_SIGSUM_GREEN;
1218      s = sigok? _("Good signature") : _("BAD signature");      s = sigok? _("Good signature") : _("BAD signature");
1219      type = sigok? MB_OK: MB_ICONWARNING|MB_OK;      type = sigok? MB_OK: MB_ICONWARNING|MB_OK;
1220      keyid = sig->fpr;        keyid = sig->fpr;
1221      if (!keyid)      if (!keyid)
1222          return;          return;
1223    
1224      keyid = strlen (sig->fpr) == 40? sig->fpr+32 : sig->fpr + 24;      keyid = strlen (sig->fpr) == 40? sig->fpr+32 : sig->fpr + 24;
1225      get_pubkey (sig->fpr, &key);      get_pubkey (sig->fpr, &key);
1226      _snprintf (buf, sizeof (buf)-1, "Signature made %s using %s key ID %s\n"      _snprintf (buf, sizeof (buf)-1, _("Signature made %s using %s key ID %s\n"
1227                                      "%s from \"%s\"",                                      "%s from \"%s\""),
1228                  strtimestamp (sig->timestamp), get_key_pubalgo (sig->pubkey_algo),                  strtimestamp (sig->timestamp),
1229                    get_key_pubalgo (sig->pubkey_algo),
1230                  keyid, s, key? key->uids->uid : _("user ID not found"));                  keyid, s, key? key->uids->uid : _("user ID not found"));
1231      msg_box (NULL, buf, _("Decrypt Verify"), type);      msg_box (NULL, buf, _("Decrypt Verify"), type);
1232  }  }
# Line 1215  secret_key_available (gpgme_recipient_t Line 1239  secret_key_available (gpgme_recipient_t
1239      gpgme_recipient_t r;      gpgme_recipient_t r;
1240      gpgme_key_t key;      gpgme_key_t key;
1241    
1242      for (r=rset; r; r = r->next) {            for (r=rset; r; r = r->next) {
1243          if (gpgme_err_code (r->status) == GPG_ERR_NO_SECKEY)          if (gpgme_err_code (r->status) == GPG_ERR_NO_SECKEY)
1244              continue;              continue;
1245          else {          else {
# Line 1240  fm_decrypt (fm_state_t c, const char *na Line 1264  fm_decrypt (fm_state_t c, const char *na
1264      int rc = 0;      int rc = 0;
1265            
1266      if (!c->init_cb || !c->cache_cb) {      if (!c->init_cb || !c->cache_cb) {
1267          set_gpg_passphrase_cb (&c->pass_cb, c->ctx, GPG_CMD_DECRYPT,          set_gpg_passphrase_cb (&c->pass_cb, c->ctx, GPG_CMD_DECRYPT,
1268                                 c->dlg, _("Decryption"));                                 c->dlg, _("Decryption"));
1269          c->init_cb = 1;          c->init_cb = 1;
1270      }          }
1271            
1272      c->output = m_strdup (name);      c->output = m_strdup (name);
1273      if (!c->output)      if (!c->output)
# Line 1266  fm_decrypt (fm_state_t c, const char *na Line 1290  fm_decrypt (fm_state_t c, const char *na
1290          rc = ask_filename (c, _("Please enter filename for plaintext file"), NULL);          rc = ask_filename (c, _("Please enter filename for plaintext file"), NULL);
1291          if (rc)          if (rc)
1292              goto leave;              goto leave;
1293      }          }
   
     remove_crit_file_attrs (c->output, 0);  
1294    
1295      err = gpg_file_data_new (name, 1, &in);      err = gpg_file_data_new (name, F_DATA_READ, &in);
1296      if (err)      if (err)
1297          goto leave;          goto leave;
1298      err = gpg_file_data_new (c->output, 0, &out);      remove_crit_file_attrs (c->output, 0);
1299        err = gpg_file_data_new (c->output, F_DATA_WRITE, &out);
1300      if (err)      if (err)
1301          goto leave;          goto leave;
1302    
# Line 1307  fm_decrypt (fm_state_t c, const char *na Line 1330  fm_decrypt (fm_state_t c, const char *na
1330          goto leave;          goto leave;
1331      }      }
1332      if (file_exist_check (c->output)) {      if (file_exist_check (c->output)) {
1333          log_box ("Decrypt", MB_ERR, _("Decryption failed.\n%s: does not exist."), c->output);          log_box ("Decrypt", MB_ERR,
1334                     _("Decryption failed.\n%s: does not exist."), c->output);
1335          rc = WPTERR_GENERAL;          rc = WPTERR_GENERAL;
1336      }      }
1337            
# Line 1320  leave: Line 1344  leave:
1344          gpg_file_data_release (in);          gpg_file_data_release (in);
1345      if (out)      if (out)
1346          gpg_file_data_release (out);          gpg_file_data_release (out);
1347    
1348      return rc;      return rc;
1349  }  }
1350    
1351    
1352  int  int
1353  fm_sign (fm_state_t c, const char * name)  fm_sign (fm_state_t c, const char * name)
1354  {        {
     int rc = 0;  
1355      gpgme_ctx_t ctx = c->ctx;      gpgme_ctx_t ctx = c->ctx;
1356      gpgme_error_t err;      gpgme_error_t err;
1357      file_data_t in=NULL, out=NULL;      file_data_t in=NULL, out=NULL;
1358      char ext[5];      char ext[5];
1359        int rc = 0;
1360    
1361      if (!c->init_cb || !c->cache_cb) {      if (!c->init_cb || !c->cache_cb) {
1362          set_gpg_passphrase_cb (&c->pass_cb, c->ctx, GPG_CMD_SIGN, c->dlg, _("Signing") );          set_gpg_passphrase_cb (&c->pass_cb, c->ctx,
1363                                   GPG_CMD_SIGN, c->dlg, _("Signing"));
1364          c->init_cb = 1;          c->init_cb = 1;
1365      }      }
1366            
1367      free_if_alloc (c->output);      free_if_alloc (c->output);
1368      c->output = new char[strlen (name) + 5 + 1];      c->output = new char[strlen (name) + 5 + 1];
1369      if( !c->output)      if (!c->output)
1370          BUG( NULL );          BUG (NULL);
1371      strcpy (ext, file_get_extension (ctx, c->sigmode));      strcpy (ext, file_get_extension (ctx, c->sigmode));
1372      strcpy (c->output, name);      strcpy (c->output, name);
1373      strcat (c->output, ext);      strcat (c->output, ext);
# Line 1351  fm_sign (fm_state_t c, const char * name Line 1377  fm_sign (fm_state_t c, const char * name
1377          if (rc)          if (rc)
1378              goto leave;              goto leave;
1379      }      }
1380      remove_crit_file_attrs (c->output, 0);      
1381        err = gpg_file_data_new (name, F_DATA_READ, &in);
     err = gpg_file_data_new (name, 1, &in);  
1382      if (err)      if (err)
1383          goto leave;          goto leave;
1384      err = gpg_file_data_new (c->output, 0, &out);      remove_crit_file_attrs (c->output, 0);
1385        err = gpg_file_data_new (c->output, F_DATA_WRITE, &out);
1386      if (err)      if (err)
1387          goto leave;          goto leave;
1388    
1389      op_begin ();      op_begin ();
1390      err = gpgme_op_sign (ctx, in->dat, out->dat, c->sigmode);      err = gpgme_op_sign (ctx, in->dat, out->dat, c->sigmode);
1391      op_end ();      op_end ();
1392      if( !c->cache_cb )      if (!c->cache_cb)
1393          release_gpg_passphrase_cb (&c->pass_cb);          release_gpg_passphrase_cb (&c->pass_cb);
1394      if( c->pass_cb.cancel ) {      if (c->pass_cb.cancel) {
1395          rc = WPTERR_GENERAL;          rc = WPTERR_GENERAL;
1396          goto leave;          goto leave;
1397      }      }
1398      if( err ) {      if (err) {
1399          msg_box( c->dlg, gpgme_strerror( err ), _("Sign"), MB_ERR );          msg_box (c->dlg, gpgme_strerror (err), _("Sign"), MB_ERR);
1400          rc = WPTERR_GENERAL;          rc = WPTERR_GENERAL;
1401          goto leave;              goto leave;    
1402      }      }
# Line 1384  leave: Line 1410  leave:
1410  }  }
1411    
1412    
1413  static int  static void
1414  fm_add_sig_stat (file_sig_ctx_t log)  fm_add_sig_stat (file_sig_ctx_t log)
1415  {  {
1416      gpgme_key_t key;          gpgme_key_t key;    
# Line 1404  fm_add_sig_stat (file_sig_ctx_t log) Line 1430  fm_add_sig_stat (file_sig_ctx_t log)
1430          log->use_uid = 1;          log->use_uid = 1;
1431      }      }
1432      file_verify_add_state (log);      file_verify_add_state (log);
     return 0;  
1433  }  }
1434    
1435    
1436    /* Verify a detached signature from the clipboard. */  
1437  static int  static int
1438  verify_pasted (listview_ctrl_t lv, fm_state_t ctx, const char * dat,  verify_pasted (listview_ctrl_t lv, fm_state_t ctx,
1439                 int i, HWND dlg)                 const char *dat, int pos, HWND dlg)
1440  {  {
1441      FILE * fp;      FILE *fp;
1442      char stat[32];      char stat[32];
1443      char file[256], * fname = NULL;      char file[256], *fname = NULL;
1444      int del_end=0;      int del_end = 0;
1445    
1446      listview_get_item_text (lv, i, 0, stat, sizeof (stat)-1);      listview_get_item_text (lv, pos, 0, stat, sizeof (stat)-1);
1447      listview_get_item_text (lv, i, 1, file, sizeof (file)-1);      listview_get_item_text (lv, pos, 1, file, sizeof (file)-1);
1448      if (strcmp (stat, "UNKNOWN"))      if (strcmp (stat, "UNKNOWN"))
1449          return 0;          return 0;
1450      fname = make_filename (NULL, file, "asc");      fname = make_filename (NULL, file, "asc");
# Line 1427  verify_pasted (listview_ctrl_t lv, fm_st Line 1453  verify_pasted (listview_ctrl_t lv, fm_st
1453          if (fp == NULL) {          if (fp == NULL) {
1454              log_box (_("File Manager"), MB_ERR, "could not create '%s'", fname);              log_box (_("File Manager"), MB_ERR, "could not create '%s'", fname);
1455              free_if_alloc (fname);              free_if_alloc (fname);
1456              return WPTERR_GENERAL;                    return WPTERR_GENERAL;
1457          }                }
1458          fwrite (dat, 1, strlen (dat), fp);          fwrite (dat, 1, strlen (dat), fp);
1459          fclose (fp);          fclose (fp);
1460          del_end = 1;          del_end = 1;
1461      }      }
1462      fm_verify (ctx, 1, fname);      fm_verify (ctx, 1, fname);
1463      if (del_end)      if (del_end)
1464          unlink (fname);          remove (fname);
1465      free_if_alloc (fname);      free_if_alloc (fname);
1466      return 0;      return 0;
1467  }  }
1468    
1469    
1470    /* Figure out if the clipboard contains a detached signature. */
1471  int  int
1472  fm_verify_pasted_detsig (listview_ctrl_t lv, HWND dlg)  fm_verify_pasted_detsig (listview_ctrl_t lv, HWND dlg)
1473  {  {
# Line 1458  fm_verify_pasted_detsig (listview_ctrl_t Line 1485  fm_verify_pasted_detsig (listview_ctrl_t
1485      /* XXX find a way to filter out bad signatures or just ignore all in      /* XXX find a way to filter out bad signatures or just ignore all in
1486             this case */             this case */
1487      fm_state_new (&ctx);      fm_state_new (&ctx);
1488      if ((i=listview_get_curr_pos (lv)) != -1) {      i = listview_get_curr_pos (lv);
1489        if (i= -1) {
1490          verify_pasted (lv, ctx, dat, i, dlg);          verify_pasted (lv, ctx, dat, i, dlg);
1491          fnd = 1;          fnd = 1;
1492      }      }
# Line 1490  get_output_file (fm_state_t c, const cha Line 1518  get_output_file (fm_state_t c, const cha
1518      else      else
1519          title = _("Selected Output File");          title = _("Selected Output File");
1520    
1521      if (strstr (name, ".sig") || strstr (name, ".asc") || strstr (name, ".gpg")) {      if (strstr (name, ".sig")
1522            || strstr (name, ".asc")
1523            || strstr (name, ".gpg")) {
1524          _snprintf (fname, sizeof (fname) - 1, "%s", name);          _snprintf (fname, sizeof (fname) - 1, "%s", name);
1525          fname[strlen (fname) - 4] = '\0';          fname[strlen (fname) - 4] = '\0';
1526          if (file_exist_check (fname) == 0 && detached)            if (file_exist_check (fname) == 0 && detached)  
# Line 1556  fm_verify (fm_state_t c, int detached, c Line 1586  fm_verify (fm_state_t c, int detached, c
1586          BUG (NULL);          BUG (NULL);
1587      file_verify_create_dlg ();      file_verify_create_dlg ();
1588    
1589      err = gpg_file_data_new (name, 1, &in);      err = gpg_file_data_new (name, F_DATA_READ, &in);
1590      if (err)      if (err)
1591          goto leave;          goto leave;
1592      err = gpg_file_data_new (c->output, detached? 1 : 0, &out);      err = gpg_file_data_new (c->output,
1593                                 detached? F_DATA_READ : F_DATA_WRITE, &out);
1594      if (err)      if (err)
1595          goto leave;          goto leave;
1596    
# Line 1588  leave: Line 1619  leave:
1619          gpg_file_data_release (in);          gpg_file_data_release (in);
1620      if (out)      if (out)
1621          gpg_file_data_release (out);          gpg_file_data_release (out);
1622      if (log.file)      free_if_alloc (log.file);
         delete []log.file;  
1623      return rc;      return rc;
1624  }  }
1625    
1626    
1627    /* Import the keys from the file @name.
1628       Return value: 0 on success. */
1629  int  int
1630  fm_import (fm_state_t c, const char *name)  fm_import (fm_state_t c, const char *name)
1631  {  {
# Line 1608  fm_import (fm_state_t c, const char *nam Line 1640  fm_import (fm_state_t c, const char *nam
1640      if (!c->output)      if (!c->output)
1641          BUG (NULL);          BUG (NULL);
1642    
1643      err = gpg_file_data_new (name, 1, &keydata);      err = gpg_file_data_new (name, F_DATA_READ, &keydata);
1644      if (err)      if (err)
1645          goto leave;          goto leave;
1646    
# Line 1624  fm_import (fm_state_t c, const char *nam Line 1656  fm_import (fm_state_t c, const char *nam
1656      res = gpgme_op_import_result (ctx);      res = gpgme_op_import_result (ctx);
1657      print_import_status (res);      print_import_status (res);
1658      if (res->no_user_id > 0) {      if (res->no_user_id > 0) {
1659          msg_box (c->dlg, _("Key without a self signature was dectected!\n"                msg_box (c->dlg, _("Key without a self signature was dectected!\n"
1660                             "(This key is NOT usable for encryption, etc)\n"                             "(This key is NOT usable for encryption, etc)\n"
1661                             "\n"                             "\n"
1662                             "Cannot import these key(s)!"), _("Import"), MB_INFO);                             "Cannot import these key(s)!"), _("Import"), MB_INFO);
# Line 1634  leave: Line 1666  leave:
1666      if (keydata)      if (keydata)
1667          gpg_file_data_release (keydata);          gpg_file_data_release (keydata);
1668      return rc;      return rc;
1669  } /* fm_import */  }
1670    
1671    
1672    /* Generate a user friendly file name based on the key @k. */
1673    static char*
1674    gen_key_outname (gpgme_key_t k)
1675    {
1676        char *p;
1677        size_t i;
1678    
1679        p = new char[strlen (k->uids->name)+1+8];
1680        if (!p)    
1681            BUG (NULL);
1682        sprintf (p, "%s.asc", k->uids->name);
1683        for (i=0; i < strlen (p); i++) {
1684            if (p[i] == ' ')
1685                p[i] = '_';
1686        }
1687        return p;
1688    }
1689    
1690    
1691  /* Export the selected keys from the File Manager to a file. */  /* Export the selected keys from the File Manager to a file. */
# Line 1655  fm_export (fm_state_t c) Line 1706  fm_export (fm_state_t c)
1706          goto leave;          goto leave;
1707      }      }
1708    
1709      if (rset[1] == NULL) { /* count == 1*/      if (rset[1] == NULL) /* count == 1*/
1710          gpgme_key_t k = rset[0];          p = gen_key_outname (rset[0]);
         const char *s = k->uids->name;  
         p = new char[strlen (s)+1+8];  
         if (!p)  
             BUG (NULL);  
         strcpy (p, s );  
         strcat (p, ".asc");  
     }  
1711    
1712      name = get_filename_dlg (c->dlg, FILE_SAVE, _("Choose Name for Key File"),      name = get_filesave_dlg (c->dlg, _("Choose Name for Key File"),
1713                               NULL, p? p : NULL);                               NULL, p? p : NULL);
                               
1714      if (!name)      if (!name)
1715          name = "keys.gpg";          name = "keys.gpg";
1716    
1717      patt = gpg_keylist_to_pattern (rset, c->n_recp);      patt = gpg_keylist_to_pattern (rset, c->n_recp);
1718    
1719      err = gpg_file_data_new (name, 0, &keydata);      err = gpg_file_data_new (name, F_DATA_WRITE, &keydata);
1720      if (err)      if (err)
1721          goto leave;          goto leave;
1722    
# Line 1693  leave: Line 1736  leave:
1736      if (patt)      if (patt)
1737          free (patt);          free (patt);
1738      free_if_alloc (p);      free_if_alloc (p);
           
1739      return rc;      return rc;
1740  }  }
1741    
# Line 1754  fm_parse_command_line (char *cmdl) Line 1796  fm_parse_command_line (char *cmdl)
1796                  detached = 1;                  detached = 1;
1797              fm_verify (ctx, detached, fn);              fm_verify (ctx, detached, fn);
1798              file_verify_wait ();              file_verify_wait ();
1799              break;              break;
1800    
1801            default:
1802                break;
1803          }          }
1804      }      }
1805    
# Line 1765  fm_parse_command_line (char *cmdl) Line 1810  fm_parse_command_line (char *cmdl)
1810  }  }
1811    
1812    
1813    /* Extract the last folder name from @name. */
1814  const char*  const char*
1815  default_dirname (const char *name)  default_dirname (const char *name)
1816  {  {
1817      char * p = strrchr( name, '\\' );      char *p = strrchr (name, '\\');
1818      if( !p )      if (!p)
1819          return NULL;          return NULL;
1820      return p+1;      return p+1;
1821  } /* default_dirname */  }
1822    
1823    
1824    /* Store all selected files from @lv in a zip archive
1825       and encrypt the zip archive then.
1826       Return value: 0 on success. */
1827  int  int
1828  fm_encrypt_directory( fm_state_t c, const char * name )  fm_encrypt_into_zip (fm_state_t ctx, listview_ctrl_t lv)
1829    {
1830        PK_FILE_LIST list=NULL;
1831        const char *outfile;
1832        char *out_enc;
1833        int nitems = listview_count_items (lv, 0);
1834        int i, idx = -1;
1835        int rc;
1836    
1837        if (!nitems) {
1838            msg_box (NULL, _("Encrypting into a ZIP archive makes sense with multiple files"),
1839                     _("File Manager"), MB_ERR);
1840            return WPTERR_GENERAL;
1841        }
1842    
1843        outfile = get_filesave_dlg (ctx->dlg, _("Choose File Name for Output"),
1844                                    NULL, "Encrypted_Files.zip");
1845        if (!outfile)
1846            return WPTERR_GENERAL;
1847    
1848        for (i=0; i < nitems; i++) {
1849            char name[300];
1850            if (!listview_get_item_state (lv, i))
1851                continue;
1852            if (idx == -1)
1853                idx = i;
1854            listview_get_item_text (lv, i, 1, name, sizeof (name)-1);
1855            pk_list_add (&list, name);
1856        }    
1857    
1858        pk_archiv_create (list, outfile);
1859        pk_list_free (list);
1860    
1861        rc = fm_encrypt (ctx, outfile, 0);
1862        DeleteFile (outfile);
1863        if (rc)
1864            return rc;
1865    
1866        out_enc = make_filename (NULL, outfile, "gpg");
1867        fm_set_status (lv, idx, FM_ENCRYPT, (gpgme_sig_mode_t)0, 1, out_enc);
1868        free_if_alloc (out_enc);
1869    
1870        for (i=0; i < nitems; i++) {
1871            if (i != idx && listview_get_item_state (lv, i))
1872                listview_del_item (lv, i);
1873        }
1874        return 0;
1875    }
1876    
1877    
1878    int
1879    fm_encrypt_directory (fm_state_t c, const char *name)
1880  {  {
1881      PK_FILE_LIST list = NULL;      PK_FILE_LIST list = NULL;
1882      WIN32_FIND_DATA findbuf;      WIN32_FIND_DATA findbuf;
# Line 1785  fm_encrypt_directory( fm_state_t c, cons Line 1885  fm_encrypt_directory( fm_state_t c, cons
1885      char * patt = NULL, * p;      char * patt = NULL, * p;
1886      int rc = 0;      int rc = 0;
1887            
1888      if( !is_directory( name ) )          if (!is_directory (name))
1889          return -1;          return -1;
1890      patt = new char[strlen( name ) + 4];      patt = new char[strlen (name) + 4];
1891      if( !patt )      if (!patt)
1892          BUG( NULL );          BUG (NULL);
1893      strcpy( patt, name );      strcpy (patt, name);
1894      strcat( patt, "\\*" );      strcat (patt, "\\*");
1895      hd = FindFirstFile( patt, &findbuf );          hd = FindFirstFile (patt, &findbuf);
1896      if( !hd ) {      if (!hd) {
1897          free_if_alloc( patt );            free_if_alloc (patt);
1898          return -1;                return WPTERR_GENERAL;
1899      }      }
1900      if( strcmp( findbuf.cFileName, "." ) && strcmp( findbuf.cFileName, ".." ) ) {      if( strcmp( findbuf.cFileName, "." ) && strcmp( findbuf.cFileName, ".." ) ) {
1901          p = make_filename( name, findbuf.cFileName, NULL );          p = make_filename( name, findbuf.cFileName, NULL );
# Line 1809  fm_encrypt_directory( fm_state_t c, cons Line 1909  fm_encrypt_directory( fm_state_t c, cons
1909              free_if_alloc( p );              free_if_alloc( p );
1910          }          }
1911      }      }
1912      s = get_filename_dlg( c->dlg, FILE_SAVE, _("Choose a Name for the Archive"),      s = get_filesave_dlg (c->dlg, _("Choose a Name for the Archive"),
1913                            NULL, default_dirname( name ) );                            NULL, default_dirname (name));
1914      if( !s ) {      if( !s ) {
1915          msg_box( c->dlg, _("Invalid archive name. Exit."), _("Encrypt Directory"), MB_ERR );          msg_box( c->dlg, _("Invalid archive name. Exit."), _("Encrypt Directory"), MB_ERR );
1916          rc = -1;          rc = -1;
# Line 1822  fm_encrypt_directory( fm_state_t c, cons Line 1922  fm_encrypt_directory( fm_state_t c, cons
1922          msg_box( c->dlg, _("Could not create zip archive."), _("Encrypt Directory"), MB_ERR );          msg_box( c->dlg, _("Could not create zip archive."), _("Encrypt Directory"), MB_ERR );
1923      else {      else {
1924          fm_encrypt( c, s, 0 );          fm_encrypt( c, s, 0 );
1925          unlink( s );          remove( s );
1926      }      }
1927  leave:  leave:
1928      FindClose (hd);      FindClose (hd);
1929      pk_list_free( list );      pk_list_free( list );
1930      free_if_alloc( patt );      free_if_alloc( patt );
1931      return rc;      return rc;
1932  } /* fm_encrypt_directory */  }
1933    
1934    
1935  static int CALLBACK  static int CALLBACK
1936  fm_cmp_cb( LPARAM first, LPARAM second, LPARAM sortby )  fm_cmp_cb (LPARAM first, LPARAM second, LPARAM sortby)
1937  {  {
1938      const char * a = 0, * b = 0;      const char *a = 0;
1939        const char *b = 0;
1940    
1941      switch( (int)sortby ) {      switch( (int)sortby ) {
1942      case FM_SORT_STAT:      case FM_SORT_STAT:
# Line 1845  fm_cmp_cb( LPARAM first, LPARAM second, Line 1946  fm_cmp_cb( LPARAM first, LPARAM second,
1946      case FM_SORT_OP:      case FM_SORT_OP:
1947          break;          break;
1948      }      }
1949      return stricmp( a, b );      return stricmp (a, b);
1950  } /* fm_cmp_cb */  }
1951                    
1952    
1953    /* Sort the list items from @lv with the mode given by @sortby. */
1954  int  int
1955  fm_sort( listview_ctrl_t lv, int sortby )  fm_sort (listview_ctrl_t lv, int sortby)
1956  {  {
1957      return listview_sort_items( lv, sortby, fm_cmp_cb );      return listview_sort_items( lv, sortby, fm_cmp_cb );
1958  } /* fm_sort */  }
1959    
1960    
1961    /* Start the 'print md' dialog. Pass over the listview control
1962       @lv and the digest algo @mdalgo. */
1963  void  void
1964  fm_print_md( listview_ctrl_t lv, HWND dlg, int mdalgo )  fm_print_md (listview_ctrl_t lv, HWND dlg, int mdalgo)
1965  {  {
1966      struct md_file_s mdctx;      struct md_file_s mdctx;
1967    
1968      if( listview_count_items( lv, 0 ) == 0 )      if (listview_count_items (lv, 0) == 0)
1969          return;          return;
1970      memset (&mdctx, 0, sizeof (mdctx));      memset (&mdctx, 0, sizeof (mdctx));
1971      mdctx.lv = lv;      mdctx.lv = lv;
1972      mdctx.mdalgo = mdalgo;      mdctx.mdalgo = mdalgo;
1973      DialogBoxParam( glob_hinst, (LPCTSTR)IDD_WINPT_FILE_MDSUM, dlg,      DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILE_MDSUM, dlg,
1974                      mdsum_dlg_proc, (LPARAM)&mdctx );                      mdsum_dlg_proc, (LPARAM)&mdctx);
1975  } /* fm_print_md */  }
1976    
1977    
1978    /* Send the selected file in @lv via MAPI to a mail recipient. */
1979  int  int
1980  fm_send_file (listview_ctrl_t lv)  fm_send_file (listview_ctrl_t lv)
1981  {  {
# Line 1878  fm_send_file (listview_ctrl_t lv) Line 1983  fm_send_file (listview_ctrl_t lv)
1983      int rc;      int rc;
1984    
1985      rc = listview_get_item_text (lv, -1, 1, buf, sizeof (buf)-1);      rc = listview_get_item_text (lv, -1, 1, buf, sizeof (buf)-1);
1986      if (rc == -1)      if (rc != -1)
1987          return 0;          mapi_send_ascfile (buf);
     /*mapi_send_ascfile (buf); XXX */  
1988      return 0;      return 0;
1989  }  }

Legend:
Removed from v.76  
changed lines
  Added in v.119

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26