Send Group Notices, Retrieve Past Notices and Accept or Decline Notice Attachments

6 October 2016

  • Release 9.133 - The command now can take a path instead of a name.

21 May 2016

  • Release 9.78 - added optional parameter target.

4 November 2015

  • Release 9.36 - added the required action parameter with send, list, accept or decline as possible values.

24 September 2015

  • Release 9.18 - added permissions optional parameter.

21 December 2014

  • Release 7.34 - added group Corrade permission.
notice (Commands)
TypeCorrade progressive command
Commandnotice
DescriptionThe notice command sends a notice to a configured group or a group specified by the optional target parameter.
Permissionsgroup
Parametersgroup, password, action
Last ChangesRelease 9.133 - The command now can take a path instead of a name.

The notice command sends a notice to a configured group or a group specified by the optional target parameter.

Command Required Parameters Required Corrade Permissions Required Group Abilities Example
notice group, password, action group Notices→Send Notices
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            "command", "notice",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "action", "send",
            "subject", "My store",
            "message", "Store is updated!"
        ]
    )
);
Parameter Possible Value Second Parameters Description Example
action send message The message to send in the notice.
subject Send a notice.
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            "command", "notice",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "message", "Store is updated!",
            "subject", "Updates",
            "action", "send"
        ]
    )
);
item Sends an attachment along with the notice.
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            "command", "notice",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "message", "A gift for our members!",
            "subject", "Gift",
            "item", wasURLEscape("/My Inventory/hats/Mesh Hat"),
            "action", "send"
        ]
    )
);
permissions Sets the permissions on the attachment when sending the notice where the to set on the attachment before sending.
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Send a notice with:
            // The message set to "test message",
            // The subject set to "test subject",
            // The attachment named "test notecard"
            // And set the permissions for the
            // next owner of the attachment to:
            // modify / copy / no transfer
            "command", "notice",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "item", "test notecard",
            // modify / copy / no transfer
            "permissions", "c--mvt------------c--mv-c--mvt",
            "message", "test message",
            "subject", "test subject",
            "action", "send",
            "callback", wasURLEscape(URL)
        ]
    )
);
list List all notices as a CSV list of asset (set to the asset type if the notice has an attachment or Unknown) by name (set to the name of the person that has sent the notice) by attachments (set to True in case the notice contains an attachment) by notice (set to the UUID of the notice by subject (set to the subject of the notice) by time set to the Unix time when the notice was sent (in UTC).
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            "command", "notice",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "action", "list",
            "callback", wasURLEscape(URL)
        ]
    )
);
accept notice (retrieved by the list action) or agent by UUID (or firstname and lastname), session and folder retrieved from the notice notification Accept a notice attachment.
decline Decline a notice attachment.
Optional Parameter Possible Value Description
target A group name or UUID. The group to act upon. If this parameter is omitted, then the command acts upon the configured group passed to the group parameter.

For more details on the permission notation please see the Corrade permission notation page.

Notes

  • Sending notices is subject to the following limits:
    • Message length: $512$ single byte characters,
    • Subject length: $63$ single byte characters

Examples

PowerShell 2.0

Sending a group notice to multiple groups can be done, for example in PowerShell, by accessing Corrade via its HTTP server (in this example http://192.168.1.1:8080/). The script must be edited to change the parameters under the CONFIGURATION section.

A shortcut can then be placed on the Windows desktop and by double clicking the script will prompt for a subject and a message and then distribute the notice to all groups contained in the $Groups variable.

multiplegroupnotices.ps1
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2019 - License: GNU GPLv3      ##
##  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  ##
##  rights of fair usage, the disclaimer and warranty conditions.        ##
###########################################################################
 
###########################################################################
##                            CONFIGURATION                              ##
###########################################################################
 
# The URL to the Corrade HTTP server.
$CURL = 'http://192.168.1.1:8080/'
 
# The configured Corrade group to send the command as.
$Group = '[Wizardry and Steamworks]:Support'
 
# The configured Corrade group password.
$Password = 'my password'
 
# A list of groups to send the notice to.
$Groups = @('[Wizardry and Steamworks]:Support', '[Wizardry and Steamworks]:Corrade')
 
###########################################################################
##                              INTERNALS                                ##
###########################################################################
 
# https://mohitgoyal.co/2017/04/16/read-multi-line-input-from-users-in-powershell/
function Read-MultiLineInputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
{
    Add-Type -AssemblyName System.Drawing
    Add-Type -AssemblyName System.Windows.Forms
 
    # Create the Label.
    $label = New-Object System.Windows.Forms.Label
    $label.Location = New-Object System.Drawing.Size(10,10) 
    $label.Size = New-Object System.Drawing.Size(280,20)
    $label.AutoSize = $true
    $label.Text = $Message
 
    # Create the TextBox used to capture the user's text.
    $textBox = New-Object System.Windows.Forms.TextBox 
    $textBox.Location = New-Object System.Drawing.Size(10,40) 
    $textBox.Size = New-Object System.Drawing.Size(575,200)
    $textBox.AcceptsReturn = $true
    $textBox.AcceptsTab = $false
    $textBox.Multiline = $true
    $textBox.ScrollBars = 'Both'
    $textBox.Text = $DefaultText
 
    # Create the OK button.
    $okButton = New-Object System.Windows.Forms.Button
    $okButton.Location = New-Object System.Drawing.Size(415,250)
    $okButton.Size = New-Object System.Drawing.Size(75,25)
    $okButton.Text = "OK"
    $okButton.Add_Click({ $form.Tag = $textBox.Text; $form.Close() })
 
    # Create the Cancel button.
    $cancelButton = New-Object System.Windows.Forms.Button
    $cancelButton.Location = New-Object System.Drawing.Size(510,250)
    $cancelButton.Size = New-Object System.Drawing.Size(75,25)
    $cancelButton.Text = "Cancel"
    $cancelButton.Add_Click({ $form.Tag = $null; $form.Close() })
 
    # Create the form.
    $form = New-Object System.Windows.Forms.Form 
    $form.Text = $WindowTitle
    $form.Size = New-Object System.Drawing.Size(610,320)
    $form.FormBorderStyle = 'FixedSingle'
    $form.StartPosition = "CenterScreen"
    $form.AutoSizeMode = 'GrowAndShrink'
    $form.Topmost = $True
    $form.AcceptButton = $okButton
    $form.CancelButton = $cancelButton
    $form.ShowInTaskbar = $true
 
    # Add all of the controls to the form.
    $form.Controls.Add($label)
    $form.Controls.Add($textBox)
    $form.Controls.Add($okButton)
    $form.Controls.Add($cancelButton)
 
    # Initialize and show the form.
    $form.Add_Shown({$form.Activate()})
    $form.ShowDialog() > $null   # Trash the text of the button that was clicked.
 
    # Return the text that the user entered.
    return $form.Tag
}
 
Add-Type -AssemblyName System.Web
 
$Subject = Read-MultiLineInputBoxDialog -Message "The notice subject" -WindowTitle "Subject" -DefaultText "Enter some text here..."
$Message = Read-MultiLineInputBoxDialog -Message "The notice message" -WindowTitle "Message" -DefaultText "Enter some text here..."
 
$Group = [System.Web.HttpUtility]::UrlEncode($Group)
$Password = [System.Web.HttpUtility]::UrlEncode($Password)
$Subject = [System.Web.HttpUtility]::UrlEncode($Subject)
$Message = [System.Web.HttpUtility]::UrlEncode($Message)
 
if([string]::IsNullOrEmpty($Group) -or [string]::IsNullOrEmpty($Password) -or [string]::IsNullOrEmpty($Subject) -or [string]::IsNullOrEmpty($Message)) {
    return
}
 
foreach($targetGroup in $Groups) {
    $targetGroup = [System.Web.HttpUtility]::UrlEncode($targetGroup)
    $Params = ("command=notice&action=send" + "&group=" + $Group + "&password=" + $Password + "&subject=" + $Subject + "&message=" + $Message + "&target=" + $targetGroup)
 
    $Body = [byte[]][char[]]$Params
    $Request = [System.Net.HttpWebRequest]::Create($CURL)
    $Request.Method = 'POST'
    $Request.ContentType = 'application/x-www-form-urlencoded'
    $Request.Accept = "application/x-www-form-urlencoded"
    $Stream = $Request.GetRequestStream()
    $Stream.Write($Body, 0, $Body.Length)
    $Stream.Flush()
    $Stream.Close()
 
    $Response = $Request.GetResponse()
    $Stream = $Response.GetResponseStream()
    $StreamReader = [System.IO.StreamReader]($Stream)
 
    Switch([int]$Response.StatusCode) {
        200 { 
            Write-Host ('Sent notice to group ' + $targetGroup)
            Break
        }
        default { 
            Write-Host ('Failed to send notice to group ' + $targetGroup) 
        }
    }
 
    $Content = $StreamReader.ReadToEnd()
 
    $StreamReader.Close()
    $Response.Close()
 
}

secondlife/scripted_agents/corrade/api/commands/notice.txt · Last modified: 2021/10/29 06:01 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy, copyright and the plagiarism pages.