([^`]*?)<\/h3>/", $data, $matches);
38 | $result = $matches[0][0];
39 | //Force a fake "SL Grid is closed result for testing
40 | //$result = "Second life is offline";
41 | $pos = strpos($result, $findme);
42 | if ($pos == false) {
43 | return "Closed";
44 | } else {
45 | return "Open";
46 | }
47 | }
48 | function gridStatus()
49 | {
50 | global $gridStatus;
51 | $result = doQuery(
52 | "SELECT UNIX_TIMESTAMP(state.time) AS timestamp, value, id FROM state WHERE state.key = 'gridStatus'"
53 | );
54 | if ($result->numRows() == 1) {
55 | $state = $result->fetchRow(DB_FETCHMODE_ASSOC);
56 | if (time() - $state["timestamp"] > 300) {
57 | $gridStatus = getGridStatus();
58 | # print "Update " . $gridStatus;
59 | if ($gridStatus != $state["value"] && $gridStatus != null) {
60 | doQuery(
61 | "UPDATE state SET time=null, value = '" .
62 | $gridStatus .
63 | "' WHERE id = " .
64 | $state["id"]
65 | );
66 | }
67 | } else {
68 | # print "Cached " . $state['value'];
69 | $gridStatus = $state["value"];
70 | }
71 | } else {
72 | $gridStatus = getGridStatus();
73 | if ($gridStatus != null) {
74 | # print "New " . $gridStatus;
75 | doQuery("DELETE FROM state WHERE state.key = 'gridStatus'");
76 | doQuery(
77 | "INSERT INTO state VALUES(null, null, null, 'gridStatus', '$gridStatus')"
78 | );
79 | }
80 | }
81 | return $gridStatus;
82 | }
83 | ?>
84 |
--------------------------------------------------------------------------------
/restbot-tools/php-restbot-api/include/sql.php:
--------------------------------------------------------------------------------
1 | .
20 | --------------------------------------------------------------------------------*/
21 | require_once "db.php";
22 |
23 | function restbotFromDB()
24 | {
25 | $request = doQuery(
26 | "SELECT restbots.id, restbots.hostname, restbots.session FROM restbots WHERE restbots.lock = 0 ORDER BY RAND() DESC LIMIT 1"
27 | );
28 | if ($request->numRows() != 1) {
29 | return null;
30 | } else {
31 | $session = $request->fetchRow(DB_FETCHMODE_ASSOC);
32 | return [
33 | "session" => $session["session"],
34 | "hostname" => $session["hostname"],
35 | "id" => $session["id"],
36 | ];
37 | }
38 | }
39 | function restbotRemoveByID($botid)
40 | {
41 | doQuery("DELETE FROM restbots WHERE restbots.id = $botid");
42 | }
43 | function restbotRemoveBySession($session)
44 | {
45 | doQuery("DELETE FROM restbots WHERE restbots.session = '$session'");
46 | }
47 | function restbotAddToDB($session, $hostname)
48 | {
49 | doQuery("INSERT INTO restbots VALUES(null, '$session','$hostname', 0, null)");
50 | return getSingle(
51 | "SELECT restbots.id FROM restbots WHERE restbots.session = '$session'"
52 | );
53 | }
54 | function sessionAlreadyExists($session)
55 | {
56 | $bots = doQuery(
57 | "SELECT restbots.id FROM restbots WHERE restbots.session = '$session'"
58 | );
59 | if ($bots->numRows() == 1) {
60 | return true;
61 | } else {
62 | return false;
63 | }
64 | }
65 | function lockBot($session)
66 | {
67 | global $debug;
68 | if (
69 | getSingle(
70 | "SELECT restbots.lock FROM restbots WHERE restbots.session = '$session'"
71 | ) == 1
72 | ) {
73 | return false;
74 | }
75 | if ($debug) {
76 | logMessage("rest", 3, "Locking session $session");
77 | }
78 | if (
79 | doUpdate(
80 | "UPDATE restbots SET restbots.lock = 1, restbots.timestamp = null WHERE restbots.session = '$session'"
81 | ) == 1
82 | ) {
83 | return true;
84 | } else {
85 | return false;
86 | }
87 | }
88 | function releaseBot($session)
89 | {
90 | global $debug;
91 | if ($debug) {
92 | logMessage("rest", 3, "Unlocking session $session");
93 | }
94 | doQuery(
95 | "UPDATE restbots SET restbots.lock = 0 WHERE restbots.session = '$session'"
96 | );
97 | }
98 | function restbotIsLocked($session)
99 | {
100 | $locked = getSingle(
101 | "SELECT restbots.lock FROM restbots WHERE restbots.session = '$session'"
102 | );
103 | if ($locked == 1) {
104 | return true;
105 | } else {
106 | return false;
107 | }
108 | }
109 |
110 | //////
111 | function getFromCache($type, $key)
112 | {
113 | global $cache_expire;
114 | $cache = getForceFromCache($type, $key);
115 | if (time() - $cache["timestamp"] > $cache_expire || $cache == null) {
116 | return null;
117 | }
118 | return ["value" => $cache["value"]];
119 | }
120 | function getForceFromCache($type, $key)
121 | {
122 | $result = doQuery(
123 | "SELECT UNIX_TIMESTAMP(cache.time) AS timestamp, value, id FROM cache WHERE cache.key = '$key' AND cache.type = '$type'"
124 | );
125 | if ($result->numRows() == 0) {
126 | return null;
127 | }
128 | $cache = $result->fetchRow(DB_FETCHMODE_ASSOC);
129 | return ["value" => $cache["value"], "timestamp" => $cache["timestamp"]];
130 | }
131 | function removeFromCache($type, $key)
132 | {
133 | global $debug;
134 |
135 | if ($debug) {
136 | logMessage("db", 3, "Removing $key from $type cache");
137 | }
138 | doQuery(
139 | "DELETE FROM cache WHERE cache.type = '$type' AND cache.key = '$key'"
140 | );
141 | }
142 | function updateInCache($type, $key, $value)
143 | {
144 | global $debug;
145 |
146 | if ($debug) {
147 | logMessage("db", 3, "Updating $key in $type cache with $value");
148 | }
149 | doQuery(
150 | "UPDATE cache SET cache.value = '$value', cache.time = null WHERE cache.type = '$type' AND cache.key = '$key'"
151 | );
152 | }
153 | function putInCache($type, $key, $value)
154 | {
155 | global $debug;
156 |
157 | if ($debug) {
158 | logMessagE("db", 3, "Inserting $key into $type cache with $value");
159 | }
160 | doQuery("INSERT INTO cache VALUES(null, null, '$type', '$key', '$value')");
161 | }
162 | function existsInCache($type, $key)
163 | {
164 | $q = getSingle(
165 | "SELECT cache.id FROM cache WHERE cache.type = '$type' AND cache.key = '$key'"
166 | );
167 | if ($q == null) {
168 | return false;
169 | } else {
170 | return true;
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/restbot-tools/php-restbot-api/include/util.php:
--------------------------------------------------------------------------------
1 | .
20 | --------------------------------------------------------------------------------*/
21 | require_once "db.php";
22 | require_once "funktions.php";
23 |
24 | function regionHandle($sim)
25 | {
26 | // global $debug; // if not used, don't declare it! (gwyneth 20220422)
27 | // $cached = getFromCache("regionhandle", $key); // this was on the original code; typo? (gwyneth 20220422)
28 | $cached = getFromCache("regionhandle", $sim);
29 | if ($cached["value"] != null) {
30 | return $cached["value"];
31 | } else {
32 | $handle = getRegionHandle($sim);
33 | if ($handle == null) {
34 | logMessage("rest", 3, "Response not received.");
35 | $cached = getForceFromCache("regionhandle", $sim);
36 | if ($cached != null) {
37 | logMessage(
38 | "db",
39 | 1,
40 | "Returning old cache entry (" . (time() - $cached["timestamp"]) . ")"
41 | );
42 | return $cached["value"];
43 | } else {
44 | return null;
45 | }
46 | } elseif ($handle == 0) {
47 | return "0";
48 | } else {
49 | if (existsInCache("regionhandle", $sim)) {
50 | updateInCache("regionhandle", $sim, $handle);
51 | } else {
52 | putInCache("regionhandle", $sim, $handle);
53 | }
54 | return $handle;
55 | }
56 | }
57 | }
58 |
59 | function getRegionHandle($sim)
60 | {
61 | $result = rest("region_handle", "region=$sim");
62 | if ($result == null) {
63 | logMessage("sl", 0, "Error looking up region handle for $sim", null, null);
64 | return null;
65 | }
66 | $xml = new SimpleXMLElement($result);
67 | return $xml->handle;
68 | }
69 | function regionMap($sim)
70 | {
71 | // global $debug; // if not used, don't include it (gwyneth 20220422)
72 | // $cached = getFromCache("regionmap", $key); // probably a typo? (gwyneth 20220422)
73 | $cached = getFromCache("regionmap", $sim);
74 | if ($cached["value"] != null) {
75 | return $cached["value"];
76 | } else {
77 | $handle = getRegionMap($sim);
78 | if ($handle == null) {
79 | logMessage("rest", 3, "Response not received.");
80 | $cached = getForceFromCache("regionmap", $sim);
81 | if ($cached != null) {
82 | logMessage(
83 | "db",
84 | 1,
85 | "Returning old cache entry (" . (time() - $cached["timestamp"]) . ")"
86 | );
87 | return $cached["value"];
88 | } else {
89 | return null;
90 | }
91 | } else {
92 | if (existsInCache("regionmap", $sim)) {
93 | updateInCache("regionmap", $sim, $handle);
94 | } else {
95 | putInCache("regionmap", $sim, $handle);
96 | }
97 | return $handle;
98 | }
99 | }
100 | }
101 |
102 | function getRegionMap($sim)
103 | {
104 | $result = rest("region_image", "region=" . urlencode($sim));
105 | if ($result == null) {
106 | logMessage("sl", 0, "Error looking up region handle for $sim", null, null);
107 | return null;
108 | }
109 | $xml = new SimpleXMLElement($result);
110 | return $xml->image;
111 | }
112 |
113 | ?>
114 |
--------------------------------------------------------------------------------
/restbot-tools/php-restbot-api/util.php:
--------------------------------------------------------------------------------
1 | .
20 | --------------------------------------------------------------------------------*/
21 | require_once "include/funktions.php";
22 | require_once "include/config.php";
23 |
24 | require_once "include/avatars.php";
25 | require_once "include/util.php";
26 |
27 | global $ownername;
28 | global $authuser;
29 | if (
30 | $_SERVER["HTTP_X_SECONDLIFE_OWNER_NAME"] == $ownername ||
31 | $_REQUEST["psk"] == $authuser
32 | ) {
33 | $authorized = true;
34 | }
35 |
36 | $command = $_REQUEST["command"];
37 |
38 | if ($command == "getkey") {
39 | if (!$authorized) {
40 | genPipeError("auth");
41 | }
42 | if (isset($_REQUEST["name"])) {
43 | if ($_REQUEST["base64"] == 1) {
44 | $name = base64_decode($_REQUEST["name"]);
45 | } else {
46 | $name = urldecode($_REQUEST["name"]);
47 | }
48 | } else {
49 | genPipeError("param");
50 | }
51 | $resp = avatarKey($name);
52 | if ($resp == null) {
53 | genPipeError("lookup");
54 | } elseif ($resp == "0") {
55 | genPipeError("found");
56 | } else {
57 | genPipeResponse($resp);
58 | }
59 | } elseif ($command == "getname") {
60 | if (!$authorized) {
61 | genPipeError("auth");
62 | }
63 | if (isset($_REQUEST["key"])) {
64 | if ($_REQUEST["base64"] == 1) {
65 | $key = base64_decode($_REQUEST["key"]);
66 | } else {
67 | $key = urldecode($_REQUEST["key"]);
68 | }
69 | } else {
70 | genPipeError("param");
71 | }
72 | $resp = avatarName($key);
73 | if ($resp == null) {
74 | genPipeError("lookup");
75 | } elseif ($resp == "0") {
76 | genPipeError("found");
77 | } else {
78 | genPipeResponse($resp);
79 | }
80 | } elseif ($command == "gethandle") {
81 | if (!$authorized) {
82 | genPipeError("auth");
83 | }
84 | if (isset($_REQUEST["sim"])) {
85 | if ($_REQUEST["base64"] == 1) {
86 | $sim = base64_decode($_REQUEST["sim"]);
87 | } else {
88 | $sim = urldecode($_REQUEST["sim"]);
89 | }
90 | } else {
91 | genPipeError("param");
92 | }
93 | $resp = regionHandle($sim);
94 | if ($resp == null) {
95 | genPipeError("lookup");
96 | } elseif ($resp == "0") {
97 | genPipeError("found");
98 | } else {
99 | genPipeResponse($resp);
100 | }
101 | } elseif ($command == "getmap") {
102 | if (!$authorized) {
103 | genPipeError("auth");
104 | }
105 | if (isset($_REQUEST["sim"])) {
106 | if ($_REQUEST["base64"] == 1) {
107 | $sim = base64_decode($_REQUEST["sim"]);
108 | } else {
109 | $sim = urldecode($_REQUEST["sim"]);
110 | }
111 | } else {
112 | genPipeError("param");
113 | }
114 | $resp = regionMap($sim);
115 | if ($resp == null) {
116 | genPipeError("lookup");
117 | } elseif ($resp == "00000000000000000000000000000000") {
118 | genPipeResponse("3ab7e2fa-9572-ef36-1a30-d855dbea4f92");
119 | } else {
120 | genPipeResponse(friendlyUUID($resp));
121 | }
122 | } else {
123 | genPipeError("param");
124 | }
125 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/api/getname.lsl:
--------------------------------------------------------------------------------
1 | //--------------------------------------------------------------------------------
2 | // LICENSE:
3 | // This file is part of the RESTBot Project.
4 | //
5 | // Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
6 | //
7 | // This program is free software: you can redistribute it and/or modify
8 | // it under the terms of the GNU Affero General Public License as
9 | // published by the Free Software Foundation, either version 3 of the
10 | // License, or (at your option) any later version.
11 | //
12 | // This program is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU Affero General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU Affero General Public License
18 | // along with this program. If not, see .
19 | //--------------------------------------------------------------------------------
20 |
21 | string API = "http://localhost:9080/restbot/util.php?psk=lolwhut";
22 |
23 | key nameLookupID = NULL_KEY;
24 |
25 | default
26 | {
27 | touch_start(integer total_number)
28 | {
29 | if ( nameLookupID == NULL_KEY ) {
30 | nameLookupID = llHTTPRequest(API + "&command=getname&key=" + (string) llDetectedKey(0), [], "");
31 | } else {
32 | llSay(0, "In use");
33 | }
34 | }
35 |
36 | http_response(key request_id, integer status, list metadata, string body) {
37 | //llWhisper(0, (string) status + " " + body);
38 | if ( request_id == nameLookupID ) {
39 | if ( llGetSubString(body, 0, 1) == "OK" ) {
40 | llSay(0, "Hello thar " + llGetSubString(body, 2, -1));
41 | }
42 | nameLookupID = NULL_KEY;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/dilation-meter.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # LICENSE:
3 | # This file is part of the RESTBot Project.
4 | #
5 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 |
20 | # To use this script, make sure you have the following dependencies installed:
21 | # - perl
22 | # - dialog (Ubuntu/Debian: 'apt install dialog'; macOS: 'brew install dialog')
23 |
24 | if [ $# -ne 3 ] ; then
25 | echo "dilation-meter.sh firstname lastname password" ;
26 | exit 1 ;
27 | fi
28 | SESSION=`perl botlogin.pl "$1" "$2" "$3"`
29 | while [ 1 ] ; do
30 | DILATION=`perl bot-dilation.pl "$SESSION"` ;
31 | LEN=`echo "$DILATION" | wc -c` ;
32 | if [ $LEN -eq 1 ] ; then
33 | DILATION=100 ;
34 | fi ;
35 | done | dialog --gauge "Time Dilation" 7 80
36 |
37 | perl botquit.pl $SESSION
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-dilation.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 |
22 | use XML::XPath;
23 | use HTTP::Request::Common qw(POST);
24 | use LWP::UserAgent;
25 |
26 | $ua = new LWP::UserAgent;
27 | if ( ( $#ARGV + 1 ) < 2 ) {
28 | print "bad args - url session\n";
29 | exit;
30 | }
31 | my $req = POST $ARGV[0] . "/dilation/" . $ARGV[1] . "/";
32 |
33 | $res = $ua->request($req);
34 | if ( $res->code == 200 ) {
35 | my $xp = XML::XPath->new(xml => $res->content);
36 | print $xp->getNodeText('/restbot/dilation') . "\n";
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getgroupprofile.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session groupkey\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/get_group_profile/" . $ARGV[1] . "/",
31 | [ "group" => $ARGV[2] ];
32 |
33 | $res = $ua->request($req);
34 | if ( $res->code == 200 ) {
35 | print $res->content . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getgrouproles.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # LICENSE:
3 | # This file is part of the RESTBot Project.
4 | #
5 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
6 | #
7 | # This program is free software: you can redistribute it and/or modify
8 | # it under the terms of the GNU Affero General Public License as
9 | # published by the Free Software Foundation, either version 3 of the
10 | # License, or (at your option) any later version.
11 | #
12 | # This program is distributed in the hope that it will be useful,
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | # GNU Affero General Public License for more details.
16 | #
17 | # You should have received a copy of the GNU Affero General Public License
18 | # along with this program. If not, see .
19 |
20 | use XML::XPath;
21 | use HTTP::Request::Common qw(POST);
22 | use LWP::UserAgent;
23 |
24 | $ua = new LWP::UserAgent;
25 | if ( ( $#ARGV + 1 ) < 2 ) {
26 | print "bad args - url session groupkey\n";
27 | exit;
28 | }
29 | my $req = POST $ARGV[0] . "/get_roles/" . $ARGV[1] . "/",
30 | [ 'group' => $ARGV[2] ];
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | print $res->content . "\n";
35 | }
36 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getgroups.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/get_groups/" . $ARGV[1] . "/";
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | print $res->content . "\n";
35 | }
36 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getgroups2.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session avkey\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/avatar_groups/" . $ARGV[1] . "/",
31 | [ "key" => $ARGV[2] ];
32 |
33 | $res = $ua->request($req);
34 | if ( $res->code == 200 ) {
35 | print $res->content . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getkey.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session firstname lastname\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/avatar_key/" . $ARGV[1] . "/",
31 | [ "name" => $ARGV[2] . " " . $ARGV[3] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/key') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getname.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session agent_key\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/avatar_name/" . $ARGV[1] . "/",
31 | [ "key" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/name') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getonline.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - session url agent_key\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/avatar_online/" . $ARGV[1] . "/",
31 | [ "key" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/online') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-getprofile.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session agent_key\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/avatar_profile/" . $ARGV[1] . "/",
31 | [ "key" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | # my $xp = XML::XPath->new(xml => $res->content);
35 | # print $xp->getNodeText('/restbot/name') . "\n";
36 | print $res->content;
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-givelandmark.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session name destkey\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/create_landmark/" . $ARGV[1] . "/",
31 | [ "name" => $ARGV[2], "desc" => "restbot 4tw", "avatar" => $ARGV[3] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/status') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-groupinvitations.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use strict;
22 |
23 | use XML::XPath;
24 | use HTTP::Request::Common qw(POST);
25 | use LWP::UserAgent;
26 |
27 | my $url = $ARGV[0];
28 | my $session = $ARGV[1];
29 |
30 | my $ua = new LWP::UserAgent;
31 | if ( ( $#ARGV + 1 ) < 1 ) {
32 | print "bad args - url session\n";
33 | exit;
34 | }
35 | my $req = POST $url . "invitations/" . $session . "/",
36 | [ "action" => "list_invitations" ];
37 |
38 | my $res = $ua->request($req);
39 | if ( $res->code == 200 ) {
40 | my $xp = XML::XPath->new(xml => $res->content);
41 | if ( $xp->exists('/restbot') ) {
42 | print "Valid restjunk\n";
43 | } else {
44 | print "Invalid restjunk\n";
45 | die;
46 | }
47 | my $invitations = $xp->find('/restbot/invitations/invite');
48 | print "Invites - " . $invitations->size() . "\n";
49 | foreach my $invite ( $invitations->get_nodelist) {
50 | # print XML::XPath::XMLParser::as_string($invite) . "\n";
51 | print "Invited to " . getGroupName($invite->find('group')) . " by " . $invite->find('inviter') ."\n";
52 | my $answer = '';
53 | while ( $answer ne 'y' && $answer ne 'n' ) {
54 | print "Do you wish to accept ? (y/n) ";
55 | chomp($answer = );
56 | }
57 | if ( $answer eq 'y' ) {
58 | my $req2 = POST $url . "/invitations/" . $session . "/",
59 | [ "action" => "accept_invitation", "inviteid" => $invite->find('key') ];
60 | my $res2 = $ua->request($req2);
61 | } elsif ( $answer eq 'n' ) {
62 | my $req2 = POST $url . "/invitations/" . $session . "/",
63 | [ "action" => "decline_invitation", "inviteid" => $invite->find('key') ];
64 | my $res2 = $ua->request($req2);
65 | }
66 | }
67 | }
68 |
69 | sub getGroupName
70 | {
71 | my $groupkey = $_[0];
72 | my $req = POST $url . "/get_group_profile/" . $session . "/",
73 | [ "group" => "$groupkey" ];
74 | my $res = $ua->request($req);
75 | if ( $res->code == 200 ) {
76 | my $xp = XML::XPath->new(xml => $res->content);
77 | return $xp->getNodeText('/restbot/groupprofile/name');
78 | }
79 | return undef;
80 | }
81 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-groupinvite.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 4 ) {
27 | print "bad args - url session group avatar\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/invite/" . $ARGV[1] . "/",
31 | [ "group" => $ARGV[2] , "target" => $ARGV[3] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/success') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-joingroup.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session group\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/join_group/" . $ARGV[1] . "/",
31 | [ "groupid" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/success') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-leavegroup.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session groupkey\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/leave_group/" . $ARGV[1] . "/",
31 | [ "groupid" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/success') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-location.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/location/" . $ARGV[1] . "/";
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/sim') . "@" . $xp->getNodeText('/restbot/pos') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-parcel.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 2 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/parcel_properties/" . $ARGV[1] . "/";
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | print $res->content . "\n";
35 | # my $xp = XML::XPath->new(xml => $res->content);
36 | # print $xp->getNodeText('/restbot') . "\n";
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-parceleditname.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session new_name\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/parcel_modify/" . $ARGV[1] . "/",
31 | [ "name" => $ARGV[2] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | # my $xp = XML::XPath->new(xml => $res->content);
35 | # print $xp->getNodeText('/restbot/name') . "\n";
36 | print $res->content;
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-regionhandle.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 2 ) {
27 | print "bad args - url region\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/region_handle/" . $ARGV[1] . "/",
31 | [ 'region' => $ARGV[2] ];
32 |
33 | $res = $ua->request($req);
34 | if ( $res->code == 200 ) {
35 | my $xp = XML::XPath->new(xml => $res->content);
36 | print $xp->getNodeText('/restbot/handle') . "\n";
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-rez.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 4 ) {
27 | print "bad args - url session name x,y,z [path]\n";
28 | exit;
29 | }
30 | my $req;
31 | if ( $ARGV[4] != "" ) {
32 | $req = POST $ARGV[0] . "/rez_from_inventory/" . $ARGV[1] . "/",
33 | [ "name" => $ARGV[2] , "pos" => $ARGV[3] , "path" => $ARGV[4] ];
34 | } else {
35 | $req = POST $ARGV[0] . "/rez_from_inventory/" . $ARGV[1] . "/",
36 | [ "name" => $ARGV[2] , "pos" => $ARGV[3] ];
37 | }
38 | $res = $ua->request($req);
39 | if ( $res->code == 200 ) {
40 | my $xp = XML::XPath->new(xml => $res->content);
41 | print $xp->getNodeText('/restbot/status') . "\n";
42 | }
43 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-sit.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session target camping\n";
28 | exit;
29 | }
30 | my $req;
31 | $req = POST $ARGV[0] . "/sit/" . $ARGV[1] . "/",
32 | [ "seat" => $ARGV[2] , "camp" => $ARGV[3], "action" => "sit_on_target" ];
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | print $xp->getNodeText('/restbot/success') . "\n";
38 | }
39 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-sitground.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 2 ) {
27 | print "bad args - url session camping\n";
28 | exit;
29 | }
30 | my $req;
31 | $req = POST $ARGV[0] . "/sit/" . $ARGV[1] . "/",
32 | [ "action" => "sit_on_ground", "camp" => $ARGV[2] ];
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | print $xp->getNodeText('/restbot/success') . "\n";
38 | }
39 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-stand.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req;
31 | $req = POST $ARGV[0] . "/sit/" . $ARGV[1] . "/",
32 | [ "action" => "stand_up" ];
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | print $xp->getNodeText('/restbot/success') . "\n";
38 | }
39 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-startanim.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session anim-UUID\n";
28 | exit;
29 | }
30 | my $req;
31 | $req = POST $ARGV[0] . "/startanim/" . $ARGV[1] . "/",
32 | [ "animation" => $ARGV[2] ];
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | print $xp->getNodeText('/restbot/success') . "\n";
38 | }
39 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-stats.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 2 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/sim_stat/" . $ARGV[1] . "/";
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | print $res->content . "\n";
35 | # my $xp = XML::XPath->new(xml => $res->content);
36 | # print $xp->getNodeText('/restbot') . "\n";
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-status.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 1 ) {
27 | print "bad args - url session\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/status/" . $ARGV[1] . "/";
31 |
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/status') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-stopanim.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 3 ) {
27 | print "bad args - url session anim-UUID\n";
28 | exit;
29 | }
30 | my $req;
31 | $req = POST $ARGV[0] . "/stopanim/" . $ARGV[1] . "/",
32 | [ "animation" => $ARGV[2] ];
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | print $xp->getNodeText('/restbot/success') . "\n";
38 | }
39 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/bot-teleport.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 |
25 | $ua = new LWP::UserAgent;
26 | if ( ( $#ARGV + 1 ) < 4 ) {
27 | print "bad args - url session sim x,y,z\n";
28 | exit;
29 | }
30 | my $req = POST $ARGV[0] . "/teleport/" . $ARGV[1] . "/",
31 | [ "sim" => $ARGV[2] , "pos" => $ARGV[3] ];
32 | $res = $ua->request($req);
33 | if ( $res->code == 200 ) {
34 | my $xp = XML::XPath->new(xml => $res->content);
35 | print $xp->getNodeText('/restbot/status') . "\n";
36 | }
37 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/botlogin.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use Data::Dumper;
23 | use HTTP::Request::Common qw(POST);
24 | use LWP::UserAgent;
25 | use Digest::MD5 qw(md5_hex);
26 |
27 | $ua = new LWP::UserAgent;
28 | if ( ( $#ARGV + 1 ) < 4 ) {
29 | print "bad args - url firstname lastname password\n";
30 | exit;
31 | }
32 | my $req = POST $ARGV[0] . '/establish_session/pass/',
33 | [ 'first' => $ARGV[1], 'last' => $ARGV[2], 'pass' => md5_hex($ARGV[3]) ];
34 |
35 | $res = $ua->request($req);
36 | if ( $res->code == 200 ) {
37 | my $xp = XML::XPath->new(xml => $res->content);
38 | print $xp->getNodeText('/restbot/success/session_id') . "\n";
39 | # print $res->content . "\n";
40 | }
41 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/botquit.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use HTTP::Request::Common qw(POST);
23 | use LWP::UserAgent;
24 | use Digest::MD5 qw(md5_hex);
25 |
26 | $ua = new LWP::UserAgent;
27 | if ( ( $#ARGV + 1 ) < 2 ) {
28 | print "bad args - url session\n";
29 | exit;
30 | }
31 | my $req = POST $ARGV[0] . '/exit/' . $ARGV[1] . "/";
32 |
33 | $res = $ua->request($req);
34 | if ( $res->code == 200 ) {
35 | my $xp = XML::XPath->new(xml => $res->content);
36 | print $xp->getNodeText('/restbot/disposed') . "\n";
37 | }
38 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/perl/botshutdown.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #--------------------------------------------------------------------------------
3 | # LICENSE:
4 | # This file is part of the RESTBot Project.
5 | #
6 | # Copyright (C) 2007-2008 PLEIADES CONSULTING, INC
7 | #
8 | # This program is free software: you can redistribute it and/or modify
9 | # it under the terms of the GNU Affero General Public License as
10 | # published by the Free Software Foundation, either version 3 of the
11 | # License, or (at your option) any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU Affero General Public License for more details.
17 | #
18 | # You should have received a copy of the GNU Affero General Public License
19 | # along with this program. If not, see .
20 | #-------------------------------------------------------------------------------
21 | use XML::XPath;
22 | use Data::Dumper;
23 | use HTTP::Request::Common qw(POST);
24 | use LWP::UserAgent;
25 | use Digest::MD5 qw(md5_hex);
26 |
27 | $ua = new LWP::UserAgent;
28 | if ( ( $#ARGV + 1 ) < 1) {
29 | print "bad args - url \n";
30 | exit;
31 | }
32 | my $req = POST $ARGV[0] . '/server_quit/pass/';
33 |
34 | $res = $ua->request($req);
35 | if ( $res->code == 200 ) {
36 | my $xp = XML::XPath->new(xml => $res->content);
37 | # print $xp->getNodeText('/restbot/status') . "\n";
38 | print $res->content . "\n";
39 | }
40 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/php/bot-dilation.php:
--------------------------------------------------------------------------------
1 | .
20 | --------------------------------------------------------------------------------*/
21 |
22 | // Don't forget to change th $url to reflect your configuration!
23 |
24 | if ($argv[1] == null) {
25 | print "Usage bot-dilation.php session" . PHP_EOL;
26 | exit(0);
27 | }
28 | $url = "http://lumo.eghetto.ca:9080/dilation/" . $argv[1] . "/";
29 | $ch = curl_init($url);
30 |
31 | curl_setopt($ch, CURLOPT_POST, true);
32 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
33 | $stuff = curl_exec($ch);
34 | curl_close($ch);
35 | if (empty($stuff)) {
36 | print "Nothing returned from server" . PHP_EOL;
37 | exit(1);
38 | }
39 | #print "$stuff";
40 | $xml = new SimpleXMLElement($stuff);
41 | print $xml->dilation . PHP_EOL;
42 |
--------------------------------------------------------------------------------
/restbot-tools/test-scripts/php/bot-getkey.php:
--------------------------------------------------------------------------------
1 | .
20 | --------------------------------------------------------------------------------*/
21 |
22 | // Don't forget to change th $url to reflect your configuration!
23 |
24 | if ($argv[1] == null || $argv[2] == null || $argv[3] == null) {
25 | print "Usage " . $argv[0] . " session firstname lastname" . PHP_EOL;
26 | exit(1);
27 | }
28 | $url = "http://127.0.0.1:9080/avatar_key/" . $argv[1] . "/";
29 | $ch = curl_init($url);
30 |
31 | curl_setopt($ch, CURLOPT_POST, true);
32 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
33 | curl_setopt($ch, CURLOPT_POSTFIELDS, "name=" . $argv[2] . " " . $argv[3]);
34 | $stuff = curl_exec($ch);
35 | curl_close($ch);
36 | if (empty($stuff)) {
37 | print "Nothing returned from server" . PHP_EOL;
38 | exit(2);
39 | }
40 | $xml = new SimpleXMLElement($stuff);
41 | print $xml->key . PHP_EOL;
42 |
--------------------------------------------------------------------------------