home *** CD-ROM | disk | FTP | other *** search
- var MAIN_IDENTITY_REG_KEY = "SOFTWARE\\Microsoft\\Internet Account Manager\\Accounts\\";
-
- function ssIsOutlookExpressInstalled()
- {
- var oeRegVal = window.external.QueryRegValue("HKLM", "SOFTWARE\\Clients\\Mail\\Outlook Express\\", "");
- if (oeRegVal == null || oeRegVal == "") return false;
- else return true;
- }
-
- function ssGetIdentities()
- {
- var strIdentities = window.external.QueryRegSubkeys("HKCU", "Identities");
- return strIdentities.split(",");
- }
-
- function ssGetIdentityDisplayName(identity)
- {
- var regKey = "Identities\\" + identity;
- return window.external.QueryRegValue("HKCU", regKey, "Username");
- }
-
- function ssIsMainIdentity(identity)
- {
- var displayName = ssGetIdentityDisplayName(identity);
- if (displayName.toLowerCase() == "main identity") return true;
- else return false;
- }
-
- function ssGetNextAcctNum(identityRegKey)
- {
- var acctNum = 1;
-
- while (acctNum < 100)
- {
- // convert number to 8 char hex string (example: "00000001")
- var strAcctNum = acctNum.toString(16);
- var len = 8 - strAcctNum.length;
-
- for (var i = 0; i < len; i++)
- {
- strAcctNum = "0" + strAcctNum;
- }
-
- // check registry if accout number already exists
- var regKey = identityRegKey + strAcctNum;
- var acctName = window.external.QueryRegValue("HKCU", regKey, "Account Name");
- if (acctName == null || acctName == "") return strAcctNum;
-
- // account exists, increment account number
- acctNum++;
- }
-
- return "";
- }
-
- function ssSetOEProfile(regKey, acctName, userName, userDisplayName, emailAddr, mailSvr, popSvr)
- {
- window.external.SetRegValueByType("HKCU", regKey, "Account Name", 1, acctName);
- window.external.SetRegValueByType("HKCU", regKey, "Connection Type", 4, 1);
- window.external.SetRegValueByType("HKCU", regKey, "POP3 Prompt for Password", 4, 1);
- window.external.SetRegValueByType("HKCU", regKey, "POP3 Server", 1, popSvr);
- window.external.SetRegValueByType("HKCU", regKey, "POP3 User Name", 1, userName);
- window.external.SetRegValueByType("HKCU", regKey, "SMTP Display Name", 1, userDisplayName);
- window.external.SetRegValueByType("HKCU", regKey, "SMTP Email Address", 1, emailAddr);
- window.external.SetRegValueByType("HKCU", regKey, "SMTP Server", 1, mailSvr);
- }
-
- function ssCreateOEAccount(identity, acctName, userName, userDisplayName, emailAddr, mailSvr, popSvr)
- {
- var identityRegKey;
- var strAcctNum;
- var strRegKey;
-
- if (ssIsMainIdentity(identity)) identityRegKey = MAIN_IDENTITY_REG_KEY;
- else identityRegKey = "Identities\\" + identity + "\\Software\\Microsoft\\Internet Account Manager\\Accounts\\";
-
- strAcctNum = ssGetNextAcctNum(identityRegKey);
- if (strAcctNum != "")
- {
- var strAcctNumParsed = strAcctNum.slice(strAcctNum.length-2, strAcctNum.length);
- strRegKey = identityRegKey + strAcctNum;
- acctName += " (" + strAcctNumParsed + ")";
- ssSetOEProfile(strRegKey, acctName, userName, userDisplayName, emailAddr, mailSvr, popSvr);
- return true;
- }
-
- return false;
- }
-