Skype Online Status

string skype_handle = "PUT-SKYPE-NAME-HERE";

key skype_request_id = NULL_KEY; // id of http request

showStatus(string skype_status)
{
    // build up our message
    string message = "Skype";
    message += "\nName: " + skype_handle;
    message += "\nStatus: " + skype_status;
    
    // write out the message as hovering text
    llSetText(message, <.5,.5,1>, 1);
}
default
{
    touch_start(integer total_number)
    {
        // make sure owner has specified handle
        if(skype_handle == "")
        {
            // send message to debugger
            llWhisper(DEBUG_CHANNEL, "skype_handle can not be empty.");
            return;
        }
        
        // prevent extra requests happening at the same time
        if(skype_request_id != NULL_KEY) return;
        
        // make a request over the internet
        skype_request_id = llHTTPRequest("http://mystatus.skype.com/" + skype_handle + ".txt", [HTTP_METHOD, "GET"], "");
        
        // set a timeout for http request
        llSetTimerEvent(5);
    }
    http_response(key request_id, integer status, list metadata, string body)
    {
        // is this a response to our request?
        if(request_id == skype_request_id) 
        {
            // show status
            showStatus(body);
            
            // change to view state
            state viewing;
        }

    }
    timer()
    {
        // didn't get a response in time.
        showStatus("No Response");
        
        // change to view state
        state viewing;
    }
}
state viewing
{
    state_entry()
    {
        // set next timer for 3 minutes
        llSetTimerEvent(180);
    }
    timer()
    {
        state default;
    }
    state_exit()
    {
        // stop the timer
        llSetTimerEvent(0);

        // hide the text
        llSetText("", ZERO_VECTOR, 0);
        
        // reset the request id
        skype_request_id = NULL_KEY;
    }
}
Navigation

Alternative Startseite
Helpdesk
Links
Maps
Radio
Suchmaschine


Drucken/exportieren