06-20-2006 21:23
i am trying to get listen to inject data into a xml-rpc application
the source that consernse me is blow note that i know data will be lost with the basic way this stores the data this code is incompleate but untill i get to add data from listen there is no reasion to continue:




key gChannel; // my llRemoteData channel
key requestid;
string waitingdata;

DEBUG(list out) { // output debug info
// llSay(0, llList2CSV(out));
}

default { // initialize XML-RPC
state_entry() {
waitingdata="temp";
llListen(0,"",NULL_KEY,"";);
llOpenRemoteDataChannel(); // create an XML-RPC channel

// this will raise remote_data event REMOTE_DATA_CHANNEL when created
}

listen(integer channel, string name, key id, string message)
{
llSay(0,"i hear something";);
waitingdata=(string)message;
}

remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
if (type == REMOTE_DATA_CHANNEL) { // channel created
DEBUG(["Channel opened", "REMOTE_DATA_CHANNEL", channel, message_id, sender, ival, sval]);
gChannel = channel;
llSay(0, "Ready to receive requests on channel \"" + (string)channel +"\"";);
requestid = llHTTPRequest("http://lumo.eghetto.ca/~proto/sl/temp.php?channel="+ (string)channel,[HTTP_METHOD,"GET"],"";);
state go; // start handling requests
} else DEBUG(["Unexpected event type", type, channel, message_id, sender, ival, sval]);
}
}

state go { // handle requests
remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) {
if (type == REMOTE_DATA_REQUEST) { // handle requests sent to us
DEBUG(["Request received", "REMOTE_DATA_REQUEST", channel, message_id, sender, ival, sval]);
// handle request IMPORTANT: a reply MUST always be sent
//this prints the reply in raw
if (waitingdata == "temp";) {
llSay(0,"woot";);
llSay(0,(string)waitingdata);}
llRemoteDataReply(channel, message_id, "", 0);
//llRemoteDataReply(channel, message_id, waitingdata, 0);

} else DEBUG(["Unexpected event type:", type, channel, message_id, sender, ival,sval]);
}



state_exit() {
llCloseRemoteDataChannel(gChannel); // clean up when you no longer want to handle requests
}

http_response(key request_id, integer status, list metadata, string body)
{

}


}


ugly misfit