Minor improvements.
1.1 --- a/CollectionUtils.h Sun Apr 06 19:13:27 2008 -0700
1.2 +++ b/CollectionUtils.h Mon Apr 14 13:58:48 2008 -0700
1.3 @@ -29,9 +29,9 @@
1.4
1.5 #define $sprintf(FORMAT, ARGS... ) [NSString stringWithFormat: (FORMAT), ARGS]
1.6
1.7 -#define $cast(CLASSNAME,OBJ) (CLASSNAME*)(_cast([CLASSNAME class],(OBJ)))
1.8 -#define $castNotNil(CLASSNAME,OBJ) (CLASSNAME*)(_castNotNil([CLASSNAME class],(OBJ)))
1.9 -#define $castIf(CLASSNAME,OBJ) (CLASSNAME*)(_castIf([CLASSNAME class],(OBJ)))
1.10 +#define $cast(CLASSNAME,OBJ) ((CLASSNAME*)(_cast([CLASSNAME class],(OBJ))))
1.11 +#define $castNotNil(CLASSNAME,OBJ) ((CLASSNAME*)(_castNotNil([CLASSNAME class],(OBJ))))
1.12 +#define $castIf(CLASSNAME,OBJ) ((CLASSNAME*)(_castIf([CLASSNAME class],(OBJ))))
1.13 #define $castArrayOf(ITEMCLASSNAME,OBJ) _castArrayOf([ITEMCLASSNAME class],(OBJ)))
1.14
1.15 void setObj( id *var, id value );
2.1 --- a/DateUtils.h Sun Apr 06 19:13:27 2008 -0700
2.2 +++ b/DateUtils.h Mon Apr 14 13:58:48 2008 -0700
2.3 @@ -11,9 +11,16 @@
2.4 #ifdef __cplusplus
2.5 extern "C" {
2.6 #endif
2.7 +
2.8 +
2.9 + /** Absolute time (since 'reference date') to NSDate. 0.0 -> nil. */
2.10 + NSDate* $date( CFAbsoluteTime );
2.11 +
2.12 + /** NSDate to absolute time (since 'reference date'). nil -> 0.0 */
2.13 + CFAbsoluteTime $time( NSDate* );
2.14
2.15
2.16 -NSTimeInterval TimeIntervalSinceBoot(void);
2.17 + NSTimeInterval TimeIntervalSinceBoot(void);
2.18
2.19
2.20 #ifdef __cplusplus
3.1 --- a/DateUtils.m Sun Apr 06 19:13:27 2008 -0700
3.2 +++ b/DateUtils.m Mon Apr 14 13:58:48 2008 -0700
3.3 @@ -15,6 +15,22 @@
3.4 #include <unistd.h>
3.5
3.6
3.7 +/** Absolute time (since 'reference date') to NSDate. 0.0 -> nil. */
3.8 +NSDate* $date( CFAbsoluteTime time )
3.9 +{
3.10 + CAssert(time>=0.0 && time < 1.0e15, @"Bogus timestamp %g",time);
3.11 + return time ?[NSDate dateWithTimeIntervalSinceReferenceDate: time] :nil;
3.12 +}
3.13 +
3.14 +
3.15 +/** NSDate to absolute time (since 'reference date'). nil -> 0.0 */
3.16 +CFAbsoluteTime $time( NSDate* date )
3.17 +{
3.18 + return date ?[date timeIntervalSinceReferenceDate] :0.0;
3.19 +}
3.20 +
3.21 +
3.22 +
3.23 NSTimeInterval TimeIntervalSinceBoot(void)
3.24 {
3.25 // From http://developer.apple.com/qa/qa2004/qa1398.html
4.1 --- a/IChatUtils.m Sun Apr 06 19:13:27 2008 -0700
4.2 +++ b/IChatUtils.m Mon Apr 14 13:58:48 2008 -0700
4.3 @@ -36,19 +36,21 @@
4.4 if( chats.count==0 )
4.5 return nil;
4.6 iChatTextChat *chat = [chats objectAtIndex: 0];
4.7 - if( ! chat.active )
4.8 - return nil;
4.9 + /*if( ! chat.active ) // somehow this returns NO for Bonjour chats
4.10 + return nil;*/
4.11 return chat;
4.12 }
4.13
4.14 + (NSString*) activeChatPartner
4.15 {
4.16 iChatTextChat *chat = [self activeChat];
4.17 + Log(@"Active chat = %@",chat);
4.18 if( ! chat )
4.19 return nil;
4.20 NSMutableArray *names = $marray();
4.21 for( iChatBuddy *b in [chat participants] )
4.22 [names addObject: (b.fullName ?: b.name)];
4.23 + Log(@"Particpants = %@",names);
4.24 return [names componentsJoinedByString: @", "];
4.25 }
4.26