xb95 (xb95) wrote in lj_dev,

ljprotocol.pl patch -- getfriendposts client protocol addition

Hey everybody!

I've spent the day working on a patch to extend the client functionality another big step. Notably, the below patch enables clients to access the getfriendposts mode which returns, basically, the events on your friends page. It fully supports specifying how many items to return and if you want to skip items or not. Most of the code is pulled from ljviews.pl's friends view generator, so it has the same sort of checks and balances to make sure they're not pulling everything that's ever happened on the friends page. Maximum items returns is 50. There are also options to enable you to skip returning the text of the events and the logprops, individually configurable.

Mode parameters:
userusername to view from
password/hpasswordpassword or MD5 hashed password
showitemsitems to return
itemskipnumber of items to skip
getprops1==return logprops, 0==don't
gettext1==return text, 0==don't

Return values are like this:

errmsgerror message of success==FAIL
event_countnumber of events returned
skipnumber of events skipped
event_X_subjectsubject of event #X
event_X_texttext of event #X if gettext==1
event_X_datetimestamp of event
event_X_posterthe actual person who posted this event
event_X_friendthe journal the event was posted in (community name)
event_X_itemid[j]itemid of this event
event_X_replycountnumber of comments on this entry
event_X_prop_countnumber of properties on this event
event_X_prop_Y_namename of property
event_X_prop_Y_datacontents of property

Ahh! Lots of data, eh? Okay. This has been tested on my local server and is currently running there if anyone wants to play with it. I've tested it with communities and secured entries. I've tested the skip mechanism and specifying the number of items to return. It should work with clustering because the functions it calls are cluster-aware functions.

Comments? Questions? Suggestions? Y'know where to reach me.

Click here for the patch itself.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded