Second Life Copybot
message relay script - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Communication Scripts (https://secondlifecopybot.com/forum-46.html)
+----- Thread: message relay script (/thread-671.html)



message relay script - zion - 02-18-2013

PHP Code:
// Cross-region intercom: MESSAGE RELAY
 
//////////////////////////////////////////////////////////
//--------------------- INTERNALS ----------------------//
//////////////////////////////////////////////////////////
 
list beaconQueue;
list 
messageQueue;
 
integer isValidURL(string URL)
{
    if(~
llSubStringIndex(URL"http://") &&
        ~
llSubStringIndex(URL"lindenlab.com") &&
        ~
llSubStringIndex(URL"cap"))
    {
        return 
TRUE;
    }
 
    return 
FALSE;
}
 
default
{
    
state_entry()
    {
        
llSetTimerEvent(1.0);
    }
 
    
link_message(integer sender_numinteger numstring strkey id)
    {
        list 
msg llParseString2List(id, ["="], [""]);
        if(
llList2String(msg0) != "@send_message")
        {
            return;
        }
        list 
broadcastBeacons llCSV2List(str);
        if(!
llGetListLength(broadcastBeacons))
        {
            return;
        }
        
integer itra;
        for(
itra 0itra llGetListLength(broadcastBeacons); ++itra)
        {
            if(~
llListFindList(beaconQueuellList2List(broadcastBeaconsitraitra)))
            {
                
jump continue;
            }
            if(!
isValidURL(llList2String(broadcastBeaconsitra)))
            {
                
jump continue;
            }
            
beaconQueue += llList2List(broadcastBeaconsitraitra);
@continue;
        }
        
messageQueue += llList2List(msg11);
 
    }
 
    
timer()
    {
        if(!
llGetListLength(messageQueue))
        {
            
jump reschedule;
        }
        if(
isValidURL(llList2String(beaconQueue0)) && isValidURL(llList2String(beaconQueue0)))
        {
            
llHTTPRequest(llList2String(beaconQueue0), [HTTP_METHOD"PUT"], llList2String(messageQueue0));
        }
        
beaconQueue llDeleteSubList(beaconQueue00);
        if(!
llGetListLength(beaconQueue))
        {
            
messageQueue llDeleteSubList(messageQueue00);
        }
@
reschedule;
        
llSetTimerEvent(1.0);
    }