Currently serving information on 63099 avatars
// ---------------------------------------------------------------------- // Licensing // ---------------------------------------------------------------------- // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // // ©2009 [EXL] // Program & service maintained by: // Charlotte Wirtanen // Hg Beeks // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Internal constants, do not change. // ---------------------------------------------------------------------- string NAME2KEY_SINGLE = "fetch"; string NAME2KEY_WILD = "fetch_wild"; string NAME2KEY_FULL = "fetch_full"; // ---------------------------------------------------------------------- key exlName2Key(string name, string method) // Returns a request id and triggers an http_response, where body is the agent key // string name = agent name to search for // string method = NAME2KEY_SINGLE, NAME2KEY_WILD or NAME2KEY_FULL // // NAME2KEY_SINGLE = Returns a single result key // NAME2KEY_WILD = Returns a 2-stride list of all possible matching // names and their respective keys, with a limit of 30 results and // using the % (percentage) character as a wild card. // NAME2KEY_FULL = Returns a list with the following structure: // result[0] = agent name // result[1] = agent key // result[2] = agent last seen date in unix timestamp format // result[3] = agent or monitor that spotted this person last // result[4] = region coordinates where agent was last seen // result[5] = local region position where agent was last seen // NAME2KEY_FULL is limited to 1 user, no wildcards. { return llHTTPRequest( "http://www.balseraph.org/name2key.php/" + method + "/" + llEscapeURL(name), [], "" ); } // ---------------------------------------------------------------------- // Function callbacks - Your code goes here. // ---------------------------------------------------------------------- exlSingleName2KeyCallback(string result, key request_id) // Called when the http_response completes successfully for NAME2KEY_SINGLE // string result = key located from your search, NULL_KEY if not found // key request_id = request id from completed search { // ---------------------------------------------------------------------- // TO-DO: Replace with your own result code. // ---------------------------------------------------------------------- llOwnerSay("\nRequest ID " + (string)request_id + "\nReturned key: " + result); } exlWildName2KeyCallback(list result, integer results, key request_id) // Called when the http_response completes successfully for NAME2KEY_WILD // list result = 2-stride length list containing all possible matches // integer results = total number of results found // key request_id = request id from completed search { // ---------------------------------------------------------------------- // TO-DO: Replace with your own result code. // ---------------------------------------------------------------------- llOwnerSay( "\nRequest ID " + (string)request_id + "\n" + "Returned " + (string)results + " keys: \n" + llDumpList2String(result, "\n") ); } exlFullName2KeyCallback(list result, key request_id) // Called when the http_response completes successfully for NAME2KEY_FULL // list result = // result[0] = agent name // result[1] = agent key // result[2] = agent last seen date in unix timestamp format // result[3] = agent or monitor that spotted this person last // result[4] = region coordinates where agent was last seen // result[5] = local region position where agent was last seen // key request_id = request id from completed search { // ---------------------------------------------------------------------- // TO-DO: Replace with your own result code. // ---------------------------------------------------------------------- llOwnerSay( "\nRequest ID " + (string)request_id + "\n" + "Returned data: \n\n" + "Name: " + llList2String(result, 0) + "\n" + "Key: " + llList2String(result, 1) + "\n" + "Last seen: " + llList2String(result, 2) + "\n" + "Seen by: " + llList2String(result, 3) + "\n" + "Region seen at: " + llList2String(result, 4) + "\n" + "Position of recorder: " + llList2String(result, 5) + "\n" ); } // ---------------------------------------------------------------------- key gRequestID = NULL_KEY; default { state_entry() { // ---------------------------------------------------------------------- // Call exlName2Key(string, method) and store the request id in a global // for request-matching later in http_response // TO-DO: Replace with your own query code. // ---------------------------------------------------------------------- // Single search for 'Charlotte Wirtanen': gRequestID = exlName2Key("Charlotte Wirtanen", NAME2KEY_SINGLE); // Wildcard search for all names with 'ch' (case insensitive) in them: // gRequestID = exlName2Key("%ch%", NAME2KEY_WILD); // Full data search for 'Charlotte Wirtanen': // gRequestID = exlName2Key("Charlotte Wirtanen", NAME2KEY_FULL); } // ---------------------------------------------------------------------- // Response callback routing - Do not edit. // ---------------------------------------------------------------------- http_response(key request_id, integer status, list metadata, string body) { // Check that our request_id matches the request id we recorded from // calling exlName2Key(string) if (request_id == gRequestID) { // Fail and return in the case of our // http request timing out. if (status == 499) { llOwnerSay("Request timed out."); return; } // If the http status doesn't indicate success, // fail and return with the status code. if (status != 200) { llOwnerSay("Error: Status " + (string)status); return; } // Trim our response. body = llStringTrim(body, STRING_TRIM); // Return with an error message if the response // body is empty. if (body == "") { llOwnerSay("Empty result returned."); return; } // Return with an error message if an error string // is found. if (llSubStringIndex(body, "FATAL_ERROR") != -1) { llOwnerSay(body); return; } if (llSubStringIndex(body, ";") != -1) { // Trigger callback for full data query. exlFullName2KeyCallback( llParseString2List(body, [";"], []), request_id ); } else if (llSubStringIndex(body, ",") != -1) { // Trigger callback for multiple query. exlWildName2KeyCallback( llCSV2List(body), llGetListLength(llCSV2List(body)) / 2, request_id ); } else { // Trigger callback for a single query. exlSingleName2KeyCallback(body, request_id); } } } // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- }