svnno****@sourc*****
svnno****@sourc*****
2008年 2月 3日 (日) 00:28:31 JST
Revision: 349 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=349 Author: flyson Date: 2008-02-03 00:28:31 +0900 (Sun, 03 Feb 2008) Log Message: ----------- b2rStorageService.deleteThreadData() ã« DAT ãã¡ã¤ã«ãåé¤ãããªãã·ã§ã³ã追å Modified Paths: -------------- trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js trunk/bbs2chreader/chrome/content/bbs2chreader/board/subscribe.js trunk/bbs2chreader/chrome/content/bbs2chreader/components/b2rStorageThread.js trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js trunk/bbs2chreader/chrome/content/bbs2chreader/statusbar.xml trunk/bbs2chreader/components/b2rIStorageService.xpt trunk/bbs2chreader/components/b2rStorageService.js trunk/bbs2chreader/components/idl/b2rIStorageService.idl -------------- next part -------------- Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js 2008-02-02 15:28:31 UTC (rev 349) @@ -374,14 +374,7 @@ for(var i=0; i<indices.length; i++){ var datID = gBoardItems.items[indices[i]].datID; - // ãã°ãã£ã¬ã¯ããªå ã® .dat ãã¡ã¤ã« - var datFile = gBbs2chService.getLogFileAtURL(gBoardItems.url.resolve(datID + ".dat")); - try{ - b2rStorageService.deleteThreadData(gBoardItems.url, datID); - if(datFile.exists()) datFile.remove(false); - }catch(ex){ - Components.utils.reportError(ex); - } + b2rStorageService.deleteThreadData(gBoardItems.url, datID, true); } initTreeSubject(); } Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/board/subscribe.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/board/subscribe.js 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/board/subscribe.js 2008-02-02 15:28:31 UTC (rev 349) @@ -489,14 +489,7 @@ var datID = gDatasource.GetTarget(itemRes, gRDFS.GetResource(B2R_NS + "datID"), true) .QueryInterface(Ci.nsIRDFLiteral).Value; - // ãã°ãã£ã¬ã¯ããªå ã® .dat ãã¡ã¤ã« - var datFile = gBbs2chService.getLogFileAtURL(boardItems.url.resolve(datID + ".dat")); - try{ - b2rStorageService.deleteThreadData(boardItems.url, datID); - if(datFile.exists()) datFile.remove(false); - }catch(ex){ - Components.utils.reportError(ex); - } + b2rStorageService.deleteThreadData(boardItems.url, datID, true); setTimeout(removeTreeItem, 0, parentRes, itemRes, index); } Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/components/b2rStorageThread.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/components/b2rStorageThread.js 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/components/b2rStorageThread.js 2008-02-02 15:28:31 UTC (rev 349) @@ -171,7 +171,7 @@ return result; }, - deleteThreadData: function(aBoardURL, aDatID){ + deleteThreadData: function(aBoardURL, aDatID, aRemoveDatFile){ var b2rService = XPC.getService("@bbs2ch.sourceforge.jp/b2r-global-service;1", "b2rIGlobalService"); var boardID = b2rService.threadUtils.getBoardID(aBoardURL); var statement = this._statements["deleteThreadData_delete"]; @@ -179,13 +179,23 @@ statement.bindStringParameter(1, aDatID); gStorageService.database.beginTransaction(); try{ - statement.executeStep(); - statement.reset(); + statement.execute(); }catch(ex){ Components.utils.reportError(ex); }finally{ gStorageService.database.commitTransaction(); } + + if(aRemoveDatFile){ + // OfBNgàÌ .dat t@C + var datFile = b2rService.io.getLogFileAtURL(aBoardURL.resolve(aDatID + ".dat")); + try{ + if(datFile.exists()) datFile.remove(false); + }catch(ex){ + Components.utils.reportError(ex); + } + } + } }; Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2008-02-02 15:28:31 UTC (rev 349) @@ -1018,7 +1018,7 @@ this.remove(); } if(!this.datFile.exists() && threadData){ - b2rStorageService.deleteThreadData(this.boardURL, this.id); + b2rStorageService.deleteThreadData(this.boardURL, this.id, false); threadData = null; } Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/statusbar.xml =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/statusbar.xml 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/statusbar.xml 2008-02-02 15:28:31 UTC (rev 349) @@ -169,13 +169,8 @@ var b2rStorageService = Components.classes["@bbs2ch.sourceforge.jp/b2r-storage-service;1"] .getService(Components.interfaces.b2rIStorageService); var boardURL = b2rService.threadUtils.getBoardURL(currentThreadURL); - var datFile = b2rService.io.getLogFileAtURL(boardURL.resolve(datID + ".dat")); - try{ - b2rStorageService.deleteThreadData(boardURL, datID); - if(datFile.exists()) datFile.remove(false); - }catch(ex){ - Components.utils.reportError(ex); - } + + b2rStorageService.deleteThreadData(boardURL, datID, true); ]]></body> </method> Modified: trunk/bbs2chreader/components/b2rIStorageService.xpt =================================================================== (Binary files differ) Modified: trunk/bbs2chreader/components/b2rStorageService.js =================================================================== --- trunk/bbs2chreader/components/b2rStorageService.js 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/components/b2rStorageService.js 2008-02-02 15:28:31 UTC (rev 349) @@ -74,8 +74,8 @@ getThreadData: function(aBoardURL, aDatID){ return this._thread.getThreadData(aBoardURL, aDatID); }, - deleteThreadData: function(aBoardURL, aDatID){ - this._thread.deleteThreadData(aBoardURL, aDatID); + deleteThreadData: function(aBoardURL, aDatID, aRemoveDatFile){ + this._thread.deleteThreadData(aBoardURL, aDatID, aRemoveDatFile); }, boardSubjectUpdate: function(aBoardURL, aBoardType, aSubjectFile){ @@ -121,7 +121,7 @@ _getNormarizedString: function(aString){ - var unicodeNormalizer = Cc["@mozilla.org/intl/unicodenormalizer;1"].createInstance(Ci.nsIUnicodeNormalizer); + var unicodeNormalizer = XPC.createInstance("@mozilla.org/intl/unicodenormalizer;1", "nsIUnicodeNormalizer"); var normalizedStr = {}; unicodeNormalizer.NormalizeUnicodeNFKC(aString.toLowerCase(), normalizedStr); return this._html2Text(normalizedStr.value); Modified: trunk/bbs2chreader/components/idl/b2rIStorageService.idl =================================================================== --- trunk/bbs2chreader/components/idl/b2rIStorageService.idl 2008-02-02 15:08:23 UTC (rev 348) +++ trunk/bbs2chreader/components/idl/b2rIStorageService.idl 2008-02-02 15:28:31 UTC (rev 349) @@ -50,7 +50,7 @@ b2rIThreadData getThreadData(in nsIURL aBoardURL, in string aDatID); - void deleteThreadData(in nsIURL aBoardURL, in string aDatID); + void deleteThreadData(in nsIURL aBoardURL, in string aDatID, in boolean aRemoveDatFile); void boardSubjectUpdate(in nsIURL aBoardURL, in unsigned long aBoardType, in nsIFile aSubjectFile);