… | |
… | |
13 | } |
13 | } |
14 | |
14 | |
15 | sub query { |
15 | sub query { |
16 | my ($ns, $flags, $text) = @_; |
16 | my ($ns, $flags, $text) = @_; |
17 | |
17 | |
18 | my $current = $Coro::current; |
18 | $ns->query ($flags, $text, Coro::rouse_cb); |
19 | $ns->query ($flags, $text, sub { $current->ready; $current = $_[0] }); |
19 | Coro::rouse_wait |
20 | Coro::schedule while ref $current; |
|
|
21 | |
|
|
22 | $current |
|
|
23 | } |
20 | } |
24 | |
21 | |
25 | sub can_cleanup { |
22 | sub can_cleanup { |
26 | my ($pl, $mtime) = @_; |
23 | my ($pl, $mtime) = @_; |
27 | |
24 | |
… | |
… | |
230 | $ns->send_drawinfo ( |
227 | $ns->send_drawinfo ( |
231 | "That username is currently used in another login session. " |
228 | "That username is currently used in another login session. " |
232 | . "Chose another, or wait till the other session has ended.", |
229 | . "Chose another, or wait till the other session has ended.", |
233 | cf::NDI_RED |
230 | cf::NDI_RED |
234 | ); |
231 | ); |
235 | } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,17}\z/) { |
232 | } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,19}\z/) { |
236 | last; |
233 | last; |
237 | } else { |
234 | } else { |
238 | $ns->send_drawinfo ( |
235 | $ns->send_drawinfo ( |
239 | "Your username contains illegal characters " |
236 | "Your username contains illegal characters " |
240 | . "(only a-z, A-Z and 0-9 are allowed), " |
237 | . "(only a-z, A-Z and 0-9 are allowed), " |
241 | . "or is not between 3 and 18 characters in length.", |
238 | . "or is not between 3 and 20 characters in length.", |
242 | cf::NDI_RED |
239 | cf::NDI_RED |
243 | ); |
240 | ); |
244 | } |
241 | } |
245 | Coro::Timer::sleep 0.4; |
242 | Coro::Timer::sleep 0.4; |
246 | } |
243 | } |
… | |
… | |
433 | Coro::Timer::sleep 0.2; |
430 | Coro::Timer::sleep 0.2; |
434 | } |
431 | } |
435 | |
432 | |
436 | $ob->reply (undef, "Welcome to Deliantra!"); |
433 | $ob->reply (undef, "Welcome to Deliantra!"); |
437 | |
434 | |
|
|
435 | # XXX: Workaround for delayed client ext protocol handshake |
|
|
436 | $pl->esrv_new_player; |
|
|
437 | |
438 | delete $pl->{deny_save}; |
438 | delete $pl->{deny_save}; |
439 | |
439 | |
440 | last; |
440 | last; |
441 | } |
441 | } |
442 | }); |
442 | }); |