source: server/trunk/web/lib/Sophie/Controller/Chat.pm @ 38

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 
1package Sophie::Controller::Chat;
2use Moose;
3use namespace::autoclean;
4use Getopt::Long;
5use Text::ParseWords;
6
7BEGIN {extends 'Catalyst::Controller'; }
8
9=head1 NAME
10
11Sophie::Controller::Chat - Catalyst Controller
12
13=head1 DESCRIPTION
14
15Catalyst Controller.
16
17=head1 METHODS
18
19=cut
20
21
22=head2 index
23
24=cut
25
26sub index :Path :Args(0) {
27    my ( $self, $c ) = @_;
28
29
30}
31
32sub 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
60Olivier Thauvin
61
62=head1 LICENSE
63
64This library is free software. You can redistribute it and/or modify
65it under the same terms as Perl itself.
66
67=cut
68
69__PACKAGE__->meta->make_immutable;
70
711;
Note: See TracBrowser for help on using the repository browser.