]>
Commit | Line | Data |
---|---|---|
e20e5a6b | 1 | qwebirc.ui.themes.ThemeControlCodeMap = { |
9e769c12 CP |
2 | "C": "\x03", |
3 | "B": "\x02", | |
4 | "U": "\x1F", | |
5 | "O": "\x0F", | |
f121b688 CP |
6 | "{": "\x00", |
7 | "}": "\x00", | |
1d93b67f | 8 | "[": "qwebirc://whois/", |
925fc357 | 9 | "]": "/", |
9e769c12 CP |
10 | "$": "$" |
11 | }; | |
12 | ||
e20e5a6b | 13 | qwebirc.ui.themes.Default = { |
9e769c12 CP |
14 | "PREFIX": ["$C4==$O "], |
15 | "SIGNON": ["Signed on!", true], | |
fc38a626 CP |
16 | "CONNECTING": ["Connecting to server, please wait...", true], |
17 | "CONNECT": ["Logging in, please wait...", true], | |
18 | "CONNECTED": ["Connected and logged in -- ready to go!", true], | |
9e769c12 | 19 | "RAW": ["$m", true], |
8dc46dfa | 20 | "DISCONNECT": ["Disconnected from server: $m", true], |
9e769c12 CP |
21 | "ERROR": ["ERROR: $m", true], |
22 | "SERVERNOTICE": ["$m", true], | |
f121b688 CP |
23 | "JOIN": ["${$N$} [$h] has joined $c", true], |
24 | "OURJOIN": ["${$N$} [$h] has joined $c", true], | |
25 | "PART": ["${$N$} [$h] has left $c [$m]", true], | |
26 | "KICK": ["${$v$} was kicked from $c by ${$N$} [$m]", true], | |
27 | "MODE": ["mode/$c [$m] by ${$N$}", true], | |
28 | "QUIT": ["${$N$} [$h] has quit [$m]", true], | |
29 | "NICK": ["${$n$} has changed nick to ${$[$w$]$}", true], | |
30 | "TOPIC": ["${$N$} changed the topic of $c to: $m", true], | |
9f680575 | 31 | "UMODE": ["Usermode change: $m", true], |
925fc357 | 32 | "INVITE": ["$N invites you to join $c", true], |
96f28062 CP |
33 | "HILIGHT": ["$C4"], |
34 | "HILIGHTEND": ["$O"], | |
f121b688 | 35 | "CHANMSG": ["<${$@$($N$)$}> $m"], |
925fc357 | 36 | "PRIVMSG": ["<$($N$)> $m"], |
f121b688 | 37 | "CHANNOTICE": ["-${$($N$)$}:$c- $m"], |
925fc357 | 38 | "PRIVNOTICE": ["-$($N$)- $m"], |
f121b688 CP |
39 | "OURCHANMSG": ["<$@$N> $m"], |
40 | "OURPRIVMSG": ["<$N> $m"], | |
925fc357 CP |
41 | "OURTARGETEDMSG": ["*$[$t$]* $m"], |
42 | "OURTARGETEDNOTICE": ["[notice($[$t$])] $m"], | |
43 | "OURCHANNOTICE": ["-$N:$t- $m"], | |
44 | "OURPRIVNOTICE": ["-$N- $m"], | |
45 | "OURCHANACTION": [" * $N $m"], | |
46 | "OURPRIVACTION": [" * $N $m"], | |
f121b688 | 47 | "CHANACTION": [" * ${$($N$)$} $m"], |
925fc357 CP |
48 | "PRIVACTION": [" * $($N$) $m"], |
49 | "CHANCTCP": ["$N [$h] requested CTCP $x from $c: $m"], | |
50 | "PRIVCTCP": ["$N [$h] requested CTCP $x from $-: $m"], | |
51 | "CTCPREPLY": ["CTCP $x reply from $N: $m"], | |
9e769c12 CP |
52 | "OURCHANCTCP": ["[ctcp($t)] $x $m"], |
53 | "OURPRIVCTCP": ["[ctcp($t)] $x $m"], | |
1d6756bc | 54 | "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"], |
925fc357 | 55 | "WHOISUSER": ["$B$N$B [$h]", true], |
1d6756bc CP |
56 | "WHOISREALNAME": [" realname : $m", true], |
57 | "WHOISCHANNELS": [" channels : $m", true], | |
58 | "WHOISSERVER": [" server : $x [$m]", true], | |
2cd9e32d | 59 | "WHOISACCOUNT": [" account : qwebirc://qwhois/$m", true], |
1d6756bc CP |
60 | "WHOISIDLE": [" idle : $x [connected: $m]", true], |
61 | "WHOISAWAY": [" away : $m", true], | |
62 | "WHOISOPER": [" : $BIRC Operator$B", true], | |
63 | "WHOISOPERNAME": [" operedas : $m", true], | |
64 | "WHOISACTUALLY": [" realhost : $m [ip: $x]", true], | |
a66bd43f | 65 | "WHOISGENERICTEXT": [" : $m", true], |
1d6756bc | 66 | "WHOISEND": ["End of WHOIS", true], |
925fc357 | 67 | "AWAY": ["$N is away: $m", true], |
574dff59 | 68 | "GENERICERROR": ["$m: $t", true], |
c270c730 | 69 | "GENERICMESSAGE": ["$m", true], |
a7048d8f CP |
70 | "WALLOPS": ["WALLOP $n: $t", true], |
71 | "CHANNELCREATIONTIME": ["Channel $c was created at: $m", true], | |
b90b6d5f CP |
72 | "CHANNELMODEIS": ["Channel modes on $c are: $m", true], |
73 | "IGNORED": ["Ignored $n, to unignore type: /UNIGNORE $n", false], | |
74 | "UNIGNORED": ["Unignored $n.", false], | |
75 | "IGNOREHEADER": ["Ignore list:", false], | |
76 | "IGNOREENTRY": ["- $h", false], | |
77 | "IGNOREEMPTY": ["Ignore list is empty.", false], | |
78 | "SILENCE": ["Silenced: $h", false] | |
9e769c12 CP |
79 | }; |
80 | ||
e20e5a6b | 81 | qwebirc.ui.Theme = new Class({ |
9e769c12 | 82 | initialize: function(themeDict) { |
96f28062 | 83 | this.__theme = qwebirc.util.dictCopy(qwebirc.ui.themes.Default); |
9e769c12 | 84 | |
9e769c12 CP |
85 | if(themeDict) |
86 | for(var k in themeDict) | |
87 | this.__theme[k] = themeDict[k]; | |
88 | ||
89 | for(var k in this.__theme) { | |
90 | if(k == "PREFIX") | |
91 | continue; | |
92 | ||
93 | var data = this.__theme[k]; | |
94 | if(data[1]) { | |
95 | this.__theme[k] = this.__theme["PREFIX"] + data[0]; | |
96 | } else { | |
97 | this.__theme[k] = data[0]; | |
98 | } | |
99 | } | |
96f28062 CP |
100 | |
101 | this.__ccmap = qwebirc.util.dictCopy(qwebirc.ui.themes.ThemeControlCodeMap); | |
102 | this.__ccmaph = qwebirc.util.dictCopy(this.__ccmap); | |
925fc357 | 103 | |
925fc357 CP |
104 | this.__ccmaph["("] = this.message("HILIGHT", {}, this.__ccmap); |
105 | this.__ccmaph[")"] = this.message("HILIGHTEND", {}, this.__ccmap); | |
f121b688 | 106 | this.__ccmaph["{"] = this.__ccmaph["}"] = ""; |
9e769c12 | 107 | }, |
96f28062 | 108 | __dollarSubstitute: function(x, h, mapper) { |
9e769c12 CP |
109 | var msg = []; |
110 | ||
111 | var n = x.split(""); | |
112 | for(var i=0;i<n.length;i++) { | |
113 | var c = n[i]; | |
114 | if(c == "$" && (i <= n.length - 1)) { | |
115 | var c2 = n[++i]; | |
116 | ||
96f28062 | 117 | var o = mapper[c2]; |
9e769c12 CP |
118 | if(!o) |
119 | o = h[c2]; | |
120 | if(o) | |
121 | msg.push(o); | |
122 | } else { | |
123 | msg.push(c); | |
124 | } | |
125 | } | |
126 | ||
127 | return msg.join(""); | |
128 | }, | |
96f28062 CP |
129 | message: function(type, data, hilight) { |
130 | var map; | |
131 | if(hilight) { | |
132 | map = this.__ccmaph; | |
133 | } else { | |
134 | map = this.__ccmap; | |
135 | } | |
925fc357 CP |
136 | |
137 | if(data && data["n"]) | |
138 | data["N"] = "qwebirc://whois/" + data.n + "/"; | |
96f28062 | 139 | return this.__dollarSubstitute(this.__theme[type], data, map); |
9e769c12 CP |
140 | } |
141 | }); |