svnno****@sourc*****
svnno****@sourc*****
2007年 12月 15日 (土) 23:07:15 JST
Revision: 273 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=273 Author: flyson Date: 2007-12-15 23:07:15 +0900 (Sat, 15 Dec 2007) Log Message: ----------- b2rIGlobalService ã¸ã®ç§»è¡ ãã®3 Modified Paths: -------------- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js -------------- next part -------------- Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js =================================================================== --- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2007-12-15 13:42:09 UTC (rev 272) +++ trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js 2007-12-15 14:07:15 UTC (rev 273) @@ -104,8 +104,10 @@ this._bbs2chService = Components.classes["@mozilla.org/bbs2ch-service;1"] .getService(Components.interfaces.nsIBbs2chService); + this._b2rService = Components.classes["@bbs2ch.sourceforge.jp/b2r-global-service;1"] + .getService(Components.interfaces.b2rIGlobalService); this._pref = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); + .getService(Components.interfaces.nsIPrefBranch); this._aboneManager = Components.classes["@mozilla.org/b2r-abone-manager;1"] .getService(Components.interfaces.b2rIAboneManager); @@ -260,9 +262,7 @@ close: function(){ if(this._headerResponded && this.dat){ var title = this._bbs2chService.fromSJIS(this.dat.title); - var gB2rService = Components.classes["@bbs2ch.sourceforge.jp/b2r-global-service;1"] - .getService(Components.interfaces.b2rIGlobalService); - gB2rService.history.visitPage(this.dat.threadPlainURL, title, 1); + this._b2rService.history.visitPage(this.dat.threadPlainURL, title, 1); } this._opend = false; this._httpChannel = null; @@ -401,23 +401,21 @@ datDownload: function(aKako){ if(aKako){ - var b2rService = Components.classes["@bbs2ch.sourceforge.jp/b2r-global-service;1"] - .getService(Components.interfaces.b2rIGlobalService); - if(b2rService.viewer.logined){ + if(this._b2rService.viewer.logined){ var sid = encodeURIComponent(b2rService.viewer.sessionID); var datURLSpec = this.dat.threadPlainURL.spec.replace(/\/read\.cgi\//, "/offlaw.cgi/"); datURLSpec += "?raw=.0&sid=" + sid; var datKakoURL = this._ioService.newURI(datURLSpec, null, null) .QueryInterface(Components.interfaces.nsIURL); - this.httpChannel = this._bbs2chService.getHttpChannel(datKakoURL); + this.httpChannel = this._b2rService.getHttpChannel(datKakoURL); this._maruMode = true; }else{ - this.httpChannel = this._bbs2chService.getHttpChannel(this.dat.datKakoURL); + this.httpChannel = this._b2rService.getHttpChannel(this.dat.datKakoURL); } this._kakoDatDownload = true; }else{ - this.httpChannel = this._bbs2chService.getHttpChannel(this.dat.datURL); + this.httpChannel = this._b2rService.getHttpChannel(this.dat.datURL); this._kakoDatDownload = false; } this.httpChannel.requestMethod = "GET"; @@ -614,7 +612,7 @@ var datURL = this._ioService.newURI(datURLSpec, null, null) .QueryInterface(Components.interfaces.nsIURL); - this.httpChannel = this._bbs2chService.getHttpChannel(datURL); + this.httpChannel = this._b2rService.getHttpChannel(datURL); this.httpChannel.requestMethod = "GET"; this.httpChannel.redirectionLimit = 0; // 302 Ì_CNgðsíÈ¢ this.httpChannel.loadFlags = this.httpChannel.LOAD_BYPASS_CACHE; @@ -775,7 +773,7 @@ var datURL = this._ioService.newURI(datURLSpec, null, null) .QueryInterface(Components.interfaces.nsIURL); - this.httpChannel = this._bbs2chService.getHttpChannel(datURL); + this.httpChannel = this._b2rService.getHttpChannel(datURL); this.httpChannel.requestMethod = "GET"; this.httpChannel.redirectionLimit = 0; // 302 Ì_CNgðsíÈ¢ this.httpChannel.loadFlags = this.httpChannel.LOAD_BYPASS_CACHE; @@ -896,7 +894,7 @@ get threadPlainURL(){ if(!this._threadPlainURL){ - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ + if(this.type == this._b2rService.BOARD_TYPE_MACHI){ this._threadPlainURL = this.datURL; }else{ var threadPlainSpec = this.threadURL.resolve("./"); @@ -913,7 +911,7 @@ get datURL(){ if(!this._datURL){ - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ + if(this.type == this._b2rService.BOARD_TYPE_MACHI){ var datURLSpec = this.threadURL.resolve("./read.cgi"); datURLSpec += "?BBS=" + this.queryHash["BBS"] + "&KEY=" + this.queryHash["KEY"]; this._datURL = this._ioService.newURI(datURLSpec, null, null) @@ -928,7 +926,7 @@ }, get datKakoURL(){ - if(this.type != this._bbs2chService.BOARD_TYPE_2CH){ + if(this.type != this._b2rService.BOARD_TYPE_2CH){ return this.datURL; } @@ -956,7 +954,7 @@ get id(){ if(!this._id){ - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ + if(this.type == this._b2rService.BOARD_TYPE_MACHI){ this._id = this.queryHash["KEY"] || null; }else{ this._id = this.threadURL.directory.match(/\/(\d{9,10})/) ? RegExp.$1 : null; @@ -1009,26 +1007,28 @@ init: function(aThreadURL, aBoardURL, aType){ this._bbs2chService = Components.classes["@mozilla.org/bbs2ch-service;1"] .getService(Components.interfaces.nsIBbs2chService); + this._b2rService = Components.classes["@bbs2ch.sourceforge.jp/b2r-global-service;1"] + .getService(Components.interfaces.b2rIGlobalService); this._ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); this._threadURL = aThreadURL; this._boardURL = (!aBoardURL) ? - this._bbs2chService.getBoardURL(this.threadURL.spec) : aBoardURL; + this._b2rService.threadUtils.getBoardURL(this.threadURL) : aBoardURL; this._type = (isNaN(parseInt(aType))) ? - this._bbs2chService.getBoardType(this.threadURL.spec) : aType; + this._b2rService.threadUtils.getBoardType(this.threadURL) : aType; // ÂÌ^CvªABOARD_TYPE_PAGE ÅàA // URL É /test/read.cgi/ ðÜñÅ¢½ç 2chÝ·ÆÝÈ· - if(this._type == this._bbs2chService.BOARD_TYPE_PAGE && + if(this._type == this._b2rService.BOARD_TYPE_PAGE && this._threadURL.spec.indexOf("/test/read.cgi/") != -1){ - this._type = this._bbs2chService.BOARD_TYPE_2CH; + this._type = this._b2rService.BOARD_TYPE_2CH; } - this._datFile = this._bbs2chService.getLogFileAtURL( + this._datFile = this._b2rService.io.getLogFileAtURL( this.boardURL.resolve(this.id + ".dat")); - this._idxFile = this._bbs2chService.getLogFileAtURL( + this._idxFile = this._b2rService.io.getLogFileAtURL( this.boardURL.resolve(this.id + ".idx")); // DAT ª³ IDX t@CÌݶݷéêÍACª¸êĵܤÌÅ IDX ðÁ· @@ -1161,6 +1161,8 @@ this._bbs2chService = Components.classes["@mozilla.org/bbs2ch-service;1"] .getService(Components.interfaces.nsIBbs2chService); + this._b2rService = Components.classes["@bbs2ch.sourceforge.jp/b2r-global-service;1"] + .getService(Components.interfaces.b2rIGlobalService); this._ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); this._pref = Components.classes["@mozilla.org/preferences-service;1"] @@ -1174,7 +1176,7 @@ var skinName = this._pref.getComplexValue("extensions.bbs2chreader.thread_skin", Components.interfaces.nsISupportsString).data; if(skinName != ""){ - var skinDir = this._bbs2chService.getDataDir(); + var skinDir = this._b2rService.io.getDataDir(); skinDir.appendRelativePath("skin"); var fileURL = this._ioService.newFileURI(skinDir) .QueryInterface(Components.interfaces.nsIFileURL); @@ -1209,7 +1211,7 @@ var skinFile = null; if(skinName){ - skinFile = this._bbs2chService.getDataDir(); + skinFile = this._b2rService.io.getDataDir(); skinFile.appendRelativePath("skin"); skinFile.appendRelativePath(skinName); }else{ @@ -1231,8 +1233,8 @@ _replaceBaseTag: function(aString){ var requestURL = this._context._handler.requestURL; var threadURLSpec = requestURL.path.substring(8); - var skinURISpec = this._bbs2chService.serverURL.resolve("./skin/"); - var serverURLSpec = this._bbs2chService.serverURL.resolve("./thread/"); + var skinURISpec = this._b2rService.serverURL.resolve("./skin/"); + var serverURLSpec = this._b2rService.serverURL.resolve("./thread/"); var fontName = this._pref.getComplexValue("extensions.bbs2chreader.thread_font_name", Components.interfaces.nsISupportsString).data; fontName = this._bbs2chService.toSJIS(fontName);