quote:
Originally posted by markee
quote:
Originally posted by -dt-
er just check for it on received message
code:
function OnEvent_ChatWndReceiveMessage (wnd, origin, msg){
switch(msg){
case "!xxx" : wnd.SendMessage(AzureusInfoFetch()); break;
}
}
(the function name may be incorrect, since I'm unable to download the scripting docs here )
That is very silly as the only way it will work (due to async) is to freeze messenger while it gets it
it was just a quickly written example, I assumed that all he wanted to know was how to have data sent back when someone says !xxx. ;o but it seems now that I misread his post, and he wanted to know how to send the message from the callback ;o
code:
function AzureusInfoFetch(wnd)
{
http = new ActiveXObject("Microsoft.XMLHTTP");
http.onreadystatechange=function(){
if ((http.readyState == 4) && (http.status == 200))
{
var Azureus = AzureusInfo(http.responseText);
wnd.SendMessage(Azureus);
}
http.close();
}
http.open("GET", "http://" + "192.168.0.2" + ":" + "6885/index.tmpl", true, "StevieD", "lolpassword");
http.send(null);
}
function AzureusInfo(text)
{
if (text.indexOf('<tr id="r'+n) > -1)
{
XBMCArtist = text.substring(text.indexOf('<tr id="r1"'), text.length);
XBMCArtist = XBMCArtist.substring(0, XBMCArtist.indexOf('</tr>')+5);
XBMCArtist=XBMCArtist.split("<td");
.....
}
function OnEvent_ChatWndReceiveMessage (wnd, origin, msg){
switch(msg){
case "!xxx" : AzureusInfoFetch(wnd); break;
}
}
that should work ;o