File: Crypt.pm

package info (click to toggle)
pronto 2.2.6-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,892 kB
  • ctags: 406
  • sloc: perl: 21,215; makefile: 145; sh: 34
file content (126 lines) | stat: -rw-r--r-- 2,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# $Id: Crypt.pm,v 1.2 2001/02/03 14:56:35 muhri Exp $
# -*- perl -*-
package Pronto::Crypt;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;

@ISA = qw(Exporter AutoLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw(
	
);
$VERSION = '0.01';

sub get_addresses_from_string {
	my $self = shift;
        my $string = shift;
        my @raw_addresses;
        my @addresses;

        $self->wr_debug("get_addresses_from_string\($string\)");

        @raw_addresses = split(/[<>\s,\")(]+/, $string);
        $self->wr_debug("Fragments: @raw_addresses");

        foreach my $frag (@raw_addresses) {
                if ($frag =~ /\@/) {
                        push(@addresses, $frag);
                        $self->wr_debug("$frag: Valid Email address");
                } else {
                $self->wr_debug("$frag: Invalid Email address");
                }
        }

         return(@addresses);

}


sub obtain_passphrase {
	my $self = shift;
	print("obtain passphase object: $self\n");
        my $passwindow = new Gtk::Window(-toplevel);
        $passwindow->set_title(_("Please enter your passphrase"));	#" Dont ask.
        my $hbox = new Gtk::HBox(0,0);
        my $label = new Gtk::Label(_("Passphrase"));
        my $entry = new Gtk::Entry();
        $entry->set_visibility(0);
        my $button = new Gtk::Button(_("Submit"));
        $button->signal_connect('clicked', \&set_passphrase, $entry, $passwindow, $self);

        $hbox->pack_start($label,0,0,0);
        $hbox->pack_start($entry,0,0,0);
        $hbox->pack_start($button,0,0,0);

        $passwindow->add($hbox);
        $button->show;
        $hbox->show;
        $label->show;
        $entry->show;
        $passwindow->show;

        return 1;
}

sub set_passphrase {
        my $button = shift;
        my $entry = shift;
        my $passwin = shift;
        my $self = shift;

        $self->{passphrase} = $entry->get_text;
	$self->wr_debug("Got passphrase: $self->{passphrase}");
        $passwin->destroy;
        return 1;
}

sub keyserver_search_window {
	my $self = shift;
        $self->wr_debug("Opening keyserver search window");
        return 1;
}

sub wr_debug {
	print(STDERR "@_\n");
}


# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

1;
__END__
# Below is the stub of documentation for your module. You better edit it!

=head1 NAME

Pronto::Crypt - Perl extension for blah blah blah

=head1 SYNOPSIS

  use Pronto::Crypt;
  blah blah blah

=head1 DESCRIPTION

Stub documentation for Pronto::Crypt was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head1 AUTHOR

A. U. Thor, a.u.thor@a.galaxy.far.far.away

=head1 SEE ALSO

perl(1).

=cut