Using E-Mail in LSL...
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
09-14-2008 17:35
I am about to create my own update server that uses a combination of E-Mail and linked messages, but right now I'm not entirely sure how E-Mail in LSL works. If someone could point me in the right direction, I would appreciate it. I don't need an entire script, just an explaination of how sending/recieving e-mails works and how I would implement this in a script. Thanks 
_____________________
Life is a highway... And I just missed my exit.
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
09-14-2008 18:41
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
09-14-2008 18:57
The script would need a means of knowing the Server's UUID, be it hard coded, or given a webserver to check, so it can tack @lsl.secondlife.com onto the end of it for the email address.
It would likely be standalone within a prim and trigger the llEmail when it recieves a correct link_message, something like ("update" + a security key) for the subject, with the item, version and the Agent UUID updates should be sent to as the message.
I use "#" inbetween each chunk of data for ease of seperating it Server end.
The Server would llGetNextEmail on a timer (unless theres a better way I missed.) and the email event would parse things into each chunk and act accordingly.
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
09-14-2008 20:44
From: Faust Vollmar I use "#" inbetween each chunk of data for ease of seperating it Server end. Why #? Is that easier for llSubStringIndex to pick out, or will any other character work? With the experimental server I've been playing around with I was using a format like this: PRODUCT_NAME (subject)<VERSION_NUMBER (body)>
_____________________
Life is a highway... And I just missed my exit.
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
09-14-2008 20:49
I use llParseString2List and check each entry. It's probably less efficient than SubStrings, but I tend to script with what is simple to me, running the string through a whole bunch of llSubStringIndex checks makes me go O_o
Though if you did use SubStrings, you could use seperator characters you know you wouldn't put in the data itself to make Indexing easier.
My emails look like this:
llEmail(emailadd, "UPDATE" + "#" + passkey, "#" + itemtype + "#" + version + "#" + (string)llGetOwner());
The leading "#" in the message is important because sender info is included in the message and needs to be parsed out.
The server parses the subject and message to lists using "#" and checks the list from the subject for UPDATE and the passkey, then it checks the list from the message for itemtype, if its a match to the types in it, then it checks version, either messaging the person or sending the new version depending on if its current or not.
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-14-2008 21:13
From: Faust Vollmar I use llParseString2List and check each entry. It's probably less efficient than SubStrings My experience is that not only is llParseString2List easier to read but it's also faster than using substrings and string indices. 
_____________________
http://slurl.com/secondlife/Together
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
09-14-2008 21:17
From: Escort DeFarge My experience is that not only is llParseString2List easier to read but it's also faster than using substrings and string indices.  Good to know. =) I'm not very versed in optimization of stuff. EDIT: If anyone wants I can give out an easily configured version of my update Server/Client. However I know nothing of PHP (which is a shame since I need to... cursed big projects.) or else I could give you a means of the Server sending a key somewhere for the Client to read.
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
OOokay....
09-15-2008 15:21
Mmkay, I have the server communicating with my product great, but now I've run into another problem. For some reason, it will not let me "skip" the seperator characters that I have put into the script.
The weird thing is, I can bypass ONE of the seperators in each piece of data, but when I try to do the other it simply wont work.
I've tried a bunch of things, including converting it to different types and back. Here is some of the code I have now:
if (requesting_name = product_name) { start = llSubStringIndex(mssg, "{"); end = llSubStringIndex(mssg, "}"); string data = llGetSubString(mssg, start, end); //<owner:object key>// integer seperator = llSubStringIndex(data, ":"); owner_key = (llGetSubString(data, (start + 1), (seperator - 1))); item_key = llGetSubString(data, seperator + 1, end - 1); llOwnerSay(owner_key); // some debug
No errors or anything... Compiles fine
_____________________
Life is a highway... And I just missed my exit.
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
09-15-2008 16:04
Hm, I'm not seeing why that goes wrong either... By all means that should pull the data out just fine... Have you given llParseString2List a try? It's easier to seperate without having to go through all the SubString stuff. This is what Mails from my Update Client to my Server look like. From: someone Object-Name: 0.5.4 Region: Nefrax (258048, 260352) Local-Position: (59, 222, 401)
#System#0.5.4#2fa16325-6d65-4550-98d4-d99b5c533a7d
Being parsed into a list by the Server, it reads entry 1 for the Item name, 2 for the Version and 3 for the Person. (0 is all the junk at the start.)
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
09-15-2008 18:37
I have just figured out that it isn't a problem with llSubString picking out where to start and end, it's a problem with subtracting from a start or end integer. I tried setting it to "start + 500000" and I got the same thing. If i manually find out where the message begins and use a plain number, it works perfectly fine. Is there a JIRA for this or something? --- EDIT: --- The problem has resolved itself... I'm not sure if it was a problem with the region I was testing it in, or if LL was having some sort of issues, or if they capped off the scripts because they were working to fast... Anyway, it's fine now and it works great  Thanks for your help everyone 
_____________________
Life is a highway... And I just missed my exit.
|