Last change
on this file since 38 was
38,
checked in by nanardon, 14 years ago
|
- start explorer page
- some function in Chat/
|
File size:
1.2 KB
|
Line | |
---|
1 | package Sophie::Controller::Chat; |
---|
2 | use Moose; |
---|
3 | use namespace::autoclean; |
---|
4 | use Getopt::Long; |
---|
5 | use Text::ParseWords; |
---|
6 | |
---|
7 | BEGIN {extends 'Catalyst::Controller'; } |
---|
8 | |
---|
9 | =head1 NAME |
---|
10 | |
---|
11 | Sophie::Controller::Chat - Catalyst Controller |
---|
12 | |
---|
13 | =head1 DESCRIPTION |
---|
14 | |
---|
15 | Catalyst Controller. |
---|
16 | |
---|
17 | =head1 METHODS |
---|
18 | |
---|
19 | =cut |
---|
20 | |
---|
21 | |
---|
22 | =head2 index |
---|
23 | |
---|
24 | =cut |
---|
25 | |
---|
26 | sub index :Path :Args(0) { |
---|
27 | my ( $self, $c ) = @_; |
---|
28 | |
---|
29 | |
---|
30 | } |
---|
31 | |
---|
32 | sub message : XMLRPC { |
---|
33 | my ($self, $c, $contexts, $message) = @_; |
---|
34 | |
---|
35 | my $reqspec = {}; |
---|
36 | |
---|
37 | foreach my $co (ref $contexts ? @$contexts : $contexts) { |
---|
38 | if (ref($co) eq 'HASH') { |
---|
39 | foreach (keys %$co) { |
---|
40 | $reqspec->{$_} = $co->{$_}; |
---|
41 | } |
---|
42 | } else { |
---|
43 | if (my $coo = $c->forward('/user/fetchdata', [ $co ])) { |
---|
44 | foreach (keys %$coo) { |
---|
45 | $reqspec->{$_} = $coo->{$_}; |
---|
46 | } |
---|
47 | } |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | my ($cmd, @args) = Text::ParseWords::shellwords($message); |
---|
52 | |
---|
53 | if ($c->get_action( $cmd, '/chat/cmd' )) { |
---|
54 | $c->forward('/chat/cmd/' . $cmd, [ $reqspec, @args ]); |
---|
55 | } |
---|
56 | } |
---|
57 | |
---|
58 | =head1 AUTHOR |
---|
59 | |
---|
60 | Olivier Thauvin |
---|
61 | |
---|
62 | =head1 LICENSE |
---|
63 | |
---|
64 | This library is free software. You can redistribute it and/or modify |
---|
65 | it under the same terms as Perl itself. |
---|
66 | |
---|
67 | =cut |
---|
68 | |
---|
69 | __PACKAGE__->meta->make_immutable; |
---|
70 | |
---|
71 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.