Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- default {
- changed(integer c) {
- if (c & CHANGED_INVENTORY || c & CHANGED_REGION_START) llResetScript();
- else if (c & CHANGED_REGION) REQ_URL = llRequestURL();
- }
- http_request(key id, string method, string body) {
- //llOwnerSay(body+" "+method);
- if (id == REQ_URL) {
- if (method == URL_REQUEST_GRANTED) {
- COMMS_URL = body;
- llHTTPRequest(HOSTNAME+"comms_call_home.php",[HTTP_METHOD,"POST",HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "&comms_url="+COMMS_URL); // update URL and timestamp in table
- // owners have not been entered yet
- } else if (method == URL_REQUEST_DENIED) {
- llOwnerSay("No available URLs in this parcel. You will not be able to receive incoming messages here.");
- }
- }
- else if (method == "POST") {
- list php_request = llParseString2List(body,[";;"],[""]);
- string r_code = llList2String(php_request,0);
- if (r_code == "COMMS_TRAFFIC") {
- //string net_hash = llList2String(php_request,1);
- string tx_group_id = llList2String(php_request,1);
- integer x;
- //// group_id, group_name, user_chan, user_handle, creator_name, subchans
- for (x=0;x<llGetListLength(TALKGROUP_DATA)/TALKGROUP_DATA_STRIDE;x++) { // loop to find the net name and this users local channel number
- //string hash = llList2String(COMMS_INFO,(x*COMMS_INFO_STRIDE)+1);
- string group_id = llList2String(TALKGROUP_DATA,x*TALKGROUP_DATA_STRIDE);
- //llOwnerSay(hash);
- if (group_id == tx_group_id) { // found which AP this msg is coming from
- //llOwnerSay("hash = "+hash);
- string group_name = llList2String(TALKGROUP_DATA,(x*TALKGROUP_DATA_STRIDE)+1);
- //llOwnerSay(group_name);
- string subchannel = llList2String(php_request,2);
- if (subchannel == "A") { // main chat
- subchannel = ""; // dont display subchannel "A" for main chat
- //net name string is good
- }
- else if (subchannel == "B") { // admin chat
- //subchannel string is good
- group_name = group_name + " Admin Chat";
- }
- else { //any CommsLinks channels
- group_name = group_name + " <> "+llList2String(php_request,5); // php returns the linked group's name at the end
- }
- // Display Transmission
- llOwnerSay("[ Chan: /"+llList2String(TALKGROUP_DATA,(x*TALKGROUP_DATA_STRIDE)+2)+subchannel+ " ][ "+group_name+" ] "+llList2String(php_request,3)+": "+llList2String(php_request,4)+"\t[free: "+(string)llGetFreeMemory()+"]");
- //
- x=llGetListLength(TALKGROUP_DATA); //end loop
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment