Advertisement
Guest User

kabalyero

a guest
Sep 1st, 2010
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.43 KB | None | 0 0
  1. key apirequest;
  2. key sessionrequest;
  3. key manglerequest;
  4. key locrequest;
  5.  
  6. string session = "";
  7. string channelid = "";
  8. string mode = "";
  9. string mangletarget = "";
  10. string type = "";
  11. string font = "";
  12.  
  13. string getXMLValue(string xmlstring, string element)
  14. {
  15. string value = "";
  16. string elementopen = "<" + element + ">";
  17. string elementclose = "</" + element + ">";
  18. integer elementstart = llSubStringIndex(xmlstring, elementopen);
  19. if(elementstart == -1)
  20. return "NO_XML";
  21. integer valuestart = elementstart + llStringLength(elementopen);
  22. integer valueend = llSubStringIndex(xmlstring, elementclose) - 1;
  23. value = llGetSubString(xmlstring, valuestart, valueend);
  24. return value;
  25. }
  26.  
  27. GetMangle(string uuid)
  28. {
  29. manglerequest = llHTTPRequest("http://vir5ag.vivox.com/dave/jon/sl/mangle_uuid.php?uuid="+uuid,[],"");
  30. }
  31.  
  32. GetSession()
  33. {
  34. sessionrequest = llHTTPRequest("http://vir5ag.vivox.com/dave/jon/sl/Vend_API.php",[],"");
  35. }
  36.  
  37. /*GetAdmSession()
  38. {
  39. sessionrequest = llHTTPRequest("http://www.bhr.vivox.com/api2/viv_portal_signin.php?username=TestAdmin2&pwd=",[],"");
  40. }*/
  41.  
  42. SendRequestURI()
  43. {
  44. string mangletargeturi = "sip:"+mangletarget+"@bhr.vivox.com";
  45.  
  46. string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
  47. string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"user_uri\":\""+mangletargeturi+"\",\"auth_token\":\""+session+"\"}";
  48.  
  49. string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
  50. url += "APIURL=" + llEscapeURL(app);
  51. url += "&APIDATA=" + llEscapeURL(data);
  52. //llWhisper(0,"Sending API Request (URI) mode:"+mode);
  53. apirequest = llHTTPRequest(url,[],"");
  54. GetSession();
  55. }
  56.  
  57. SendRequestNormal()
  58. {
  59. string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
  60. string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"user_name\":\""+mangletarget+"\",\"auth_token\":\""+session+"\"}";
  61.  
  62. string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
  63. url += "APIURL=" + llEscapeURL(app);
  64. url += "&APIDATA=" + llEscapeURL(data);
  65. //llWhisper(0,"Sending API Request (Norm) mode:"+mode);
  66. apirequest = llHTTPRequest(url,[],"");
  67. GetSession();
  68. }
  69.  
  70. SendRequestNull()
  71. {
  72. string app = "http://www.bhr.vivox.com/api2/viv_chan_cmd.php?";
  73. string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"auth_token\":\""+session+"\"}";
  74.  
  75. string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
  76. url += "APIURL=" + llEscapeURL(app);
  77. url += "&APIDATA=" + llEscapeURL(data);
  78. //llWhisper(0,"Sending API Request (Null) mode:"+mode);
  79. apirequest = llHTTPRequest(url,[],"");
  80. GetSession();
  81. }
  82.  
  83. SendRequestType()
  84. {
  85. string app = "http://www.bhr.vivox.com/api2/viv_acct.php?";
  86. string data = "{\"mode\":\""+mode+"\",\"chan_id\":\""+channelid+"\",\"auth_token\":\""+session+"\"}";
  87.  
  88. string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
  89. url += "APIURL=" + llEscapeURL(app);
  90. url += "&APIDATA=" + llEscapeURL(data);
  91. //llWhisper(0,"Sending API Request (Null) mode:"+mode);
  92. apirequest = llHTTPRequest(url,[],"");
  93. GetSession();
  94. }
  95.  
  96. SendRequestFont()
  97. {
  98. string app = "http://www.bhr.vivox.com/api2/viv_acct.php?";
  99. string data = "{\"mode\":\""+mode+"\",\"username\":\""+mangletarget+"\",\"auth_token\":\""+session+"\"}";
  100.  
  101. string url = "http://vir5ag.vivox.com/dave/jon/sl/api_wrapper.php?";
  102. url += "APIURL=" + llEscapeURL(app);
  103. url += "&APIDATA=" + llEscapeURL(data);
  104. //llWhisper(0,"Sending API Request (Type) mode:"+mode+" type:"+type);
  105. apirequest = llHTTPRequest(url,[],"");
  106. GetSession();
  107. }
  108.  
  109. SendRequestLoc()
  110. {
  111. locrequest = llHTTPRequest("http://www.bhr.vivox.com/ahah/ahah_acct.php?mode=get_online&username="+mangletarget+"&vx_session="+session+"&vvx_session="+session,[],"");
  112. //llWhisper(0,"Sending AHAH Request (Loc) mode:"+mode);
  113. GetSession();
  114. }
  115.  
  116. default
  117. {
  118. state_entry()
  119. {
  120. llListen(1,"",llGetOwner(),"");
  121. GetSession();
  122. }
  123.  
  124. listen(integer c, string n, key i, string m)
  125. {
  126. if(i != llGetOwner())
  127. return;
  128.  
  129. list params = llParseString2List(m, [" "], []);
  130.  
  131. string cmd = llList2String(params,0);
  132. string param = llList2String(params,1);
  133.  
  134. if(cmd == "chan")
  135. {
  136. channelid = param;
  137. GetSession();
  138. //llWhisper(0,"Setting Channel ID: "+channelid);
  139. }
  140. else if(cmd == "mangle")
  141. {
  142. GetMangle(param);
  143. }
  144. else if(cmd == "admsession")
  145. {
  146. //GetAdmSession();
  147. }
  148. else if(cmd == "session")
  149. {
  150. GetSession();
  151. }
  152. else if(cmd == "change")
  153. {
  154. if(param == "pos")
  155. {
  156. mode = "modify";
  157. type = "Positional 3D";
  158. SendRequestType();
  159. }
  160. else if(param = "chan")
  161. {
  162. mode = "modify";
  163. type = "Conference Channel";
  164. SendRequestType();
  165. }
  166. }
  167. else if(cmd == "admin")
  168. {
  169. mode = "update";
  170. font = param;
  171. SendRequestFont();
  172. }
  173. else if(cmd == "locate")
  174. {
  175. SendRequestLoc();
  176. }
  177. else if(cmd == "kickall")
  178. {
  179. mode = "drop_all";
  180. SendRequestNull();
  181. }
  182. else if(cmd == "muteall")
  183. {
  184. mode = "mute_all";
  185. SendRequestNull();
  186. }
  187. else if(cmd == "unmuteall")
  188. {
  189. mode = "unmute_all";
  190. SendRequestNull();
  191. }
  192. else if(cmd == "run")
  193. {
  194. if(param == "norm")
  195. {
  196. SendRequestNormal();
  197. }
  198. else if(param == "uri")
  199. {
  200. SendRequestURI();
  201. }
  202. }
  203. else
  204. {
  205. //invite
  206. //hangup
  207. //unmute
  208. //mute
  209. //kick
  210.  
  211. //unban
  212. //ban
  213. mode = cmd;
  214. GetMangle(param);
  215. }
  216. }
  217.  
  218. http_response(key id, integer status, list metadata, string body)
  219. {
  220. if(status == 200)
  221. {
  222. if(id == sessionrequest)
  223. {
  224. session = getXMLValue(body, "auth_token");
  225. }
  226. else if(id == manglerequest)
  227. {
  228. mangletarget = llEscapeURL(getXMLValue(body, "translated_username"));
  229. llOwnerSay("Got Mangled UUID: "+mangletarget);
  230. }
  231. else if(id == apirequest)
  232. {
  233. //llWhisper(0,"API Response: "+getXMLValue(body, "status")+" : "+getXMLValue(body, "code")+" : "+getXMLValue(body, "msg"));
  234. llOwnerSay(body);
  235. }
  236. else if(id == locrequest)
  237. {
  238. integer start = llSubStringIndex(body,"javascript:ManageChannel(");
  239. integer end = llSubStringIndex(body,"');");
  240. string location = llGetSubString(body,start,end);
  241. //llWhisper(0,"Location Response: "+location);
  242. llOwnerSay(body);
  243. }
  244. }
  245. else
  246. {
  247. llOwnerSay(body);
  248. }
  249. }
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement