On Mon, 22 Aug 2011 16:43:22 -0000, Jonathan Yap wrote:

> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://codereview.secondlife.com/r/449/
> -----------------------------------------------------------
> 
> Review request for Viewer.
> 
> 
> Summary
> -------
> 
> Add a block button to popups from llDialog calls. Clicking on the Block
> button adds the object to the block list.  The type of block is Object.

There is an issue with the way this is implemented: existing scripts
using a "Mute" button in their own menu get this button interpreted
as a viewer-side block action request from the user.
Note that this is also an issue with llDialog()s using "Ignore" as a
button, but the latter has been documented like forever on the LSL
portal, thus not being a real issue, while this new blocking feature
breaks *existing* contents.

The reason why client side buttons and script side llDialog() buttons
get mixed up is that the buttons in the script menus got the same
internal "name" as the "text" they are set for, and since UI dialogs
are all referred by their "name" field in the viewer UI, the first
matching "name" in a list of buttons is used to trigger the
corresponding action (here, block by object UUID for any "Mute"
button in the dialog).

The fix is simple (and also fixes the "Ignore" button issue): you
just have to use a "name" field for the client side buttons ("Ignore"
and "Block") that scripts are unlikely to ever use.

For the Cool VL Viewer (v1.26.0.19 and v1.26.1.6, to be released
this week), I use "client_side_mute" and "client_side_ignore" as
the "Block" and "Ignore" button names in the notification menu
definition (in notifications.xml). For v3, this would read as:

  <notification
   icon="notify.tga"
   name="ScriptDialog"
   type="notify">
[NAME]&apos;s &apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos;
[MESSAGE]
    <form name="form">
      <button
       index="-2"
       name="client_side_mute"
       text="Block"/>
      <button
       index="-1"
       name="client_side_ignore"
       text="Ignore"/>
    </form>
  </notification>

  <notification
   icon="notify.tga"
   name="ScriptDialogGroup"
   type="notify">
    <tag>group</tag>
[GROUPNAME]&apos;s &apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos;
[MESSAGE]
    <form name="form">
      <button
       index="-2"
       name="client_side_mute"
       text="Block"/>
      <button
       index="-1"
       name="client_side_ignore"
       text="Ignore"/>
    </form>
  </notification>

"client_side_mute" and client_side_ignore" are unlikely to be ever used
in llDialog() calls, but you could use even more obscure names if you want.

There is no other code to change for making this work properly, and you can
test it with this simple script:

default {
    state_entry() {
        llListen(-1, "", NULL_KEY, "");
    }

    touch_start(integer total_number) {
        llDialog(llDetectedKey(0), "Test", [ "Ignore", "Mute", "OK" ], -1);
    }

    listen(integer chan, string name, key id, string message) {
        llSetText(message, <1.0, 1.0, 1.0>, 1.0);
    }
}

Henri.
_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Reply via email to