[Bbs2ch-cvs 222] [204] Firefox 以外の環境では違うポート番号を使うようにした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 8月 22日 (水) 03:40:56 JST


Revision: 204
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=204
Author:   flyson
Date:     2007-08-22 03:40:56 +0900 (Wed, 22 Aug 2007)

Log Message:
-----------
Firefox  以外の環境では違うポート番号を使うようにした

Modified Paths:
--------------
    trunk/bbs2chreader/components/b2rServer.js
    trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js

Modified: trunk/bbs2chreader/components/b2rServer.js
===================================================================
--- trunk/bbs2chreader/components/b2rServer.js	2007-08-18 18:07:54 UTC (rev 203)
+++ trunk/bbs2chreader/components/b2rServer.js	2007-08-21 18:40:56 UTC (rev 204)
@@ -84,7 +84,20 @@
 
 		var pref = Components.classes["@mozilla.org/preferences-service;1"]
 						.getService(Components.interfaces.nsIPrefBranch);
-		var port = pref.getIntPref("extensions.bbs2chreader.server_port");
+		var port = 0;
+		try{
+			var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
+    	    					.createInstance(Components.interfaces.nsIXULAppInfo);
+    	    if(appInfo.name == "Firefox"){
+				port = pref.getIntPref("extensions.bbs2chreader.server_port");
+			}else if(appInfo.name == "SeaMonkey"){
+				port = pref.getIntPref("extensions.bbs2chreader.server_port.seamonkey");
+			}else{
+				port = pref.getIntPref("extensions.bbs2chreader.server_port.other");
+			}
+		}catch(ex){
+			port = pref.getIntPref("extensions.bbs2chreader.server_port.other");
+		}
 
 		var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
 					.createInstance(Components.interfaces.nsIServerSocket);
@@ -204,7 +217,20 @@
 	run: function (){
 		var pref = Components.classes["@mozilla.org/preferences-service;1"]
 						.getService(Components.interfaces.nsIPrefBranch);
-		var port = pref.getIntPref("extensions.bbs2chreader.server_port");
+		var port = 0;
+		try{
+			var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
+    	    					.createInstance(Components.interfaces.nsIXULAppInfo);
+    	    if(appInfo.name == "Firefox"){
+				port = pref.getIntPref("extensions.bbs2chreader.server_port");
+			}else if(appInfo.name == "SeaMonkey"){
+				port = pref.getIntPref("extensions.bbs2chreader.server_port.seamonkey");
+			}else{
+				port = pref.getIntPref("extensions.bbs2chreader.server_port.other");
+			}
+		}catch(ex){
+			port = pref.getIntPref("extensions.bbs2chreader.server_port.other");
+		}
 
 		var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
 					.createInstance(Components.interfaces.nsIServerSocket);

Modified: trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js
===================================================================
--- trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-08-18 18:07:54 UTC (rev 203)
+++ trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-08-21 18:40:56 UTC (rev 204)
@@ -7,6 +7,8 @@
 pref("extensions.bbs2chreader.data_dir", "");
 pref("extensions.bbs2chreader.enable_tree_stripe2", false);
 pref("extensions.bbs2chreader.server_port", 8823);
+pref("extensions.bbs2chreader.server_port.seamonkey", 8824);
+pref("extensions.bbs2chreader.server_port.other", 8825);
 
 pref("extensions.bbs2chreader.maru_auth_url", "https://2chv.tora3.net/futen.cgi");
 pref("extensions.bbs2chreader.maru_auto_auth", true);




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