svnno****@sourc*****
svnno****@sourc*****
2007年 7月 22日 (日) 02:54:38 JST
Revision: 168 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=168 Author: flyson Date: 2007-07-22 02:54:38 +0900 (Sun, 22 Jul 2007) Log Message: ----------- 独自履歴をシンプルにした Modified Paths: -------------- trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js trunk/bbs2chreader/components/idl/nsIBbs2chService.idl trunk/bbs2chreader/components/nsBbs2chService.js trunk/bbs2chreader/components/nsIBbs2chService.xpt Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js 2007-07-21 16:32:24 UTC (rev 167) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/board/page.js 2007-07-21 17:54:38 UTC (rev 168) @@ -204,7 +204,7 @@ document.getElementById("lblTitle").setAttribute("value", gBoardItems.title); if(gFirstInitTreeSubject){ - gBbs2chService.visitBoardPage(gBoardItems.url, gBoardItems.title); + gBbs2chService.visitPage(gBoardItems.url, gBoardItems.title, 0); gFirstInitTreeSubject = false; } Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2007-07-21 16:32:24 UTC (rev 167) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2007-07-21 17:54:38 UTC (rev 168) @@ -254,7 +254,7 @@ close: function(){ if(this._headerResponded && this.dat){ var title = this._bbs2chService.fromSJIS(this.dat.title); - this._bbs2chService.visitThreadPage(this.dat.boardURL, this.dat.id, title); + this._bbs2chService.visitPage(this.dat.threadPlainURL, title, 1); } this._opend = false; this._httpChannel = null; Modified: trunk/bbs2chreader/components/idl/nsIBbs2chService.idl =================================================================== --- trunk/bbs2chreader/components/idl/nsIBbs2chService.idl 2007-07-21 16:32:24 UTC (rev 167) +++ trunk/bbs2chreader/components/idl/nsIBbs2chService.idl 2007-07-21 17:54:38 UTC (rev 168) @@ -236,6 +236,5 @@ */ void maruAuth(); - boolean visitBoardPage(in nsIURL aBoardURL, in AString aTitle); - boolean visitThreadPage(in nsIURL aBoardURL, in ACString aDatID, in AString aTitle); + boolean visitPage(in nsIURL aBoardURL, in AString aTitle, in unsigned long aType); }; Modified: trunk/bbs2chreader/components/nsBbs2chService.js =================================================================== --- trunk/bbs2chreader/components/nsBbs2chService.js 2007-07-21 16:32:24 UTC (rev 167) +++ trunk/bbs2chreader/components/nsBbs2chService.js 2007-07-21 17:54:38 UTC (rev 168) @@ -60,105 +60,56 @@ this._historyDB.beginTransaction(); try{ - if(!this._historyDB.tableExists("board_history")){ + if(!this._historyDB.tableExists("history")){ var sql = <><![CDATA[ - CREATE TABLE board_history( + CREATE TABLE history( id INTEGER PRIMARY KEY, url TEXT NOT NULL, title NOT NULL, - last_visited INTEGER DEFAULT 0, - visit_count INTEGER DEFAULT 1 + last_visited INTEGER NOT NULL DEFAULT 0, + visit_count INTEGER NOT NULL DEFAULT 1, + type INTEGER NOT NULL DEFAULT 0 ); ]]></>.toString(); this._historyDB.executeSimpleSQL(sql); } - if(!this._historyDB.tableExists("thread_history")){ - var sql = <><![CDATA[ - CREATE TABLE thread_history( - id INTEGER PRIMARY KEY, - board_url TEXT NOT NULL, - dat_id TEXT NOT NULL, - title NOT NULL, - last_visited INTEGER DEFAULT 0, - visit_count INTEGER DEFAULT 1 - ); - ]]></>.toString(); - this._historyDB.executeSimpleSQL(sql); - } // 最終訪問日が30以前のデータを削除 // XXX 設定で日付を指定できるようにする - var sql = "DELETE FROM board_history WHERE last_visited < strftime('%s', 'now', '-30 day')"; + var sql = "DELETE FROM history WHERE last_visited < strftime('%s', 'now', '-30 day')"; this._historyDB.executeSimpleSQL(sql); - sql = "DELETE FROM thread_history WHERE last_visited < strftime('%s', 'now', '-30 day')"; - this._historyDB.executeSimpleSQL(sql); }finally{ this.historyDB.commitTransaction(); } }, - visitBoardPage: function(aBoardURL, aTitle){ - var boardID = null; + visitPage: function(aURL, aTitle, aType){ + var pageID = null; this.historyDB.beginTransaction(); try{ - var sql = "SELECT id FROM board_history WHERE url=?1"; + var sql = "SELECT id FROM history WHERE url=?1"; var statement = this.historyDB.createStatement(sql); - statement.bindStringParameter(0, aBoardURL.spec); + statement.bindStringParameter(0, aURL.spec); if(statement.executeStep()){ - boardID = statement.getInt32(0); + pageID = statement.getInt32(0); } statement.reset(); - if(boardID){ - sql = "UPDATE board_history SET title=?1, visit_count=visit_count+1, last_visited=?2 WHERE id=?3;"; + if(pageID){ + sql = "UPDATE history SET title=?1, visit_count=visit_count+1, last_visited=?2 WHERE id=?3;"; statement = this.historyDB.createStatement(sql); statement.bindStringParameter(0, aTitle); statement.bindInt32Parameter(1, Date.now() / 1000); - statement.bindInt32Parameter(2, boardID); + statement.bindInt32Parameter(2, pageID); statement.execute(); }else{ - sql = "INSERT INTO board_history(url, title, last_visited) VALUES(?1, ?2, ?3);"; + sql = "INSERT INTO history(url, title, type, last_visited) VALUES(?1, ?2, ?3, ?4);"; statement = this.historyDB.createStatement(sql); - statement.bindStringParameter(0, aBoardURL.spec); + statement.bindStringParameter(0, aURL.spec); statement.bindStringParameter(1, aTitle); - statement.bindInt32Parameter(2, Date.now() / 1000); - statement.execute(); - } - }finally{ - this.historyDB.commitTransaction(); - } - return true; - }, - - visitThreadPage: function(aBoardURL, aDatID, aTitle){ - var threadID = null; - - this.historyDB.beginTransaction(); - try{ - var sql = "SELECT id FROM thread_history WHERE board_url=?1 AND dat_id=?2;"; - var statement = this.historyDB.createStatement(sql); - statement.bindStringParameter(0, aBoardURL.spec); - statement.bindStringParameter(1, aDatID); - if(statement.executeStep()){ - threadID = statement.getInt32(0); - } - statement.reset(); - - if(threadID){ - sql = "UPDATE thread_history SET title=?1, visit_count=visit_count+1, last_visited=?2 WHERE id=?3;"; - statement = this.historyDB.createStatement(sql); - statement.bindStringParameter(0, aTitle); - statement.bindInt32Parameter(1, Date.now() / 1000); - statement.bindInt32Parameter(2, threadID); - statement.execute(); - }else{ - sql = "INSERT INTO thread_history(board_url, dat_id, title, last_visited) VALUES(?1, ?2, ?3, ?4);"; - statement = this.historyDB.createStatement(sql); - statement.bindStringParameter(0, aBoardURL.spec); - statement.bindStringParameter(1, aDatID); - statement.bindStringParameter(2, aTitle); + statement.bindInt32Parameter(2, aType); statement.bindInt32Parameter(3, Date.now() / 1000); statement.execute(); } @@ -784,12 +735,9 @@ os.notifyObservers(null, "b2r-2ch-viewer-auth", "NG"); }, - visitBoardPage: function(aBoardURL, aTitle){ - return this._globalHistory.visitBoardPage(aBoardURL, aTitle); - }, - visitThreadPage: function(aBoardURL, aDatID, aTitle){ - return this._globalHistory.visitThreadPage(aBoardURL, aDatID, aTitle); + visitPage: function(aURL, aTitle, aType){ + return this._globalHistory.visitPage(aURL, aTitle, aType); }, Modified: trunk/bbs2chreader/components/nsIBbs2chService.xpt =================================================================== (Binary files differ)