Difference between revisions of "LlEmail/ja"

From Second Life Wiki
Jump to navigation Jump to search
m (カテゴリ変更)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Issues/SVC-23}}{{Issues/SVC-391}}{{Issues/SVC-412}}
{{LSL_Function/ja
{{LSL_Function/ja
|func_id=119|func_sleep=20.0|func_energy=10.0
|func_id=119|func_sleep=20.0|func_energy=10.0
Line 5: Line 6:
|p2_type=string|p2_name=subject
|p2_type=string|p2_name=subject
|p3_type=string|p3_name=message
|p3_type=string|p3_name=message
|func_footnote
|func_footnote=メッセージ全体 (アドレス、タイトルやその他諸々のフィールド) は合計で 4096 バイトを超えてはなりません。
|func_desc='''subject'''と'''message'''を'''address'''にemailで送ります。
|func_desc='''subject''' と '''message''' を '''address''' に電子メールで送ります。
|return_text
|return_text
|spec='''message'''はプリムが送信するemailの情報の頭に置かれます。
|spec='''message''' の頭に電子メールを送信するプリムの情報が付加されます。
{{{!}}{{Prettytable}}
{{{!}}{{Prettytable}}
{{!}}-{{Hl2}}
{{!}}-{{Hl2}}
!Template
!テンプレート
!Example
!
{{!}}-
{{!}}-
{{!}}<pre>
{{!}}<pre>
Line 31: Line 32:
{{!}}}
{{!}}}
|caveats=* オブジェクトが一定時間に送信できるemailメッセージの数には限界があります。
|caveats=* オブジェクトが一定時間に送信できるemailメッセージの数には限界があります。
* 1 人のエージェントが所有するオブジェクトから 1 時間に送信できるメッセージは 500 個までです。
* 4096 バイトの制限には、タイトルと、自動的に挿入される文字列も含みます。実質的な最大サイズは約 3600 バイトになります。
* (2008 年 9 月) 電子メールのスロットルが微妙に変更されました。 {{User|Prospero Linden}} 曰く、「今までは長いスロットルで、1 個のスクリプトが電子メールを送信した後 20 秒間スリープするようにしていました。新しいスロットルはユーザごとになります... ユーザの中には、スパムを送信するために、たくさんの違うスクリプトを使っていました。 (新しいスロットルは) Second Life の外に対して送信するときに適用されます。同じ地域内で送信するメッセージは (20 秒遅延の) スロットル調整はされていませんでした。そして、他の SIM に対して送信するメッセージも (20 秒遅延の) スロットル調整はされていなかったのではないかと *思って* います。」
* バグ {{Jira|SVC-23}} (2005 年から存在) により、地域が再起動されたりオブジェクトが地域の境界線をまたいだりするまでは、オブジェクトが電子メールを全く受信できないことがあります (スクリプトのリセットでも駄目です) 。送信された電子メールは再起動/地域間移動したあと、徐々に受信されていきます。このため、この関数を信頼できる SIM 間メッセージング手段と思ってはいけません。
|constants
|constants
|examples=
|examples=
<lsl>
<source lang="lsl2">
string email = "";
string email_address = "somebody@example.com"; // メッセージ受信者
default
{
    state_entry() {
        //電子メールを通常のメールアカウントに送信します
        llEmail( email_address, "Look it's an email subject line!", "Testing 1 2 3" );
    }
    touch_start( integer num_detected ) {
        integer i = 0;
        // 別の電子メールを送信して、誰がプリムに触ったかを知らせます
        do
            llEmail( email_address, "No touching!", "I was defiled by: " + llDetectedName(i) + "\nKey: " + (string) llDetectedKey(i) );
        while(++i < num_detected);
    }
}
</source>
|also_functions=
{{LSL DefineRow|{{LSLG/ja|llGetNextEmail}}}}
{{LSL DefineRow|{{LSLG/ja|llMessageLinked}}}}
|also_events=
{{LSL DefineRow|{{LSLG/ja|email}}}}
{{LSL DefineRow|{{LSLG/ja|link message}}}}
|also_tests
|also_articles=
{{LSL DefineRow|[[IM to email]]}}
{{LSL DefineRow|[[Postcards]]}}
|notes=* この関数は遅延時間が長いため、 {{LSLG/ja|link_message}} で呼ばれたサブスクリプトで呼び出されることがよくあります。
* Second Life のプリムに電子メールを送る場合、アドレスは ''[key]''@lsl.secondlife.com になります。
** {{LSLG/ja|llGetKey}} で返却されたキーが "a2e76fcd-9360-4f6d-a924-000000000003" ならば、電子メールアドレスは "a2e76fcd-9360-4f6d-a924-000000000003@lsl.secondlife.com" になるということです。
** エージェントには固定電子メールアドレスがありません。 {{LSLG/ja|llInstantMessage}} または {{LSLG/ja|llOwnerSay}} を使用しましょう。
 
===プリム間電子メール{{Anchor|Prim2Prim_Email}}===
 
LSL では電子メールを llEmail で送信し、 {{LSLG/ja|email}} イベントでそれを受信することができます。
 
 
email イベントは発生時に 5 つの情報を見せます。
{{{!}}
{{LSL DefineRow|string|time|メッセージの送信時刻。 <code>(string){{LSLG/ja|llGetUnixTime}}</code> 形式}}
{{LSL DefineRow|string|address|メッセージ送信者}}
{{LSL DefineRow|string|subject|メッセージのタイトル}}
{{LSL DefineRow|string|message|メッセージの本文}}
{{LSL DefineRow|integer|num_left|キューに残っているメッセージの数}}
{{!}}}
 
 
送信されたメッセージを {{LSLG/ja|llEmail}} で受信するとき、先頭にあるヘッダからメッセージを切り出します。ヘッダと元のメッセージ本文は "\n\n" で区切られています。
 
<source lang="lsl2">integer divide = llSubStringIndex(message, "\n\n");
string header = llDeleteSubString(message, divide, -1);
message = llDeleteSubString(message, 0, divide + 1);</source>
 
ヘッダ要素のうち 1 つだけを取得したい場合は、このようにします:
<source lang="lsl2">list lines = llParseStringKeepNulls(header, ["\n"], []);
string objname_line = llList2String(lines, 0);
string region_line = llList2String(lines, 1);
string localpos_line = llList2String(lines, 2);</source>
 
純粋な地域名を取得したい場合は、このようにします:
<source lang="lsl2">string region_name = llStringTrim(
            (string)llDeleteSubList(
                llParseStringKeepNulls(
                    llDeleteSubString(region_line, 0, 12),
                    [],
                    ["("]
                ), -2, -1), STRING_TRIM);</source>


このアプリケーションでは電子メールを使って、オブジェクトが中央制御サーバに問い合わせを行い、オーナーが最新のバーションをもっているかを確認します。オブジェクトの中:
<source lang="lsl2">string version = "1"; //
string type = "lolcube";
default
default
{
{
     state_entry()  
    on_rez(integer start_param)
    {
        llEmail("5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com",
            version,
            (string)llGetOwner() + "," + type);
    }
}</source>
サーバ:
<source lang="lsl2">default
{
     state_entry()
     {
     {
         if(email == "")
         llSetTimerEvent(15.0);
            email = (string)llGetKey()+"@lsl.secondlife.com";
 
        //Send an email to a normal email account
        llEmail( email, "Look it's an email subject line!", "Testing 1 2 3" );
     }
     }
 
   
     touch_start( integer num_detected )
     timer()
     {
     {
         //Send an email to the person who touched the prim
         llGetNextEmail("", "");
         llEmail( email, "No touching!", "I was defiled by: " + llDetectedName(0)+"\nKey: "+(string)llDetectedKey(0) );
    }
   
    email( string time, string address, string version, string message, integer num_left )
    {   
        if ((integer)version < 2)
         {
            list info = llCSV2List( llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1));
            llGiveInventory(llList2Key(info,0), llList2String(info,1));
        }
       
        if(num_left)
            llGetNextEmail("","");
     }
     }
}
}</source>
</lsl>
|helpers=
|helpers=
<lsl>
<source lang="lsl2">
email( string time, string address, string subj, string message, integer num_left )
email( string time, string address, string subj, string message, integer num_left )
{
{
     if(llGetSubString(address, -19, -1) == "@lsl.secondlife.com")//trim the header
     if(llGetSubString(address, -19, -1) == "@lsl.secondlife.com")//ヘッダをトリム
         message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
         message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
}
}
</lsl>
</source>
|also_functions=*{{LSLG/ja|llGetNextEmail}}
*{{LSLG|llMessageLinked}}
|also_events=*{{LSLG/ja|email}}
*{{LSLG|link message}}
|also_tests=*[[llEmail/ja|llEmail]]
|also_articles
|notes=* この関数上での長い遅延の理由は、しばしば{{LSLG/ja|link message}}によって作動する他のスクリプトから呼ばれるためです。
* SecondLifeでemailを送信している場合、アドレスは''[key]''@lsl.secondlife.comとなることを覚えてください。
** その意味は、[[llGetKey/ja|llGetKey]]が"a2e76fcd-9360-4f6d-a924-000000000003"というkeyを返す場合に、emailアドレスは"a2e76fcd-9360-4f6d-a924-000000000003@lsl.secondlife.com"になる、ということです。
|permission
|permission
|negative_index
|negative_index
|cat1=Communications/ja
|cat1=Communications
|cat2=Email/ja
|cat2=Email
|cat3
|cat3
|cat4
|cat4
}}{{OSWikiFeatureNav}}
}}
=== デザインドキュメントの特性 ===
(none)
 
