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

Back to archive index

flyson flyso****@users*****
2005年 12月 3日 (土) 00:10:46 JST


Index: bbs2chreader/content/bbs2chreader/channel.js
diff -u bbs2chreader/content/bbs2chreader/channel.js:1.6 bbs2chreader/content/bbs2chreader/channel.js:removed
--- bbs2chreader/content/bbs2chreader/channel.js:1.6	Fri Jun 17 00:11:22 2005
+++ bbs2chreader/content/bbs2chreader/channel.js	Sat Dec  3 00:10:46 2005
@@ -1,253 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is bbs2chreader.
- *
- * The Initial Developer of the Original Code is
- * flyson.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *    flyson <flyso****@users*****>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-
-
-/**
- *	Channel の雛形
- */
-function Bbs2chChannel(aURI, aContentType, aContentCharset, aObserver){
-	this.URI = aURI;
-	this.originalURI = aURI;
-	this.contentType = aContentType;
-	this.contentCharset = aContentCharset;
-
-	this._properties = new Array();
-	this._observer = aObserver;
-
-	this._isPending = true;
-	this._dataSize = 0;
-	this._stringStream = Components.classes["@mozilla.org/io/string-input-stream;1"]
-							.createInstance(Components.interfaces.nsIStringInputStream);
-}
-
-Bbs2chChannel.prototype = {
-
-	QueryInterface: function(aIID){
-		if(aIID.equals(Components.interfaces.nsIChannel))  return this;
-		if(aIID.equals(Components.interfaces.nsIProperties))  return this;
-		if(aIID.equals(Components.interfaces.nsIRequest))  return this;
-		if(aIID.equals(Components.interfaces.nsISupports)) return this;
-
-		throw Components.results.NS_ERROR_NO_INTERFACE;
-	},
-
-
-// ********** ********* implements nsIProperties ********** **********
-
-
-	get: function(aProperty, aIID){
-		if(this.has(aProperty)){
-			return this._properties[aProperty];
-		}
-		throw Components.results.NS_ERROR_FAILURE;
-	},
-
-
-	set: function(aProperty, aValue){
-		this._properties[aProperty] = aValue;
-		return Components.results.NS_OK;
-	},
-
-
-	has: function(aProperty){
-		return this._properties.hasOwnProperty(aProperty);
-	},
-
-
-	undefine: function(aProperty){
-		if(this.has(aProperty)){
-			delete this._properties[aProperty];
-			return Components.results.NS_OK;
-		}
-		throw Components.results.NS_ERROR_FAILURE;
-	},
-
-	getKeys :function(aCount){
-		var resultArray = new Array();
-		for(var i in this._properties) resultArray.push(i);
-		aCount.value = resultArray.length;
-		return resultArray;
-	},
-
-
-// ********** ********* implements nsIChannel ********** **********
-
-
-	owner: null,
-	notificationCallbacks: null,
-	securityInfo: null,
-	contentLength: -1,
-	status: Components.results.NS_OK,
-	loadGroup: null,
-	loadAttributes: null,
-
-	open: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-	
-	asyncOpen: function(aStreamListener, aContext){
-		var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
-								.getService(Components.interfaces.nsICacheService);
-		var session = cacheService.createSession("HTTP", 
-								Components.interfaces.nsICache.STORE_ON_DISK, true);
-		session.doomEntriesIfExpired = false;
-
-		this._streamListener = aStreamListener;
-		this._context = aContext;
-		if(this.loadGroup) this.loadGroup.addRequest(this, this._context);
-
-		this._cacheMode = false;
-		if(this.loadFlags & 4096){
-			this._cacheMode = true;
-			session.asyncOpenCacheEntry(this.URI.spec, 
-								Components.interfaces.nsICache.ACCESS_READ_WRITE, this);
-			return;
-		};
-
-		this._cacheEntry = session.openCacheEntry(this.URI.spec, 
-								Components.interfaces.nsICache.ACCESS_READ_WRITE, true);
-		this._cacheOutputStream = this._cacheEntry.openOutputStream(0, -1, 0);
-
-
-			// 呼び出し元のスレッド処理後にスタート
-		var timer = Components.classes["@mozilla.org/timer;1"]
-						.createInstance(Components.interfaces.nsITimer);
-		var timerCallback = {};
-		timerCallback._context = this;
-		timerCallback.observe = function(aTimer){
-			this._context.asyncOpenDelay();
-		}
-		timer.init(timerCallback, 0, timer.TYPE_ONE_SHOT);
-	},
-
-	onCacheEntryAvailable: function(aDescriptor, aAccessGranted, aStatus){
-		this._streamListener.onStartRequest(this, this._context);
-		
-		var inputStream = aDescriptor.openInputStream(0, -1, 0);
-		var scriptableInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]
-					.createInstance(Components.interfaces.nsIScriptableInputStream);
-		scriptableInputStream.init(inputStream);
-		var cacheContent = scriptableInputStream.read(scriptableInputStream.available());
-		this.requestRespond(cacheContent);
-		scriptableInputStream.close();
-		inputStream.close();
-		aDescriptor.close();
-		this.requestEnd();
-	},
-
-	isPending: function(){
-		return this._isPending;
-	},
-
-	cancel: function(aStatus){
-		if(this._isPending){
-			this._isPending = false;
-			
-			this._streamListener.onStopRequest(this, this._context, aStatus);
-			if(this.loadGroup){
-				try{
-					this.loadGroup.removeRequest(this, null, aStatus);
-				}catch(ex){}
-			}
-		}
-		this.status = aStatus;
-	},
-
-	resume: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-	
-	suspend: function(){
-		throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-	},
-
-
-// ********** ********* implements Bbs2chChannel ********** **********
-
-	
-	/**
-	 * リクエストのスタート
-	 */
-	asyncOpenDelay: function(){
-		this._streamListener.onStartRequest(this, this._context);
-			// observer は、Bbs2chThread 等の Channel を操作するオブジェクト
-		var observer = new this._observer(this);
-	},
-
-
-	/**
-	 * リクエストにデータを送る
-	 * @param aString string データ
-	 */
-	requestRespond: function(aString){
-		aString = aString.toString();
-		var strLength = aString.length;
-
-		if(!this._cacheMode){
-			this._cacheOutputStream.write(aString, strLength);
-		}
-		
-		this._stringStream.setData(aString, strLength);
-		this._streamListener.onDataAvailable(this, this._context,
-					this._stringStream, this._dataSize, strLength);
-		this._dataSize += strLength;
-	},
-
-
-	/**
-	 * リクエストを終了する
-	 */
-	requestEnd: function(){
-		if(!this._cacheMode){
-			this._cacheOutputStream.close();
-			this._cacheEntry.setMetaDataElement("request-method", "GET");
-			this._cacheEntry.setMetaDataElement("response-head", "HTTP/1.1 200 OK\r\n");
-			this._cacheEntry.markValid();
-			this._cacheEntry.close();
-		}
-		
-		this._streamListener.onStopRequest(this, this._context, Components.results.NS_OK);
-		if(this.loadGroup){
-			try{
-				this.loadGroup.removeRequest(this, null, Components.results.NS_OK);
-			}catch(ex){}
-		}
-		this._isPending = false;
-	}
-}
\ No newline at end of file


bbs2ch-cvs メーリングリストの案内
Back to archive index