[Bbs2ch-cvs 45] CVS update: bbs2chreader/content/bbs2chreader

アーカイブの一覧に戻る

flyson flyso****@users*****
2005年 11月 5日 (土) 01:20:01 JST


Index: bbs2chreader/content/bbs2chreader/bbsmenu-ds.js
diff -u bbs2chreader/content/bbs2chreader/bbsmenu-ds.js:1.12 bbs2chreader/content/bbs2chreader/bbsmenu-ds.js:1.13
--- bbs2chreader/content/bbs2chreader/bbsmenu-ds.js:1.12	Sat Oct 22 13:14:14 2005
+++ bbs2chreader/content/bbs2chreader/bbsmenu-ds.js	Sat Nov  5 01:20:01 2005
@@ -74,6 +74,14 @@
 
 
 	/**
+	 * データフォルダ内の bbsmenu.rdf
+	 * @return nsILocalFile
+	 */
+	get bbsMenuRDFFile(){
+		return this._bbsMenuRDFFile;
+	},
+
+	/**
 	 * データフォルダ内の outside.txt
 	 * @return nsILocalFile
 	 */
@@ -88,10 +96,14 @@
 		this._rdf = new Bbs2chRDF();
 
 		this._bbs2chService = Components.classes["@mozilla.org/bbs2ch-service;1"]
-						.getService(Components.interfaces.nsIBbs2chService);
+					.getService(Components.interfaces.nsIBbs2chService);
+		this._ioService = Components.classes["@mozilla.org/network/io-service;1"]
+					.getService(Components.interfaces.nsIIOService);
 
 		this._bbsMenuFile = this._bbs2chService.getDataDir();
 		this._bbsMenuFile.appendRelativePath("bbsmenu.html");
+		this._bbsMenuRDFFile = this._bbs2chService.getDataDir();
+		this._bbsMenuRDFFile.appendRelativePath("bbsmenu.rdf");
 		this._outsideFile = this._bbs2chService.getDataDir();
 		this._outsideFile.appendRelativePath("outside.txt");
 	},
@@ -106,6 +118,17 @@
 			// bbsmenu.html が無いときは終了
 		if(!this.bbsMenuFile.exists()) return;
 
+		if(this.bbsMenuRDFFile.exists() && this.outsideFile.exists()){
+			var rdfLMTime = this.bbsMenuRDFFile.lastModifiedTime;
+			var bbsmenuLMTime = this.bbsMenuFile.lastModifiedTime;
+			var outsideLMTime = this.outsideFile.lastModifiedTime;
+			
+			if((rdfLMTime > bbsmenuLMTime) && (rdfLMTime > outsideLMTime)){
+				var rdfURL = this._ioService.newFileURI(this.bbsMenuRDFFile);
+				this.rdf.initWithRDFURL(rdfURL.spec);
+				return;
+			}
+		}
 
 			// ルートコンテナの作成
 		var rootContainer = this.rdf.makeSeqContainer("urn:bbs2ch:bbsmenu:root");
@@ -173,6 +196,10 @@
 											this._bbs2chService.getBoardType(RegExp.$1));
 			}
 		}
+
+			// RDF をキャッシュとして保存		
+		var rdfSource = this.rdf.getXmlSource("bbs2ch", NS_BBS2CH);
+		this._bbs2chService.writeFile(this.bbsMenuRDFFile.path, rdfSource, false);
 	},
 
 


bbs2ch-cvs メーリングリストの案内
アーカイブの一覧に戻る