commit 53e0227a4363067f2b13b37671e0b63a9ebe15a6
parent feec177edf0790cfaa04ce7f2d1a257baaf7ae3e
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Fri, 31 Jul 2015 22:31:50 +0200
Alter addEntry.
if extra_check_id now is no extra check anymore, but a single check to
determine wether the entry is already in the list.
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drss/rss.d b/drss/rss.d
@@ -35,7 +35,7 @@ abstract class DRSS(T=Entry){
private string lastUpdated;
SList!(T) entries;
uint new_entries=0;
- abstract static bool extra_id_check=false;
+ abstract static bool date_is_reliable=true;
immutable string url;
abstract static uint max_entries=100;
@@ -46,19 +46,16 @@ abstract class DRSS(T=Entry){
}
bool addEntry(Entry newent){
- if(entries.empty || newent>entries.front){
- if(extra_id_check){
- if(canFind!("a.id==b.id")(entries[], newent)){
- return false;
- }
- }
+ if(entries.empty
+ || (!date_is_reliable && !canFind!("a.id==b.id")(entries[], newent))
+ || (date_is_reliable && newent>entries.front) ){
entries.insertFront(newent);
new_entries++;
+ return true;
}
else{
return false;
}
- return true;
}
final void update(){