Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Email Simple_Email_Parser  

Simple_Email_Parser

The script

Category: Email
By : Plowboy Lifestyle
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Simple_Email_Parser
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Simple_Email_Parser_1.lsl
1 default {
3 llEmail((string)llGetKey() + "@lsl.secondlife.com", "Test!", "This (is) a test message.\n This is test message line two."); // Send email to self.
4 llSetTimerEvent(2.5); // Poll for emails. (Yes, that is a retarded way on an event-based system!)
5 }
6
7 timer() {
8 llGetNextEmail("", ""); // Check for email with any sender address and subject.
9 }
10
11 email(string time, string address, string subj, string message, integer num_left) {
12 string object_name;
13 string region_name;
14 float region_corner_x;
15 float region_corner_y;
16 vector local_position;
17 string message_body;
18
19 // Parse email to list
20 list email_parts = llParseString2List(message,[],["\n"," (",")",", ","Object-Name: ","Region: "]);
21 list format_parts = ["Object-Name: ","x","\n","Region: ","x"," (","X",", ","X",")","\n","Local-Position:"," (","X",", ","X",", ","X",")","\n","\n"];
22 // Determine if email is properly formatted.
23 integer error = FALSE;
24 if(llGetListLength(email_parts)>20) {
25 integer n;
26 for (n=0;n<21;n++) {
27 string f = llList2String(format_parts,n);
28 string e = llList2String(email_parts,n);
29 if((f!="x")&&(f!="X")) {
30 if(f!=e) error = TRUE;
31 }
32 }
33 }
34 else {
35 error = TRUE;
36 }
37
38 if(error) {
39 object_name = "unknown";
40 region_name = "unknown";
41 region_corner_x = -1.0;
42 region_corner_y = -1.0;
43 local_position = ZERO_VECTOR;
44 message_body = message;
45 }
46 else {
47 object_name = llList2String(email_parts,1);
48 region_name = llList2String(email_parts,4);
49 region_corner_x = (float)llList2String(email_parts,6);
50 region_corner_y = (float)llList2String(email_parts,8);
51 local_position = <(float)llList2String(email_parts,13),
52 (float)llList2String(email_parts,15),
53 (float)llList2String(email_parts,17)>;
54 message_body = llDumpList2String(llDeleteSubList(email_parts, 0, 20),"");
55 }
56
57 llSay(0, "You got mail! " + (string)num_left + " more mails.");
58 llSay(0, "Unix Time: " + (string)time);
59 llSay(0, "Address: " + (string)address);
60 llSay(0, "Subject: " + (string)subj);
61 llSay(0, "Object_Name: "+(string)object_name);
62 llSay(0, "Region_Name: "+(string)region_name);
63 llSay(0, "Region_Corner_x: "+(string)region_corner_x);
64 llSay(0, "Region_Corner_y: "+(string)region_corner_y);
65 llSay(0, "Local_Position: "+(string)local_position);
66 llSay(0, "Message_Body: "+(string)message_body);
67 }
68 }

Back to the Best Free Tools in Second Life and OpenSim.