# Handle Client Input sub client_input { my ($kernel, $session, $input) = @_[KERNEL, SESSION, ARG0]; my $user_id = $session->ID; if ($input =~//) { my $command = parsexml($input, 'command'); if ($command eq 'addgame') { # Addgame command received # xml > variables my $hostip = parsexml($input, 'hostip'); my $hostport = parsexml($input, 'hostport'); my $hostversion = parsexml($input, 'hostversion'); my $map = parsexml($input, 'map'); my $players = 1; my $maxplayers = parsexml($input, 'maxplayers'); my $techlvl = parsexml($input, 'techlvl'); # Add the Game to the Lobby Database addgame($user_id, $command, $hostip, $hostport, $hostversion, $map, $players, $maxplayers, $techlvl); } elsif ($command eq 'chgame') { # Change game command received # xml > variables my $hostip = parsexml($input, 'hostip'); my $hostport = parsexml($input, 'hostport'); my $hostversion = parsexml($input, 'hostversion'); my $map = parsexml($input, 'map'); my $players = 1; my $maxplayers = parsexml($input, 'maxplayers'); my $techlvl = parsexml($input, 'techlvl'); # Change the Game chgame($user_id, $command, $hostip, $hostport, $hostversion, $map, $players, $maxplayers, $techlvl); } } elsif ($input eq 'listgames') { if (scalar(@gameDB) == 0) { $poe_kernel->post($user_id => send => "no games"); } else { $poe_kernel->post($user_id => send => "@gameDB"); print @gameDB; } } elsif ($input =~/^chat (.+)$/) { broadcast($user_id, "$user_id: $1"); } else { $poe_kernel->post($user_id => send => "error"); } }