diff options
author | 2013-10-30 00:50:34 +0400 | |
---|---|---|
committer | 2013-10-30 00:50:34 +0400 | |
commit | 566f122683240ea47f391033ec4e11ef424e7a5c (patch) | |
tree | fbe00959f88b3a16d2d4768c1cc223781a377160 /Juick/Message.m | |
parent | 7e7b734fc859234c9424b2ed98f5a2afef911de0 (diff) |
Working main feed
Diffstat (limited to 'Juick/Message.m')
-rw-r--r-- | Juick/Message.m | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Juick/Message.m b/Juick/Message.m new file mode 100644 index 0000000..e87834b --- /dev/null +++ b/Juick/Message.m @@ -0,0 +1,30 @@ +// +// Message.m +// Juick +// +// Created by Vitaly Takmazov on 29.10.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "Message.h" + +@implementation Message + +-(id)initWithDictionary:(NSDictionary *)dictionary +{ + Message *result = [[Message alloc] init]; + result.MID = [dictionary objectForKey:@"mid"]; + result.RID = [dictionary objectForKey:@"rid"]; + NSString *text = [[dictionary objectForKey:@"body"] stringByDecodingHTMLEntities]; + NSDictionary *userDict = [dictionary objectForKey:@"user"]; + result.user = [userDict objectForKey:@"uname"]; + NSArray *tagsArray = [dictionary objectForKey:@"tags"]; + if ([tagsArray count] > 0) { + result.text = [[NSString alloc] initWithFormat:@"%@\n%@", [tagsArray componentsJoinedByString:@", "], text]; + } else { + result.text = text; + } + return result; +} + +@end |