//Quick hack to find and display resident's keys from the w-hat name2key database
// Keknehv Psaltery, 5/5/06
key requestid;
string resident;
default
{
state_entry()
{
llListen(1,"","","");
}
listen( integer chan, string name, key id, string msg )
{
resident = llDumpList2String(llParseString2List(msg,[" "],[])," ");
requestid = llHTTPRequest("http://w-hat.com/name2key?name="+llDumpList2String(llParseString2List(msg,[" "],[]),"+"),[HTTP_METHOD,"GET"],"");
}
http_response(key request_id, integer status, list metadata, string body)
{
integer i;
if (request_id == requestid)
{
if ( ( i = llSubStringIndex(body,resident) ) != -1 )
llSay(0,llGetSubString(body,i,i+llStringLength(resident)+36));
else
llSay(0,"No resident named \""+resident+"\" found in the w-hat name2key database");
} else
llSay(0,(string)status+" error");
}
}