svnno****@sourc*****
svnno****@sourc*****
2007年 10月 31日 (水) 20:17:23 JST
Revision: 239 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=239 Author: flyson Date: 2007-10-31 20:17:22 +0900 (Wed, 31 Oct 2007) Log Message: ----------- port 番号を nsIBbs2chService.serverURL から取得するようにした Modified Paths: -------------- trunk/bbs2chreader/components/b2rServer.js -------------- next part -------------- Modified: trunk/bbs2chreader/components/b2rServer.js =================================================================== --- trunk/bbs2chreader/components/b2rServer.js 2007-10-30 12:23:05 UTC (rev 238) +++ trunk/bbs2chreader/components/b2rServer.js 2007-10-31 11:17:22 UTC (rev 239) @@ -79,21 +79,7 @@ .getService(Ci.nsIEventQueueService); this._eventQueue = eventQueueService.createFromIThread(this.currentThread, false); - var pref = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - var port = 0; - try{ - var appInfo = Cc["@mozilla.org/xre/app-info;1"].createInstance(Ci.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 port = Cc["@mozilla.org/bbs2ch-service;1"].getService(Ci.nsIBbs2chService).serverURL.port; var serverSocket = Cc["@mozilla.org/network/server-socket;1"] .createInstance(Ci.nsIServerSocket); serverSocket.init(port, true, 10); @@ -215,22 +201,7 @@ // ********** ********* implements nsIRunnable ********** ********** run: function (){ - var pref = Cc["@mozilla.org/preferences-service;1"] - .getService(Ci.nsIPrefBranch); - var port = 0; - try{ - var appInfo = Cc["@mozilla.org/xre/app-info;1"].createInstance(Ci.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 port = Cc["@mozilla.org/bbs2ch-service;1"].getService(Ci.nsIBbs2chService).serverURL.port; var serverSocket = Cc["@mozilla.org/network/server-socket;1"] .createInstance(Ci.nsIServerSocket); serverSocket.init(port, true, 10); @@ -268,8 +239,7 @@ // ********** ********* implements nsIObserver ********** ********** observe: function(aSubject, aTopic, aData){ - var os = Cc["@mozilla.org/observer-service;1"] - .getService(Ci.nsIObserverService); + var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); switch(aTopic){ case "app-startup":