+ (LJAccount *)accountWithIdentifier:(NSString *)identifier;
The LJAccount class keeps track of all active account objects. Using this method, you can obtain a reference to the account object with the given identifier. If no matching account is found, returns nil.
Result: An account reference if found, nil otherwise.
Name Description identifier The identifier for the desired account object.
- (LJFriend *)addFriendWithUsername:(NSString *)username;
+ (NSArray *)allAccounts;
The LJAccount class keeps track of all active account objects. This method returns the list in the form of an NSArray.
- (NSMutableDictionary *)customInfo;
Returns a mutable dictionary object you can use to store whatever
information you would like to attach to this account. All keys and
values must support the NSCoding protocol.
This property is preserved during archiving.
- (LJJournal *)defaultJournal;
A convenience method to return the user's default journal (their own).
This property is preserved during archiving.
- (NSURL *)defaultUserPictureURL;
This property is preserved during archiving.
- (id)delegate;
- (void)downloadFriends;
Downloads the friends associated with the receiver. This method causes any changes made to LJFriend objects locally to be discarded. You can access the LJFriends objects using the friendSet or friendArray messages.
- (void)downloadGroups;
Downloads the friend groups associated with the receiver. This method causes any changes made to LJGroup objects locally to be discarded. You can access the LJGroup objects using the groupSet or groupArray messages.
- (NSArray *)friendArray;
Returns a sorted NSArray containing the user's friends in the form of LJFriend
objects.
This property is preserved during archiving.
- (NSEnumerator *)friendEnumerator;
Returns an NSEnumerator which traverses the user's friends, returning LJFriend objects.
- (LJFriend *)friendNamed:(NSString *)username;
This method searches both the friends and friend-ofs for the account.
- (NSArray *)friendOfArray;
This property is preserved during archiving.
Result: A sorted NSArray of LJFriend objects.- (NSEnumerator *)friendOfEnumerator;
Returns an NSEnumerator which traverses users who list the receiver as a friend, returning LJFriend objects.
- (NSSet *)friendOfSet;
This property is preserved during archiving.
Result: An NSSet of LJFriend objects.- (NSSet *)friendSet;
Returns an NSSet containing the user's friends in the form of LJFriend objects.
This property is preserved during archiving.
- (NSString *)fullname;
Returns the user's long name as reported by the server. If the receiver
has never been logged in, this method will return the username.
This property is preserved during archiving.
- (NSDictionary *)getReplyForMode:(NSString *)mode parameters:(NSDictionary *)parameters;
Sends a message to the LiveJournal server and returns the reply.
This message blocks until the message is sent over the network and
a reply is received.
Most LiveJournal protocol modes are handled by other classes in the
LJKit, so client programs won't need to call this method directly.
If an error occurs, an exception is raised.
Result: A set of variables and values received from the server.
Name Description mode The protocol mode to use. parameters A set of variables and values to send to the server.
- (NSArray *)groupArray;
Returns a sorted NSArray containing the user's friend groups in the form of
LJGroup objects.
This property is preserved during archiving.
- (NSArray *)groupArrayFromMask:(unsigned int)groupMask;
Returns an array of the groups defined by the given bitmask.
- (NSEnumerator *)groupEnumerator;
Returns an NSEnumerator which traverses the user's groups, returning LJGroup objects.
- (unsigned int)groupMaskFromArray:(NSArray *)groupArray;
Returns the bitmask which defines the given array of groups.
- (unsigned int)groupMaskFromSet:(NSSet *)groupSet;
Returns the bitmask which defines the given set of groups.
- (NSSet *)groupSet;
Returns an NSSet containing the user's friend groups in the form of LJGroup
objects.
This property is preserved during archiving.
- (NSSet *)groupSetFromMask:(unsigned int)groupMask;
Returns a set of the groups defined by the given mask.
- (NSString *)identifier;
Returns a unique identifier for the receiver. It is of the form "username@hostname:port".
- (id)initWithContentsOfFile:(NSString *)path;
Initializes an account object using information previously saved to a file. This method uses NSKeyedUnarchiver to read the file.
Name Description path The path to the previously archived account object.
- (id)initWithUsername:(NSString *)username;
Initializes a newly allocated LJAccount. To start communicating with the LiveJournal server you must call the loginWithPassword: method. This is the designated initializer for the class.
Name Description username The user's login name.
Result: YES if the account has successfully logged in, NO otherwise.- (BOOL)isLoggedIn;
Result: A sorted NSArray of LJFriend objects.- (NSArray *)joinedCommunityArray;
Result: An NSSet of LJFriend objects.- (NSSet *)joinedCommunitySet;
- (NSArray *)journalArray;
This method returns an array of LJJournal objects, representing the
journals this account has access to post into (e.g., communities).
It will always return an array with at least one element, the default
journal for this account. The default journal is always at index 0.
This property is preserved during archiving.
- (NSMenu *)journalMenu;
Creates an NSMenu of all journals for the receivers account. Each menu item is set to represent the appropriate LJJournal object, so you may retrieve a journal by sending the representedObject message to any of the menu items.
- (LJJournal *)journalNamed:(NSString *)name;
Searches the user's list of journals and returns one with the given name, or nil if none match.
Result: The desired journal if found, nil otherwise.- (NSString *)loginMessage;
The server may send a message for the user after login. Your client should call this method after loginWithPassword: and if it returns a string, display the string to the user.
Result: The login message, or nil if none was available.- (void)loginWithPassword:(NSString *)password;
Calls loginWithPassword:flags: with LJDefaultLoginFlags.
- (void)loginWithPassword:(NSString *)password flags:(int)loginFlags;
Sends a login message to the server. Use a combination of the login
flags to determine what features you want to download (e.g., moods,
pictures, etc.).
This method causes the password to be stored in the receiver so that
it can be sent to the server on subsequent messages. You must call
this method before any other methods that may communicate with the
server.
The password is encoded as an MD5 hex digest before it is sent to the
server, in order to make it (slightly) more difficult for packet sniffers
to guess your actual password.
This method also sends the client name and version to the server.
The name and version is determined by your main bundle's infoDictionary.
By default, it uses the values of CFBundleName and CFBundleVersion.
If you wish to override one or both of these values, use the keys
LJClientName and LJClientVersion. Finally, if none of these are
set the client is identified as LJKit/1.0.0.
If the username/password combination is incorrect, an exception will
be raised.
Name Description password The user's password. loginFlags A bitwise-OR combination of the login flag constants.
- (NSMenu *)menu;
If you provided the LJGetMenuLoginFlag to the loginWithPassword:flags: method, this method will return an NSMenu object you can display in your application. Otherwise, returns nil. The menu is configured so that selection of any items will direct the system default web browser to the correct web site. Thus, all you need to do is display the menu in your interface.
- (LJMoods *)moods;
If you provided the LJGetMoodsLoginFlag to the loginWithPassword:flags:
method, this method returns an LJMoods object, which represents all the
moods known to the system and maps them to IDs.
Otherwise, returns nil.
This property is preserved during archiving.
- (LJGroup *)newGroupWithName:(NSString *)name;
Use this method if you want to add a new friend group. LiveJournal limits you to a total of 30 groups; if you exceed this limit an exception will be raised.
- (void)removeFriend:(LJFriend *)buddy;
- (void)removeGroup:(LJGroup *)group;
Removes a friend group from the receiver. This method also removes all friends
from the group. If you decide to cancel the operation by calling downloadGroups,
remember to call downloadFriends also.
When you uploadGroups to commit this change, the server updates the groupmask of
previous posts and removes references to the deleted groups. The LJKit does not
attempt to simulate this behavior, as it does not "know" where relevant LJEntry
objects are stored.
- (LJServer *)server;
This property is preserved during archiving.
- (void)setDelegate:(id)delegate;
Sets the delegate of the receiver. The delegate is automatically registered to receive notifications if it implements the methods below.
- (void)setMoods:(LJMoods *)moods;
You can set the moods object before logging in, so that the mood list can be saved between sessions. If so, only new moods will be downloaded from the server, to save on bandwidth.
- (BOOL)uploadFriends;
Uploads the local changes to LJFriend objects to the LiveJournal server. If friends were added, their full names are obtained from the server and saved.
Result: YES if changes were made; NO if there were no changes to upload.- (BOOL)uploadGroups;
Uploads the local changes to LJGroup objects to the LiveJournal server.
Result: YES if changes were made; NO if there were no changes to upload.- (NSDictionary *)userPicturesDictionary;
If you provided the LJGetPicturesLoginFlag to the loginWithPassword:flags:
method, this method will return an NSDictionary mapping userpic keywords
to NSURL objects. Otherwise, returns nil.
This property is preserved during archiving.
- (NSMenu *)userPicturesMenu;
Creates an NSMenu representing the user's picture keywords. Each menu item has the picture's URL as a its represented object, so you can retrieve the NSURL object by calling [menuItem representedObject].
- (NSURL *)userProfileHttpURL;
- (NSString *)username;
This property is preserved during archiving.
Result: A sorted NSArray of LJFriend objects.- (NSArray *)watchedCommunityArray;
Result: An NSSet of LJFriend objects.- (NSSet *)watchedCommunitySet;
- (BOOL)writeToFile:(NSString *)path;
Archives the receiver to a file. This is a convenience method; it uses NSKeyedArchiver to write the file to disk. This can be used by offline clients to save account info.
Result: YES on success; NO otherwise.
Name Description path The path to save the object to.
(Last Updated 2/17/2003)