ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.215 by root, Wed Jan 18 13:42:19 2012 UTC vs.
Revision 1.217 by root, Wed Nov 21 13:23:10 2012 UTC

42use List::Util (); 42use List::Util ();
43use IO::AIO (); 43use IO::AIO ();
44use Coro::AIO (); 44use Coro::AIO ();
45use AnyEvent::AIO (); 45use AnyEvent::AIO ();
46 46
47use Deliantra::Util ();
47use Deliantra::Protocol::Constants (); 48use Deliantra::Protocol::Constants ();
48 49
49=item shorten $string[, $maxlength] 50=item shorten $string[, $maxlength]
50 51
51=cut 52=cut
60 local $_ = $_[0]; 61 local $_ = $_[0];
61 62
62 s/&/&/g; 63 s/&/&/g;
63 s/>/>/g; 64 s/>/>/g;
64 s/</&lt;/g; 65 s/</&lt;/g;
66
67 $_
68}
69
70sub sanitise_cfxml($) {
71 local $_ = shift;
72
73 # we now weed out all tags we do not support
74 s{ <(?! /?i> | /?u> | /?b> | /?big | /?small | /?s | /?tt | fg\ | /fg>)
75 }{
76 "&lt;"
77 }gex;
78
79 # now all entities
80 s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&amp;/g;
81
82 # handle some elements
83 s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs;
84 s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs;
85
86 s/\s+$//;
65 87
66 $_ 88 $_
67} 89}
68 90
69sub background(&;&) { 91sub background(&;&) {
212 234
213sub load_cfg() { 235sub load_cfg() {
214 if (-e "$Deliantra::VARDIR/client.cf") { 236 if (-e "$Deliantra::VARDIR/client.cf") {
215 DC::read_cfg "$Deliantra::VARDIR/client.cf"; 237 DC::read_cfg "$Deliantra::VARDIR/client.cf";
216 } else { 238 } else {
217 $::CFG = {}; 239 $::CFG = { cfg_schema => 1, db_schema => 1 };
218 } 240 }
219} 241}
220 242
221sub save_cfg() { 243sub save_cfg() {
222 write_cfg "$Deliantra::VARDIR/client.cf"; 244 write_cfg "$Deliantra::VARDIR/client.cf";
263 logview_max_par => 1000, 285 logview_max_par => 1000,
264 shift_fire_stop => 0, 286 shift_fire_stop => 0,
265 uitheme => "wood", 287 uitheme => "wood",
266 map_shift_x => -24, # arbitrary 288 map_shift_x => -24, # arbitrary
267 map_shift_y => +24, # arbitrary 289 map_shift_y => +24, # arbitrary
268 #db_schema => 0,
269 ); 290 );
270 291
271 while (my ($k, $v) = each %DEF_CFG) { 292 while (my ($k, $v) = each %DEF_CFG) {
272 $::CFG->{$k} = $v unless exists $::CFG->{$k}; 293 $::CFG->{$k} = $v unless exists $::CFG->{$k};
294 }
295
296 if ($::CFG->{cfg_schema} < 1) {
297 for my $profile (values %{ $::CFG->{profile} }) {
298 $profile->{password} = unpack "H*", Deliantra::Util::hash_pw $profile->{password};
299 }
300 $::CFG->{cfg_schema} = 1;
273 } 301 }
274} 302}
275 303
276sub http_proxy { 304sub http_proxy {
277 my @proxy = win32_proxy_info; 305 my @proxy = win32_proxy_info;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines