Protocol-OTR

 view release on metacpan or  search on metacpan

lib/Protocol/OTR/Contact.pm  view on Meta::CPAN

            on_timer => {
                optional => 1,
                type => CODEREF,
            },
            on_smp => {
                optional => 1,
                type => CODEREF,
            },
            on_error => {
                optional => 1,
                type => CODEREF,
            },
            on_event => {
                optional => 1,
                type => CODEREF,
            },
            on_smp_event => {
                optional => 1,
                type => CODEREF,
            },
            on_before_encrypt => {
                optional => 1,
                type => CODEREF,
            },
            on_after_decrypt => {
                optional => 1,
                type => CODEREF,
            },
            on_is_contact_logged_in => {
                optional => 1,
                type => CODEREF,
            },
        }
    );

    return Protocol::OTR::Channel->_new($self, \%args);
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Protocol::OTR::Contact - Off-the-Record Contact

=head1 VERSION

version 0.05

=head1 SYNOPSIS

    use Protocol::OTR qw( :constants );

    my $otr = Protocol::OTR->new(
        {
            privkeys_file => "otr.private_key",
            contacts_file => "otr.fingerprints",
            instance_tags_file => "otr.instance_tags",
        }
    );

    # find or create account
    my $alice = $otr->account('alice@domain', 'prpl-jabber');

    # find or create contact known by $alice
    my $bob = $alice->contact('bob@domain');

    # return all $bob's fingerprints
    my @fingerprints = $bob->fingerprints();

    # current active fingerprint
    my $active_fingerprint = $bob->active_fingerprint();

    # create secure channel to Bob
    my $channel = $bob->channel(
        {
            policy => ...,
            max_message_size => ...,
            on_write => sub { ... },
            on_read => sub { ... },
            on_gone_secure => sub { ... },
            on_gone_insecure => sub { ... },
            on_still_secure => sub { ... },
            on_unverified_fingerprint => sub { ... },
            on_symkey => sub { ... },
            on_timer => sub { ... },
            on_smp => sub { ... },
            on_error => sub { ... },
            on_event => sub { ... },
            on_smp_event => sub { ... },
            on_before_encrypt => sub { ... },
            on_after_decrypt => sub { ... },
            on_is_contact_logged_in => sub { ... },
        }
    );

=head1 DESCRIPTION

L<Protocol::OTR::Contact> represents the OTR contact.

=head1 METHODS

=head2 account

    my $account = $contact->account();

Returns contact's L<Protocol::OTR::Account> object.

=head2 name

    my $name = $contact->name();

Returns contact's name.

=head2 fingerprints



( run in 0.834 second using v1.01-cache-2.11-cpan-39bf76dae61 )