On Oct 03, 2008, at 07:58:19, Josh Johnston wrote:
> 1) I can't seem to get the sticky bit to do anything at all. I set  
> it on or off and it is always the same.

See below.

> 2) Even if I switch display themes to on that supports different  
> priorities with different colors, I always get the same notification  
> regardless of priority set.

See below.

If that doesn't work, try enabling logging in Growl. I don't know  
whether it'll work for UDP notifications, but it's worth trying. The  
scripts to enable and disable logging are here:

        
<http://growldiscuss.googlegroups.com/web/Growl-EnableDisableLogging.zip?gda=O4VjeFAAAACkuJNhI4T-Gd7V5Or2COUskw1DWAIJlgKYI_exvUdGERh6YYM6Mtc-xnLgOcLfnSnEycNDTiwM2MugJJwoHwqpbcVT3VtYGKLco-_l-8AzjQ
 
 >

> What I gather from other php code I have inspected is that this is  
> the proper way to combine the flags into the proper byte for  
> priority/sticky:
>
>        flags = (priority & 7) * 2;

That should be a left shift:

        flags = (priority & 7) << 1;

Mathematically the same, but the left shift more clearly expresses  
what's going on.

>        if (priority < 0) {
>            flags = flags | 8;
>        }
>
>        if (sticky) {
>            flags = flags | 1;
>        }

Furthermore, I would change the constant expressions. The resulting  
code is:

        //1 << 3 = binary 01000
        //.  - 1 = binary 00111
        flags = (priority & ((1 << 3) - 1) << 1; //01110

        if (sticky) {
                flags |= (1 << 0); //00001
        }

You'll notice that the if (priority < 0) block is missing. That's  
because it isn't necessary; it will already be set. (If some oddball  
aspect of your machine's architecture means that it isn't, then all  
the bitwise math is for naught anyway. However, all PCs do two's- 
complement, so you probably don't need to worry about it—not yet, at  
least.)

> Am I doing something obviously wrong …?

It looks right, but you should make sure you're sending this flags  
value in network byte order. Otherwise, the bits are in the high byte,  
while Growl is looking for them in the low byte. If your low byte is  
clear (0x00), that's why Growl acts as if you haven't set the flags.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to