Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions Classes/MWFeedParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -926,22 +926,25 @@ - (BOOL)createEnclosureFromAttributes:(NSDictionary *)attributes andAddToItem:(M
// Process ATOM link and determine whether to ignore it, add it as the link element or add as enclosure
// Links can be added to MWObject (info or item)
- (BOOL)processAtomLink:(NSDictionary *)attributes andAddToMWObject:(id)MWObject {
if (attributes && [attributes objectForKey:@"rel"]) {

// Use as link if rel == alternate
if ([[attributes objectForKey:@"rel"] isEqualToString:@"alternate"]) {
[MWObject setLink:[attributes objectForKey:@"href"]]; // Can be added to MWFeedItem or MWFeedInfo
return YES;
}

// Use as enclosure if rel == enclosure
if ([[attributes objectForKey:@"rel"] isEqualToString:@"enclosure"]) {
if ([MWObject isMemberOfClass:[MWFeedItem class]]) { // Enclosures can only be added to MWFeedItem
[self createEnclosureFromAttributes:attributes andAddToItem:(MWFeedItem *)MWObject];
return YES;
}
}

if (attributes){
if([attributes objectForKey:@"rel"]) {

// Use as link if rel == alternate
if ([[attributes objectForKey:@"rel"] isEqualToString:@"alternate"]) {
[MWObject setLink:[attributes objectForKey:@"href"]]; // Can be added to MWFeedItem or MWFeedInfo
return YES;
}

// Use as enclosure if rel == enclosure
if ([[attributes objectForKey:@"rel"] isEqualToString:@"enclosure"]) {
if ([MWObject isMemberOfClass:[MWFeedItem class]]) { // Enclosures can only be added to MWFeedItem
[self createEnclosureFromAttributes:attributes andAddToItem:(MWFeedItem *)MWObject];
return YES;
}
}
} else if ([attributes objectForKey:@"href"]) {
[MWObject setLink:[attributes objectForKey:@"href"]];
}
}
return NO;
}
Expand Down