=== 関数仕様 ===
(none)
 
=== テストスクリプト ===
[https://osiris.lindenlab.com/mediawiki/index.php/Email_Test 内部テスト]
 
=== 将来的な改善の議論 ===
(none)
 
=== 他の特性との関係 ===
<b> 特性の一覧は特性の変更及び何故そうするのかをテストをされるために必要です。 </b>
 
[[IM to email/ja|IMをemailに]] - verify IM -> email の作業間検証
 
[[Postcards/ja|ポストカード]] - ポストカードはmail以外を使いますか?
 
 
=== ユーザガイド ===
[http://lslwiki.net/lslwiki/wakka.php?wakka=llemail LSLwiki.netのllEmail]

Latest revision as of 04:41, 25 February 2016

要約

関数: llEmail( string address, string subject, string message );

subjectmessageaddress に電子メールで送ります。

• string address
• string subject
• string message

メッセージ全体 (アドレス、タイトルやその他諸々のフィールド) は合計で 4096 バイトを超えてはなりません。

仕様

message の頭に電子メールを送信するプリムの情報が付加されます。

テンプレート
Object-Name: *prim*
Region: *simname* (*simpos.x*, *simpos.y*)
Local-Position: (*primpos.x*, *primpos.y*, *primpos.z*)

*message*
Object-Name: Object
Region: Gibson (254976, 256000)
Local-Position: (117, 129, 50)

実際のメッセージはここから始まります。

警告

  • この関数は 20.0 秒間、スクリプトを停止します。
  • オブジェクトが一定時間に送信できるemailメッセージの数には限界があります。
  • 1 人のエージェントが所有するオブジェクトから 1 時間に送信できるメッセージは 500 個までです。
  • 4096 バイトの制限には、タイトルと、自動的に挿入される文字列も含みます。実質的な最大サイズは約 3600 バイトになります。
  • (2008 年 9 月) 電子メールのスロットルが微妙に変更されました。 Prospero Linden 曰く、「今までは長いスロットルで、1 個のスクリプトが電子メールを送信した後 20 秒間スリープするようにしていました。新しいスロットルはユーザごとになります... ユーザの中には、スパムを送信するために、たくさんの違うスクリプトを使っていました。 (新しいスロットルは) Second Life の外に対して送信するときに適用されます。同じ地域内で送信するメッセージは (20 秒遅延の) スロットル調整はされていませんでした。そして、他の SIM に対して送信するメッセージも (20 秒遅延の) スロットル調整はされていなかったのではないかと *思って* います。」
  • バグ SVC-23 (2005 年から存在) により、地域が再起動されたりオブジェクトが地域の境界線をまたいだりするまでは、オブジェクトが電子メールを全く受信できないことがあります (スクリプトのリセットでも駄目です) 。送信された電子メールは再起動/地域間移動したあと、徐々に受信されていきます。このため、この関数を信頼できる SIM 間メッセージング手段と思ってはいけません。

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llEmail and llHTTPRequest do not handle non-ASCII characters
   Include "Content-Type: text/plain; charset=UTF-8" header in the messages forwarded from second life.

サンプル

string email_address = "somebody@example.com"; // メッセージ受信者
 
default
{
    state_entry() {
 
        //電子メールを通常のメールアカウントに送信します
        llEmail( email_address, "Look it's an email subject line!", "Testing 1 2 3" );
    }
 
    touch_start( integer num_detected ) {
        integer i = 0;
 
        // 別の電子メールを送信して、誰がプリムに触ったかを知らせます
        do
            llEmail( email_address, "No touching!", "I was defiled by: " + llDetectedName(i) + "\nKey: " + (string) llDetectedKey(i) );
        while(++i < num_detected);
    }
}

便利なスニペット

email( string time, string address, string subj, string message, integer num_left )
{
    if(llGetSubString(address, -19, -1) == "@lsl.secondlife.com")//ヘッダをトリム
        message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
}

注意点

  • この関数は遅延時間が長いため、 link_message で呼ばれたサブスクリプトで呼び出されることがよくあります。
  • Second Life のプリムに電子メールを送る場合、アドレスは [key]@lsl.secondlife.com になります。
    • llGetKey で返却されたキーが "a2e76fcd-9360-4f6d-a924-000000000003" ならば、電子メールアドレスは "a2e76fcd-9360-4f6d-a924-000000000003@lsl.secondlife.com" になるということです。
    • エージェントには固定電子メールアドレスがありません。 llInstantMessage または llOwnerSay を使用しましょう。

プリム間電子メール

LSL では電子メールを llEmail で送信し、 email イベントでそれを受信することができます。


email イベントは発生時に 5 つの情報を見せます。

• string time メッセージの送信時刻。 (string)llGetUnixTime 形式
• string address メッセージ送信者
• string subject メッセージのタイトル
• string message メッセージの本文
• integer num_left キューに残っているメッセージの数


送信されたメッセージを llEmail で受信するとき、先頭にあるヘッダからメッセージを切り出します。ヘッダと元のメッセージ本文は "\n\n" で区切られています。

integer divide = llSubStringIndex(message, "\n\n");
string header = llDeleteSubString(message, divide, -1);
message = llDeleteSubString(message, 0, divide + 1);

ヘッダ要素のうち 1 つだけを取得したい場合は、このようにします:

list lines = llParseStringKeepNulls(header, ["\n"], []);
string objname_line = llList2String(lines, 0);
string region_line = llList2String(lines, 1);
string localpos_line = llList2String(lines, 2);

純粋な地域名を取得したい場合は、このようにします:

string region_name = llStringTrim(
            (string)llDeleteSubList(
                llParseStringKeepNulls(
                    llDeleteSubString(region_line, 0, 12),
                    [], 
                    ["("]
                ), -2, -1), STRING_TRIM);

このアプリケーションでは電子メールを使って、オブジェクトが中央制御サーバに問い合わせを行い、オーナーが最新のバーションをもっているかを確認します。オブジェクトの中:

string version = "1"; //
string type = "lolcube";
default
{
    on_rez(integer start_param)
    {
        llEmail("5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com",
            version,
            (string)llGetOwner() + "," + type);
    }
}

サーバ:

default
{
    state_entry()
    {
        llSetTimerEvent(15.0);
    }
    
    timer()
    {
        llGetNextEmail("", "");
    }
    
    email( string time, string address, string version, string message, integer num_left )
    {    
        if ((integer)version < 2)
        {
            list info = llCSV2List( llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1));
            llGiveInventory(llList2Key(info,0), llList2String(info,1));
        }
        
        if(num_left)
            llGetNextEmail("","");
    }
}

関連項目

イベント

• email
• link message

関数

• llGetNextEmail
• llMessageLinked

記事

• IM to email
• Postcards

特記事項

All Issues

~ Search JIRA for related Issues
   Region incoming email queue for objects becomes suspended
   llEmail and llHTTPRequest do not handle non-ASCII characters
   Include "Content-Type: text/plain; charset=UTF-8" header in the messages forwarded from second life.

Signature

function void llEmail( string address, string subject, string message );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。