LJCheckFriendsSession



Abstract

Represents a session which checks for updates to a friends page.

Discussion

The LiveJournal protocol has a mode which allows the client to check if any new posts have appeared on a user's friends page. The LJKit implements this using a background thread, managed by an LJCheckFriendsSession object. To implement friends page checking in your client, you need only create an instance of this class, register your class to receive LJFriendsPageUpdatedNotification and then send startChecking to the session object.

Methods

account

- (LJAccount *)account; 

Returns the account this session is associated with.


checkGroupArray

- (NSArray *)checkGroupArray; 

Returns an array containing the groups included in checking. If an empty array is returned, all friends are being checked.


checkGroupMask

- (unsigned int)checkGroupMask; 

Returns the bitmask which defines the groups to be checked.


checkGroupSet

- (NSSet *)checkGroupSet; 

Returns a set containing the groups included in checking. If an empty set is returned, all friends are being checked.


initWithAccount:

- (id)initWithAccount:(LJAccount *)account; 

Initializes the receiver to check the friends page for the given account.


interval

- (NSTimeInterval)interval; 

Returns the number of seconds between checks.


isChecking

- (BOOL)isChecking; 

Returns YES if the friends page checking thread is checking or waiting for to make its next check, NO otherwise.


openFriendsPage

- (BOOL)openFriendsPage; 

This is a convenience method to open the user's friends page. If this session is checking certain groups, then ?filter={groupmask} will be appended to the URL.


setCheckGroupArray:

- (void)setCheckGroupArray:(NSArray *)groupArray; 

Sets the groups to be checked. If groupArray is nil, all friends will be checked.


setCheckGroupMask:

- (void)setCheckGroupMask:(unsigned int)mask; 

Sets the bitmask which defines the groups to be checked. This value is not checked against the actual groups defined for the account.


setCheckGroupSet:

- (void)setCheckGroupSet:(NSSet *)groupSet; 

Sets the groups to be checked. If groupSet is nil, all friends will be checked.


setChecking:forGroup:

- (void)setChecking:(BOOL)check forGroup:(LJGroup *)group; 

Includes or excludes a group from checking.


setInterval:

- (void)setInterval:(NSTimeInterval)interval; 

Sets the number of seconds between checks. If the interval is too short, the server will instruct the client to change the interval.


startChecking

- (void)startChecking; 

This method detaches a background thread which will poll the server, checking for updates on the predefined interval. If an update occurs, checking is stopped and LJFriendsPageUpdatedNotification is posted. If the interval is changed by the server, checking continues and LJCheckFriendsIntervalChanged- Notification is posted. If an error occurs, checking is stopped and LJCheck- FriendsErrorNotification is posted.


stopChecking

- (void)stopChecking; 

Stops checking. No notifications are posted.


(Last Updated 2/17/2003)