home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Mail / Bundles / EnhanceMail-2.1-MIHS / ComposeHelper.m < prev    next >
Encoding:
Text File  |  1997-04-20  |  1.6 KB  |  70 lines

  1. /* -*-C-*-
  2. *******************************************************************************
  3. *
  4. * File:         ComposeHelper.m
  5. * RCS:          /usr/local/sources/CVS/EnhanceMail/ComposeHelper.m,v 1.2 1997/04/20 13:25:31 tom Exp
  6. * Description:  
  7. * Author:       Carl Edman
  8. * Created:      Fri Oct 13 11:48:05 1995
  9. * Modified:     Tue Jun 25 20:02:38 1996 (Carl Edman) cedman@capitalist.princeton.edu
  10. * Language:     C
  11. * Package:      N/A
  12. * Status:       Experimental (Do Not Distribute)
  13. *
  14. * (C) Copyright 1995, but otherwise this file is perfect freeware.
  15. *
  16. *******************************************************************************
  17. */
  18.  
  19. #import "EnhanceMail.h"
  20. #import "ComposeHelper.h"
  21. #import "Preferences.h"
  22. #import "PGP.h"
  23.  
  24. @implementation EnhanceComposeHelper
  25.  
  26. + finishLoading:(struct mach_header *)header
  27. {
  28.    [NXApp addComposeHelperClass:self];
  29.    return self;
  30. }
  31.  
  32.  
  33. - init
  34. {
  35.    if (self=[super init])
  36.    {
  37.       if (EnhanceUsePGP)
  38.       {
  39.      char path[MAXPATHLEN];
  40.  
  41.      if ([EnhanceBundle getPath:path forResource:"EncryptComposeHelper" ofType:"nib"])
  42.         [NXApp loadNibFile:path owner:self];
  43.  
  44.      [encryptSwitch setState:EnhancePGPEncrypt];
  45.      [signSwitch setState:EnhancePGPSign];
  46.       }
  47.    }
  48.    return self;
  49. }
  50.  
  51. - (View *)composeView
  52. {
  53.    if (EnhanceUsePGP) return accessoryBox;
  54.    return nil;
  55. }
  56.  
  57. - (BOOL)willDeliverMessage:(MailMessage *)mes to:(StringList *)rcpt
  58. {
  59.    if (EnhanceUsePGP)
  60.    {
  61.       BOOL shouldSign=[signSwitch state];
  62.       BOOL shouldEncrypt=[encryptSwitch state];
  63.       if ([[EnhancePGP new] encodePGP:mes to:rcpt sign:shouldSign encrypt:shouldEncrypt]==NO)
  64.          return NO;
  65.    }
  66.    return YES;
  67. }
  68.  
  69. @end // EnhanceComposeHelper
  70.