From: <be...@us...> - 2004-03-13 08:49:31
|
Update of /cvsroot/ljkit/LJKit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv939 Modified Files: LJEntry.h LJEntry.m LJEntryRoot.h LJEntryRoot.m Log Message: Added convenience accessors for the account an entry is associated with. These methods just call journal or setJournal: as appropriate. Index: LJEntry.h =================================================================== RCS file: /cvsroot/ljkit/LJKit/LJEntry.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LJEntry.h 10 Jan 2004 08:37:14 -0000 1.2 --- LJEntry.h 13 Mar 2004 08:40:46 -0000 1.3 *************** *** 19,22 **** --- 19,25 ---- You may contact the author via email at be...@li.... */ + /* + 2004-03-13 [BPR] Added setAccount: + */ #import <Foundation/Foundation.h> *************** *** 90,94 **** @discussion Sets the journal this entry is associated with. To cause the receiver to become ! unassociated, call set journal to nil. An exception is raised if you attempt to change the journal of a posted entry. --- 93,97 ---- @discussion Sets the journal this entry is associated with. To cause the receiver to become ! unassociated, set journal to nil. An exception is raised if you attempt to change the journal of a posted entry. *************** *** 101,104 **** --- 104,122 ---- /*! + @method setAccount: + @abstract Set the account to associate the receiver with. + @discussion + Sets the account this entry is associated with. To cause the receiver to become + unassociated, set the account to nil. An exception is raised if you attempt to + change the account of a posted entry. + + If through this method you cause the receiver to become associated with an + different account than before, and the security mode is LJGroupModeSecurity, + the set of allowed groups will be cleared, as groups have no meaning outside + of the account they exist in. + */ + - (void)setAccount:(LJAccount *)account; + + /*! @method setDate: @abstract Set the date of the receiver. Index: LJEntry.m =================================================================== RCS file: /cvsroot/ljkit/LJKit/LJEntry.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LJEntry.m 10 Jan 2004 08:37:14 -0000 1.2 --- LJEntry.m 13 Mar 2004 08:40:46 -0000 1.3 *************** *** 19,22 **** --- 19,25 ---- You may contact the author via email at be...@li.... */ + /* + 2004-03-13 [BPR] Added setAccount: + */ #import "LJEntry_Private.h" *************** *** 136,139 **** --- 139,149 ---- } + - (void)setAccount:(LJAccount *)account + { + if ([_journal account] != account) { + [self setJournal:[account defaultJournal]]; + } + } + - (void)setDate:(NSDate *)date { Index: LJEntryRoot.h =================================================================== RCS file: /cvsroot/ljkit/LJKit/LJEntryRoot.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LJEntryRoot.h 10 Jan 2004 08:38:14 -0000 1.2 --- LJEntryRoot.h 13 Mar 2004 08:40:46 -0000 1.3 *************** *** 19,22 **** --- 19,29 ---- You may contact the author via email at be...@li.... */ + /* + 2004-02-24 [BPR] Fixed a typo in the comments. Changed + groupsAllowedAccessArray/Set to return nil instead of raising + an exception. + 2004-03-13 [BPR] Added account method. + + */ #import <Foundation/Foundation.h> *************** *** 124,127 **** --- 131,143 ---- /*! + @method account + @abstract Obtain the account associated with the receiver. + @discussion + Returns the account that the receiver is associated with, or nil if it is + unassociated. + */ + - (LJAccount *)account; + + /*! @method posterUsername @abstract Obtain the username of the entry's poster. *************** *** 172,180 **** /*! ! @method groupsAllowdAccessMask @discussion Returns the bitmask which defines the groups allowed to access the receiver. ! If the security mode is not LJGroupSecurityMode, this value will make no ! sense. */ - (unsigned int)groupsAllowedAccessMask; --- 188,195 ---- /*! ! @method groupsAllowedAccessMask @discussion Returns the bitmask which defines the groups allowed to access the receiver. ! If the security mode is not LJGroupSecurityMode, the value is undefined. */ - (unsigned int)groupsAllowedAccessMask; *************** *** 184,191 **** @abstract Determine what groups are allowed access to the receiver. @discussion ! You cannot use this and other group security related methods on unassociated ! entries. If you try, an exception will be raised. This is because groups have no meaning outside of their account, and unassociated entries are not attached to an account. @result An NSArray of LJGroup objects. */ --- 199,206 ---- @abstract Determine what groups are allowed access to the receiver. @discussion ! If the entry is not associated with a journal, returns nil. Groups have no meaning outside of their account, and unassociated entries are not attached to an account. + If the entry is associated but no groups are allowed access, returns an empty array. @result An NSArray of LJGroup objects. */ *************** *** 196,203 **** @abstract Determine what groups are allowed access to the receiver. @discussion ! You cannot use this and other group security related methods on unassociated ! entries. If you try, an exception will be raised. This is because groups have no meaning outside of their account, and unassociated entries are not attached to an account. @result An NSSet of LJGroup objects. */ --- 211,218 ---- @abstract Determine what groups are allowed access to the receiver. @discussion ! If the entry is not associated with a journal, returns nil. Groups have no meaning outside of their account, and unassociated entries are not attached to an account. + If the entry is associated but no groups are allowed access, returns an empty set. @result An NSSet of LJGroup objects. */ Index: LJEntryRoot.m =================================================================== RCS file: /cvsroot/ljkit/LJKit/LJEntryRoot.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LJEntryRoot.m 10 Jan 2004 08:38:14 -0000 1.2 --- LJEntryRoot.m 13 Mar 2004 08:40:46 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- /* 2004-01-06 [BPR] Removed calls to ImmutablizeObject() + 2004-03-13 [BPR] Added account method. */ *************** *** 149,152 **** --- 150,158 ---- } + - (LJAccount *)account + { + return [_journal account]; + } + - (NSString *)posterUsername { *************** *** 189,193 **** - (NSArray *)groupsAllowedAccessArray { ! NSAssert(_journal != nil, @"Cannot use group security methods with unassociated entries."); if (_security == LJPublicSecurityMode || _security == LJFriendSecurityMode) return [[_journal account] groupArray]; --- 195,200 ---- - (NSArray *)groupsAllowedAccessArray { ! //NSAssert(_journal != nil, @"Cannot use group security methods with unassociated entries."); ! if (_journal == nil) return nil; if (_security == LJPublicSecurityMode || _security == LJFriendSecurityMode) return [[_journal account] groupArray]; |