Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- key apirequest;
- key sessionrequest;
- key manglerequest;
- key locrequest;
- string session = "";
- string channelid = "";
- string mode = "";
- string mangletarget = "";
- string type = "";
- string font = "";
- string getXMLValue(string xmlstring, string element)
- {
- string value = "";
- string elementopen = "<" + element + ">";
- string elementclose = "</" + element + ">";
- integer elementstart = llSubStringIndex(xmlstring, elementopen);
- if(elementstart == -1)
- return "NO_XML";
- integer valuestart = elementstart + llStringLength(elementopen);
- integer valueend = llSubStringIndex(xmlstring, elementclose) - 1;
- value = llGetSubString(xmlstring, valuestart, valueend);
- return value;
- }
- GetMangle(string uuid)
- {
- manglerequest = llHTTPRequest("http://vir5ag.vivox.com/dave/jon/sl/mangle_uuid.php?uuid="+uuid,[],"");
- }
- GetSession()
- {
- sessionrequest = llHTTPRequest("http://vir5ag.vivox.com/dave/jon/sl/Vend_API.php",[],"");
- }
- /*GetAdmSession()
- {
- sessionrequest = llHTTPRequest("http://www.bhr.vivox.com/api2/viv_portal_signin.php?username=TestAdmin2&pwd=",[],"");
- }*/
- SendRequestURI()
- {
- string mangletargeturi = "sip:"+mangletarget+"@bhr.vivox.com";
- string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
- string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"user_uri\":\""+mangletargeturi+"\",\"auth_token\":\""+session+"\"}";
- string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
- url += "APIURL=" + llEscapeURL(app);
- url += "&APIDATA=" + llEscapeURL(data);
- //llWhisper(0,"Sending API Request (URI) mode:"+mode);
- apirequest = llHTTPRequest(url,[],"");
- GetSession();
- }
- SendRequestNormal()
- {
- string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
- string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"user_name\":\""+mangletarget+"\",\"auth_token\":\""+session+"\"}";
- string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
- url += "APIURL=" + llEscapeURL(app);
- url += "&APIDATA=" + llEscapeURL(data);
- //llWhisper(0,"Sending API Request (Norm) mode:"+mode);
- apirequest = llHTTPRequest(url,[],"");
- GetSession();
- }
- SendRequestNull()
- {
- string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
- string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"auth_token\":\""+session+"\"}";
- string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
- url += "APIURL=" + llEscapeURL(app);
- url += "&APIDATA=" + llEscapeURL(data);
- //llWhisper(0,"Sending API Request (Null) mode:"+mode);
- apirequest = llHTTPRequest(url,[],"");
- GetSession();
- }
- SendRequestType()
- {
- string app = "http://www.bhr.vivox.com/api2/viv_acct.php?";
- string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"auth_token\":\""+session+"\"}";
- string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
- url += "APIURL=" + llEscapeURL(app);
- url += "&APIDATA=" + llEscapeURL(data);
- //llWhisper(0,"Sending API Request (Null) mode:"+mode);
- apirequest = llHTTPRequest(url,[],"");
- GetSession();
- }
- SendRequestFont()
- {
- string app = "http://www.bhr.vivox.com/api2/viv_acct.php?";
- string data = "{\"mode\":\""+mode+"\",\"username\":\""+mangletarget+"\",\"auth_token\":\""+session+"\"}";
- string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
- url += "APIURL=" + llEscapeURL(app);
- url += "&APIDATA=" + llEscapeURL(data);
- //llWhisper(0,"Sending API Request (Type) mode:"+mode+" type:"+type);
- apirequest = llHTTPRequest(url,[],"");
- GetSession();
- }
- SendRequestLoc()
- {
- locrequest = llHTTPRequest("http://www.bhr.vivox.com/ahah/ahah_acct.php?mode=get_online&username="+mangletarget+"&vx_session="+session+"&vvx_session="+session,[],"");
- //llWhisper(0,"Sending AHAH Request (Loc) mode:"+mode);
- GetSession();
- }
- default
- {
- state_entry()
- {
- llListen(1,"",llGetOwner(),"");
- GetSession();
- }
- listen(integer c, string n, key i, string m)
- {
- if(i != llGetOwner())
- return;
- list params = llParseString2List(m, [" "], []);
- string cmd = llList2String(params,0);
- string param = llList2String(params,1);
- if(cmd == "chan")
- {
- channelid = param;
- GetSession();
- //llWhisper(0,"Setting Channel ID: "+channelid);
- }
- else if(cmd == "mangle")
- {
- GetMangle(param);
- }
- else if(cmd == "admsession")
- {
- //GetAdmSession();
- }
- else if(cmd == "session")
- {
- GetSession();
- }
- else if(cmd == "change")
- {
- if(param == "pos")
- {
- mode = "modify";
- type = "Positional 3D";
- SendRequestType();
- }
- else if(param = "chan")
- {
- mode = "modify";
- type = "Conference Channel";
- SendRequestType();
- }
- }
- else if(cmd == "admin")
- {
- mode = "update";
- font = param;
- SendRequestFont();
- }
- else if(cmd == "locate")
- {
- SendRequestLoc();
- }
- else if(cmd == "kickall")
- {
- mode = "drop_all";
- SendRequestNull();
- }
- else if(cmd == "muteall")
- {
- mode = "mute_all";
- SendRequestNull();
- }
- else if(cmd == "unmuteall")
- {
- mode = "unmute_all";
- SendRequestNull();
- }
- else if(cmd == "run")
- {
- if(param == "norm")
- {
- SendRequestNormal();
- }
- else if(param == "uri")
- {
- SendRequestURI();
- }
- }
- else
- {
- //invite
- //hangup
- //unmute
- //mute
- //kick
- //unban
- //ban
- mode = cmd;
- GetMangle(param);
- }
- }
- http_response(key id, integer status, list metadata, string body)
- {
- if(status == 200)
- {
- if(id == sessionrequest)
- {
- session = getXMLValue(body, "auth_token");
- }
- else if(id == manglerequest)
- {
- mangletarget = llEscapeURL(getXMLValue(body, "translated_username"));
- llOwnerSay("Got Mangled UUID: "+mangletarget);
- }
- else if(id == apirequest)
- {
- //llWhisper(0,"API Response: "+getXMLValue(body, "status")+" : "+getXMLValue(body, "code")+" : "+getXMLValue(body, "msg"));
- llOwnerSay(body);
- }
- else if(id == locrequest)
- {
- integer start = llSubStringIndex(body,"javascript:ManageChannel(");
- integer end = llSubStringIndex(body,"');");
- string location = llGetSubString(body,start,end);
- //llWhisper(0,"Location Response: "+location);
- llOwnerSay(body);
- }
- }
- else
- {
- llOwnerSay(body);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement