- Timestamp:
- 12/09/10 07:01:43 (14 years ago)
- Location:
- server/trunk/web/lib/Sophie
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Controller/Chat/Cmd.pm
r100 r102 27 27 =head2 REPLY 28 28 29 =head1 AVAILLABLE FUNCTIONS 30 29 31 =cut 30 32 … … 44 46 } 45 47 48 =head2 help [cmd] 46 49 50 Return help about command cmd or list availlable command. 47 51 52 =cut 48 53 49 54 sub help : XMLRPC { 50 my ( $self, $c, $reqspec, @args ) = @_; 51 return $c->{stash}->{xmlrpc} = { 52 private_reply => 1, 53 message => [ 54 'availlable command:', 55 join(', ', grep { $_ !~ /^end$/ } @{ $self->_commands }), 56 ], 55 my ( $self, $c, $reqspec, $cmd ) = @_; 56 if ($cmd) { 57 my @message = grep { /\S+/ } split(/\n/, 58 $c->model('Help::POD')->bot_help_text($cmd) || 'No help availlable'); 59 return $c->{stash}->{xmlrpc} = { 60 private_reply => 1, 61 message => \@message, 62 }; 63 } else { 64 return $c->{stash}->{xmlrpc} = { 65 private_reply => 1, 66 message => [ 67 'availlable command:', 68 join(', ', grep { $_ !~ /^end$/ } @{ $self->_commands }), 69 ], 70 } 57 71 } 58 72 } 73 74 =head2 asv 75 76 ASV means in french "age, sexe, ville" (age, sex and town). 77 Return the version of the Chat module version. 78 79 =cut 59 80 60 81 sub asv : XMLRPC { … … 87 108 message => \@message, 88 109 } 110 } 111 112 sub v : XMLRPC { 113 my ($self, $c, @args) = @_; 114 $c->forward('version', [ @args ]); 89 115 } 90 116 -
server/trunk/web/lib/Sophie/Model/Help/POD.pm
r62 r102 5 5 use Pod::POM; 6 6 use Pod::POM::View::HTML; 7 use Pod::POM::View::Text; 7 8 8 9 extends 'Catalyst::Model'; … … 31 32 return values %{ $self->{pom} } 32 33 } 34 35 sub bot_functions { 36 my ($self) = @_; 37 my $botpom = $self->{pom}{'Chat::Cmd'}; 38 foreach my $head1 ($botpom->content) { 39 $head1->title eq 'AVAILLABLE FUNCTIONS' or next; 40 return map { $_->title } $head1->content; 41 } 42 } 43 44 sub bot_help_text { 45 my ($self, $cmd) = @_; 46 my $botpom = $self->{pom}{'Chat::Cmd'}; 47 foreach my $head1 ($botpom->content) { 48 $head1->title eq 'AVAILLABLE FUNCTIONS' or next; 49 foreach ($head1->content) { 50 $_->title =~ /^\Q$cmd\E( |$)/ or next; 51 my $ppvt = Pod::POM::View::Text->new; 52 return $_->present($ppvt); 53 } 54 last; 55 } 56 return; 57 } 58 33 59 34 60 sub xmlrpc_functions {
Note: See TracChangeset
for help on using the changeset viewer.