ホスト名とユーザー名でアカウントのリストを作成する必要があるアドオンを開発しています。を使用してそれを行うことができnsIMsgAccountManager
ますが、手動セットアップを使用して新しいアカウントを作成すると、ホスト名が表示され、デフォルトの imap サーバー名imap.googlemail.com
が表示され192.168.0.25
ます。理想的にはホスト名を取得する必要があります192.168.0.25
が、それは私にimap.googlemail.com
. これは私が使用するコードです:
var originalAccounts = PrefValue("mail.accountmanager.accounts");
var allServers = accountManager.allServers;
var accounts = originalAccounts.split(",");
var flagFirstItemIsSelected=false;
for (var i = 0; i < accounts.length; ++i) {
for (var ii=0; ii < allServers.Count(); ii++) {
var currentServer = allServers.GetElementAt(ii).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
var type = currentServer.type;
alert(accounts[i]);
if ( accounts[i] == accountManager.FindAccountForServer(currentServer).key) {
// if (type == "none" || type == "pop3" || type == "imap" || type == "rss") {
if(type != "none")
{
if((currentServer.username.toLowerCase().search("Yahoo".toLowerCase()))==-1&&(currentServer.username.toLowerCase().search("Gmail".toLowerCase()))==-1&&(currentServer.username.toLowerCase().search("Rediffmail".toLowerCase()))==-1)
{
var theListitem = accountList.appendItem("[" + type + "] - " + currentServer.prettyName, accounts[i]);
if(flagFirstItemIsSelected==false)
{
//accountList.selectItem( theListitem );
flagFirstItemIsSelected=true;
}
theListitem.setAttribute("class", "folderMenuItem listitem-iconic")
theListitem.setAttribute("ServerType",type);
theListitem.setAttribute("IsServer",true);
theListitem.setAttribute("IsSecure",currentServer.isSecure);
theListitem.setAttribute("onclick","listClicked()");
}
}
}
}
}
どこが間違っているのか教えてください。