||[Aug. 2nd, 2004|06:59 pm]
LiveJournal Client Discussions
I am currently fiddling with the xmlrpc client protocol for php... but this main question is centered on the xmlrpc part and has nothing to do with the php...
I am trying to figure out how to use the allowmask so that it actually tells me something interesting...
for example I am getting a result of 6 for the security of a certain post... Now from what I understand I need to get the 32 bit binary representation of that... but once I have that (a simple math operation right?) where do I go from there?... I searched on google, but all I could find were links to pages that were dealing with code from perl scripts that had allowmask in their comments somewhere, but that either did not apply to my problem, or were so confusing that I could not tell that they did...
I assume somehow, looking at the bitmask will give you a list of user id's who have access to the post, but I don't see where to go...
Sorry for the noobish questions... (I see that most of you have projects well beyond this stage) and Thanks.
2004-08-02 04:25 pm (UTC)
This will be my first and last request--please don't change the font of your posts. That HTML goes onto other people's friends pages and you can mess them up and cause adverse affects.
If you want your journal to show in Comic Sans MS, set your journal to show up in that style. Don't force the rest of the world to deal with your (rather poor, IMHO) choice of font. :)
Anyway, to answer your question, the allowmask is a list of bits from the friend groups you have defined. To find out who has access to a post, you need to download all of their friend groups and their friends and then cross-reference all of this information.
2004-08-02 04:27 pm (UTC)
I hit post too soon, oops.
So let's say you get a list of friend groups--those groups will have with them their id. So let's say you have this info:
Group id: 3
Group name: Foo Group!
Group id: 5
Group name: Bar Group!
Then let's say you download a post and you notice that the allowmask on that post is 8. That tells you it is part of the "Foo Group!" Another post has 32--you know it's filtered to "Bar Group!" And another has 40 as the allowmask--that post is filtered to Foo AND Bar Group (both of them).
Kinda make sense?
It is also worth noting that the security level will be "usemask" for both friends-only and custom posts. This from the XMLRPC protocol docs sums it up quite well:
[scalar](required) Specifies who can read this post. Valid values are public (default), private and usemask. When value is usemask, viewability is controlled by the allowmask.
[scalar](required) Relevant when security is usemask. A 32-bit unsigned integer representing which of the user's groups of friends are allowed to view this post. Turn bit 0 on to allow any defined friend to read it. Otherwise, turn bit 1-30 on for every friend group that should be allowed to read it. Bit 31 is reserved.
The only thing I would add to that is to clarify that the bit numbers in the allow mask correspond to the IDs of the friend groups, so if you want to make a post visible to groups with the IDs 1, 4 and 5, you need to set bits 1, 4 and 5 in the allowmask, ie. allowmask = 2^1 + 2^4 + 2^5 = 50.
2004-08-02 09:45 pm (UTC)
eek, oops, ::: Ahh!
ok, This is a reply to both comments...
First, my humble apologies about the font... I posted from my lj.net client, where I have Comic Sans MS set as default font... when i use that I don't see the html font code, and it didn't even cross my mind that it might be a pain for others... In the future I will be certain that I don't have that happen again... though I personally like that font, I know that each person likes the entries in their journal to be displayed with their font, and so I will change my font choices to css style settings in my layout...
Now what you have said is extremely enlightening, I now understand the mention of a limit of 32 user groups, each group is a bit... tah dah...
I had understood the security=usemask... that struck me as a singularly uninformative value to have in a config value, so I quickly found that there was an allowmask= part... (out of curiosity, is allowmask null when a post is public? and what about friends only?)
Now my question is how to fetch the group members, or the groups of which a specific user is a member...
Thanks alot... It was a lightbulb that went on when you explained it... and I realized why it all made sense! :)
Hi there. I see your client is also in PHP. Could you help me out here
? I am having trouble getting started.