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
IM Email_to_IM  

Email_to_IM

The script

Category: IM
By : DoteDote Edison
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Email_to_IM
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Email_to_IM_1.lsl
1 // Email-to-IM
2 // DoteDote Edison
3
4 ///////// constants /////////
5 // how often to check for new email when owner is online (seconds)
6 float FAST = 60.0;
7 // how often to check owner online status when owner is offline (seconds)
8 float SLOW = 300.0;
9 // timezone offset from UTC
10 integer OFFSET = -4;
11
12 ////////// globals //////////
13 key request;
14 key owner;
15 integer owner_online;
16
17 string GetStamp(string time) {
18 list weekdays = ["THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED"];
19 integer a = (integer)time + (OFFSET*3600);
20 integer hours = a/3600;
21 integer mins = a/60;
22 string day = llList2String(weekdays, (hours/24)%7);
23 return (string)(hours%24) + ":" + (string)(mins%60) + " " + day;
24 }
25
26 default {
27 state_entry() {
28 owner = llGetOwner();
29 string address = (string)llGetKey() + "@lsl.secondlife.com";
30 llSetText("Email Server\nOnline", <0.25, 1.0, 0.25>, 1.0);
31 llOwnerSay("Now online. The Email-to-IM address for " + llKey2Name(owner) + " is:\n" + address);
32 llSetTimerEvent(FAST);
33 }
34 on_rez(integer start_param) {
36 }
37 touch_start(integer num_detect) {
38 if(llDetectedKey(0) == owner) state off;
39 }
40 email(string time, string sender, string subject, string body, integer num_remain) {
41 llInstantMessage(owner, "Email Received from: " + sender + " -- " + GetStamp(time));
42 llInstantMessage(owner, body);
43 if(num_remain > 0) llGetNextEmail("", "");
44 }
45 dataserver(key query, string data) {
46 if(query == request) {
47 request = "";
48 if(data == "1") {
49 owner_online = TRUE;
50 llSetTimerEvent(FAST);
51 }
52 else {
53 owner_online = FALSE;
54 llSetTimerEvent(SLOW);
55 }
56 }
57 }
58 timer() {
59 request = llRequestAgentData(owner, DATA_ONLINE);
60 if(owner_online) llGetNextEmail("", "");
61 }
62 state_exit() {
63 llSetTimerEvent(0.0);
64 llSetText("Email Server\nOffline", <1.0, 0.25, 0.25>, 1.0);
65 }
66 }
67
68 state off {
69 touch_start(integer num_detect) {
70 if(llDetectedKey(0) == owner) state default;
71 }
72 on_rez(integer start_param) {
74 }
75 }

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