]>
Commit | Line | Data |
---|---|---|
aecfa1fd | 1 | # This file is part of SurrealServices. |
2 | # | |
3 | # SurrealServices is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # SurrealServices is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with SurrealServices; if not, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
16 | ||
17 | package SrSv::Unreal::Tokens; | |
18 | ||
19 | use strict; | |
20 | ||
21 | use SrSv::Conf::main; | |
22 | use SrSv::Conf2Consts qw( main ); | |
23 | ||
24 | use Exporter 'import'; | |
25 | ||
26 | #=cut | |
27 | our $tkn = main_conf_tokens; | |
28 | ||
29 | our %tkn; | |
30 | #=cut | |
31 | BEGIN { | |
32 | # TODO: Turn these into constants. | |
33 | my %unrealTokens = ( | |
34 | PRIVMSG => ['PRIVMSG', '!'], | |
35 | WHOIS => ['WHOIS', '#'], | |
36 | WHOWAS => ['WHOWAS', '$'], | |
37 | USER => ['USER', '%'], | |
38 | NICK => ['NICK', '&'], | |
39 | SERVER => ['SERVER', "\'"], | |
40 | LIST => ['LIST', '('], | |
41 | TOPIC => ['TOPIC', ')'], | |
42 | INVITE => ['INVITE', '*'], | |
43 | VERSION => ['VERSION', '+'], | |
44 | QUIT => ['QUIT', ','], | |
45 | SQUIT => ['SQUIT', '-'], | |
46 | KILL => ['KILL', '.'], | |
47 | INFO => ['INFO', '/'], | |
48 | LINKS => ['LINKS', '0'], | |
49 | STATS => ['STATS', '2'], | |
50 | USERS => ['USERS', '3'], | |
51 | ERROR => ['ERROR', '5'], | |
52 | AWAY => ['AWAY', '6'], | |
53 | CONNECT => ['CONNECT', '7'], | |
54 | PING => ['PING', '8'], | |
55 | PONG => ['PONG', '9'], | |
56 | OPER => ['OPER', ';'], | |
57 | PASS => ['PASS', '<'], | |
58 | WALLOPS => ['WALLOPS', '='], | |
59 | GLOBOPS => ['GLOBOPS', ']'], | |
60 | TIME => ['TIME', '>'], | |
61 | NAMES => ['NAMES', '?'], | |
62 | SJOIN => ['SJOIN', '~'], | |
63 | NOTICE => ['NOTICE', 'B'], | |
64 | JOIN => ['JOIN', 'C'], | |
65 | PART => ['PART', 'D'], | |
66 | MODE => ['MODE', 'G'], | |
67 | KICK => ['KICK', 'H'], | |
68 | USERHOST => ['USERHOST', 'J'], | |
69 | SQLINE => ['SQLINE', 'c'], | |
70 | UNSQLINE => ['UNSQLINE', 'd'], | |
71 | SVSNICK => ['SVSNICK', 'e'], | |
72 | SVSNOOP => ['SVSNOOP', 'f'], | |
73 | SVSKILL => ['SVSKILL', 'h'], | |
74 | SVSMODE => ['SVSMODE', 'n'], | |
75 | SVS2MODE => ['SVS2MODE', 'v'], | |
76 | CHGHOST => ['CHGHOST', 'AL'], | |
77 | CHGIDENT => ['CHGIDENT', 'AZ'], | |
78 | NETINFO => ['NETINFO', 'AO'], | |
79 | TSCTL => ['TSCTL', 'AW'], | |
80 | SWHOIS => ['SWHOIS', 'BA'], | |
81 | SVSO => ['SVSO', 'BB'], | |
82 | # One may note... that although there is a TKL Token | |
83 | # it does not appear to always be used. | |
84 | # Maybe b/c 2 vs 3 chars, nobody cares. | |
85 | TKL => ['TKL', 'BD'], | |
86 | SHUN => ['SHUN', 'BL'], | |
87 | SVSJOIN => ['SVSJOIN', 'BX'], | |
88 | SVSPART => ['SVSPART', 'BT'], | |
89 | SVSSILENCE => ['SVSSILENCE','Bs'], | |
90 | SVSWATCH => ['SVSWATCH', 'Bw'], | |
91 | SVSSNO => ['SVSSNO', 'BV'], | |
92 | SENDSNO => ['SENDSNO', 'Ss'], | |
93 | ||
94 | EOS => ['EOS', 'ES'], | |
5e682044 | 95 | ENDBURST => ['ENDBURST'], |
aecfa1fd | 96 | UMODE2 => ['UMODE2', "\|"], |
97 | ||
98 | REHASH => ['REHASH', 'O'], | |
99 | ||
100 | SVSNOLAG => ['SVSNOLAG', 'sl'], | |
101 | SVS2NOLAG => ['SVS2NOLAG', 'SL'], | |
102 | ); | |
103 | ||
104 | %tkn = %unrealTokens; | |
105 | my %msgs; map { $msgs{"MSG_$_"} = $unrealTokens{$_}->[0] } keys(%unrealTokens); | |
106 | my %toks; | |
107 | if(main_conf_tokens) { | |
108 | map { $toks{"TOK_$_"} = $unrealTokens{$_}->[1] } keys(%unrealTokens); | |
109 | } else { | |
110 | map { $toks{"TOK_$_"} = $unrealTokens{$_}->[0] } keys(%unrealTokens); | |
111 | } | |
112 | require constant; | |
113 | import constant \%toks; | |
114 | import constant \%msgs; | |
115 | ||
116 | our @EXPORT_OK = ( | |
117 | keys(%toks), | |
118 | keys(%msgs), | |
119 | qw( %tkn $tkn ) | |
120 | ); | |
121 | our %EXPORT_TAGS = ( | |
122 | tokens => [keys(%toks)], | |
123 | messages => [keys(%msgs)], | |
124 | ); | |
125 | } | |
126 | ||
127 | 1; |