| 1 | package DJabberd::Authen; | ||||||||||
| 2 | 17 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 17 | ▶ | use base 'DJabberd::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | sub register { | ||||||||||
| 6 | 73 | ▶ | my ($self, $vhost) = @_; | ||||||||
|
Subroutine
register: called CC=5 SCAR=19.9
Pod
undocumented
| |||||||||||
| 7 | |||||||||||
| 8 | # my $which; | ||||||||||
| 9 | # if (($which = $self->can('foo')) && $which != &base_class_one) { | ||||||||||
| 10 | # } | ||||||||||
| 11 | |||||||||||
| 12 | 73 | ▶ | if ($self->can_retrieve_cleartext) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | $vhost->register_hook("GetPassword", sub { | ||||||||||
| 14 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 15 | # args as 'username' and 'conn'; | ||||||||||
| 16 | # cb can ->set or ->decline | ||||||||||
| 17 | 0 | $self->get_password($cb, %args); | |||||||||
| 18 | 37 | }); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 73 | ▶ | if ($self->can_check_digest) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | $vhost->register_hook("CheckDigest", sub { | ||||||||||
| 23 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 24 | # args as 'username', 'conn', 'digest' | ||||||||||
| 25 | # cb can ->accept or ->reject | ||||||||||
| 26 | 0 | $self->check_digest($cb, %args); | |||||||||
| 27 | 0 | }); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | $vhost->register_hook("CheckCleartext", sub { | ||||||||||
| 31 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 32 | # args containing: username, conn, password | ||||||||||
| 33 | 0 | $self->check_cleartext($cb, %args); | |||||||||
| 34 | 73 | }); | |||||||||
| 35 | |||||||||||
| 36 | $vhost->register_hook("CheckJID", sub { | ||||||||||
| 37 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 38 | # args contain: username and conn | ||||||||||
| 39 | 0 | $self->check_jid($cb, %args); | |||||||||
| 40 | |||||||||||
| 41 | 73 | }); | |||||||||
| 42 | |||||||||||
| 43 | 73 | ▶ | if ($self->can_register_jids) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | $vhost->register_hook("RegisterJID", sub { | ||||||||||
| 45 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 46 | # args containing: username, password | ||||||||||
| 47 | # cb can: | ||||||||||
| 48 | # conflict | ||||||||||
| 49 | # error | ||||||||||
| 50 | # saved | ||||||||||
| 51 | 0 | $self->register_jid($cb, %args); | |||||||||
| 52 | 1 | }); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 73 | ▶ | if ($self->can_unregister_jids) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | $vhost->register_hook("UnregisterJID", sub { | ||||||||||
| 57 | 0 | ▶ | my (undef, $cb, %args) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 58 | # args containing: username | ||||||||||
| 59 | # cb can: | ||||||||||
| 60 | # conflict | ||||||||||
| 61 | # error | ||||||||||
| 62 | # saved | ||||||||||
| 63 | 0 | $self->unregister_jid($cb, %args); | |||||||||
| 64 | 1 | }); | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub can_register_jids { | ||||||||||
| 70 | 72 | ▶ | 0; | ||||||||
|
Subroutine
can_register_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | sub can_unregister_jids { | ||||||||||
| 74 | 72 | ▶ | 0; | ||||||||
|
Subroutine
can_unregister_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | sub can_retrieve_cleartext { | ||||||||||
| 78 | 36 | ▶ | 0; | ||||||||
|
Subroutine
can_retrieve_cleartext: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | sub can_check_digest { | ||||||||||
| 82 | 73 | ▶ | 0; | ||||||||
|
Subroutine
can_check_digest: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | sub check_jid { | ||||||||||
| 86 | 0 | ▶ | my ($self, $cb, %args) = @_; | ||||||||
|
Subroutine
check_jid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 87 | 0 | return 0; | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | sub unregister_jid { | ||||||||||
| 91 | 0 | ▶ | my ($self, $cb, %args) = @_; | ||||||||
|
Subroutine
unregister_jid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 92 | 0 | return 0; | |||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | sub check_cleartext { | ||||||||||
| 96 | 0 | ▶ | my ($self, $cb, %args) = @_; | ||||||||
|
Subroutine
check_cleartext: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 97 | 0 | $cb->reject; | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | sub check_digest { | ||||||||||
| 101 | 0 | ▶ | my ($self, $cb, %args) = @_; | ||||||||
|
Subroutine
check_digest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 102 | 0 | $cb->reject; | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | 17 | 1; | |||||||||