⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mail.jst

📁 现在很火的邮件客户端软件thunderbird的源码
💻 JST
📖 第 1 页 / 共 2 页
字号:
function updateMapi(){  var winreg;  var szValue;  var szMapiBackupDll;  var szDefaultMailClient;  var programMozMapi32File;  var mainExePath;  var sfpProgramMozMapi32File;  var sfpMainExePath;  var winsysMapi32File;  var mapiProxyFile;  var subkey;  var oldVersionIsDefautClient = false;  var mailDefaultDescription = "$ProductName$";  winreg = getWinRegistry();  if(winreg != null)   {    mainExePath = getFolder("Program", "$MainExeFile$");    programMozMapi32File = getFolder("Program", "mozMapi32.dll");    winsysMapi32File = getFolder("Win System", "Mapi32.dll");    winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);    // If Mapi_backup_dll *and* the default var of    // HKEY_LOCAL_MACHINE\Software\Clients\Mail is set, then install    // mozMapi32.dll to the windows system dir as Mapi32.dll.    szMapiBackupDll = winreg.getValueString("SOFTWARE\\Mozilla\\Desktop", "Mapi_backup_dll");    szDefaultMailClient = winreg.getValueString("SOFTWARE\\Clients\\Mail", "");    logComment("szMapiBackupDll: " + szMapiBackupDll);    logComment("szDefaultMailClient: " + szDefaultMailClient);    if((szMapiBackupDll != null) && (szMapiBackupDll != "") &&       (szDefaultMailClient != null) && (szDefaultMailClient == "$ProductName$"))    {      // We do not want to log this file to be uninstalled because the      // uninstaller already has a special way to deal with restoring the      // appropriate previous Mapi32.dll.      addFile("",              "$Version$",              "bin/mozMapi32.dll",           // file name in jar to extract               getFolder("Win System"),       // Where to put this file (Returned from getFolder)               "Mapi32.dll",                  // new name when installed              DO_NOT_UNINSTALL);    }    sfpProgramMozMapi32File = File.windowsGetShortName(programMozMapi32File);    sfpMainExePath = File.windowsGetShortName(mainExePath);    subkey  = "SOFTWARE\\Clients\\Mail\\$ProductName$";    winreg.createKey(subkey, "");    winreg.setValueString(subkey, "", mailDefaultDescription);    winreg.setValueString(subkey, "DLLPath", sfpProgramMozMapi32File);    winreg.createKey(subkey      + "\\DefaultIcon", "");    winreg.setValueString(subkey + "\\DefaultIcon", "", sfpMainExePath + ",0");    // Register mailto protocol handler    winreg.createKey(subkey      + "\\protocols", "");    winreg.createKey(subkey      + "\\protocols\\mailto", "");    winreg.setValueString(subkey + "\\protocols\\mailto", "", "URL:MailTo Protocol");    winreg.setValueString(subkey + "\\protocols\\mailto", "URL Protocol", "");    winreg.createKey(subkey      + "\\protocols\\mailto\\shell", "");    winreg.createKey(subkey      + "\\protocols\\mailto\\shell\\open", "");    winreg.createKey(subkey      + "\\protocols\\mailto\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\protocols\\mailto\\shell\\open\\command", "", sfpMainExePath + " -compose \"%1\"");    winreg.createKey(subkey      + "\\protocols\\mailto\\DefaultIcon", "");    winreg.setValueString(subkey + "\\protocols\\mailto\\DefaultIcon", sfpMainExePath + ",0");    // register shell open command for Mozilla Thunderbird product key under \Mail    winreg.createKey(subkey      + "\\shell", "");    winreg.createKey(subkey      + "\\shell\\open", "");    winreg.createKey(subkey      + "\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\shell\\open\\command", "", sfpMainExePath);    winreg.createKey(subkey      + "\\shell\\properties", "");    winreg.setValueString(subkey + "\\shell\\properties", "", "Thunderbird &Options");    winreg.createKey(subkey      + "\\shell\\properties\\command", "");    winreg.setValueString(subkey + "\\shell\\properties\\command", "", sfpMainExePath + " -options");    // Register Thunderbird as a News Reader    subkey  = "SOFTWARE\\Clients\\News\\$ProductName$";    winreg.createKey(subkey, "");    winreg.setValueString(subkey, "", mailDefaultDescription);    winreg.setValueString(subkey, "DLLPath", sfpProgramMozMapi32File);    winreg.createKey(subkey      + "\\DefaultIcon", "");    winreg.setValueString(subkey + "\\DefaultIcon", "", sfpMainExePath + ",0");    // register shell open command for Mozilla Thunderbird product key under \News    winreg.createKey(subkey      + "\\shell", "");    winreg.createKey(subkey      + "\\shell\\open", "");    winreg.createKey(subkey      + "\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\shell\\open\\command", "", sfpMainExePath);    // Register News protocol handlers (news, snews, nntp)    winreg.createKey(subkey      + "\\protocols", "");    winreg.createKey(subkey      + "\\protocols\\news", "");    winreg.setValueString(subkey + "\\protocols\\news", "", "URL:News Protocol");    winreg.setValueString(subkey + "\\protocols\\news", "URL Protocol", "");    winreg.createKey(subkey      + "\\protocols\\news\\shell", "");    winreg.createKey(subkey      + "\\protocols\\news\\shell\\open", "");    winreg.createKey(subkey      + "\\protocols\\news\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\protocols\\news\\shell\\open\\command", "", sfpMainExePath + " -mail \"%1\"");    winreg.createKey(subkey      + "\\protocols\\news\\DefaultIcon", "");    winreg.setValueString(subkey + "\\protocols\\news\\DefaultIcon", sfpMainExePath + ",0");    winreg.createKey(subkey      + "\\protocols\\nntp", "");    winreg.setValueString(subkey + "\\protocols\\nntp", "", "URL:NNTP Protocol");    winreg.setValueString(subkey + "\\protocols\\nntp", "URL Protocol", "");    winreg.createKey(subkey      + "\\protocols\\nntp\\shell", "");    winreg.createKey(subkey      + "\\protocols\\nntp\\shell\\open", "");    winreg.createKey(subkey      + "\\protocols\\nntp\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\protocols\\nntp\\shell\\open\\command", "", sfpMainExePath + " -mail \"%1\"");    winreg.createKey(subkey      + "\\protocols\\nntp\\DefaultIcon", "");    winreg.setValueString(subkey + "\\protocols\\nntp\\DefaultIcon", sfpMainExePath + ",0");    winreg.createKey(subkey      + "\\protocols\\snews", "");    winreg.setValueString(subkey + "\\protocols\\snews", "", "URL:Snews Protocol");    winreg.setValueString(subkey + "\\protocols\\snews", "URL Protocol", "");    winreg.createKey(subkey      + "\\protocols\\snews\\shell", "");    winreg.createKey(subkey      + "\\protocols\\snews\\shell\\open", "");    winreg.createKey(subkey      + "\\protocols\\snews\\shell\\open\\command", "");    winreg.setValueString(subkey + "\\protocols\\snews\\shell\\open\\command", "", sfpMainExePath + " -mail \"%1\"");    winreg.createKey(subkey      + "\\protocols\\snews\\DefaultIcon", "");    winreg.setValueString(subkey + "\\protocols\\snews\\DefaultIcon", sfpMainExePath + ",0");    subkey              = "SOFTWARE\\$ProductName$\\Desktop";    szCurrentVersion    = winreg.getValueString(subkey, "CurrentVersion");    logComment("szCurrentVersion: " + szCurrentVersion);    // Register MapiProxy.dll    mapiProxyFile = getFolder("Program", "MapiProxy.dll");    err = File.windowsRegisterServer(mapiProxyFile);    logComment("File.windowsRegisterServer(" + mapiProxyFile + ") returned: " + err);    // Ok, we've registered ourselves as a Mail and News client. We've registered all of the protocols we support.    // If the user was using Thunderbird as their default client but had Thunderbird installed in a different directory    // than what the installer is installing into, then we end up with the wrong version of Thunderbird as the default app.    // to work around this, we are going to test what the current default mail app is. If it contains Thunderbird and it is not    // pointing to us, then write into the registry the values necessary for Thunderbird to re-ask the user about being the default    // mail app the next time the newly installed version comes up. This case happens a lot because we've had so many releases without    // an installer that everyone has ended up installing bits into their own locations.    if (szDefaultMailClient == "$ProductName$")    {      // check to see if the location of the default mail protocol handler matches the location we just wrote to...      // if it does not, then       var szNewMailtoProtocolHandler = sfpMainExePath + " -compose \"%1\"";      var szOldMailtoProtocolHandler = winreg.getValueString("Software\\Classes\\mailto\\shell\\open\\command", "");      if ((szOldMailtoProtocolHandler != null) && (szNewMailtoProtocolHandler != szOldMailtoProtocolHandler))        oldVersionIsDefautClient = true;      logComment("oldVersionIsDefautClient: " + oldVersionIsDefautClient);    }     // now that we have registred ourselves as a mail and news client, make some notations in our scratch pad    // so the client doesn't try to re-register the same keys all over again.    subkey  = "SOFTWARE\\$ProductName$";    winreg.createKey(subkey, "");    winreg.createKey(subkey + "\\Desktop", "");    winreg.setValueString(subkey + "\\Desktop", "registeredAsMailApp", "1");    winreg.setValueString(subkey + "\\Desktop", "registeredAsNewsApp", "1");    if (oldVersionIsDefautClient)    {      // ok here's a scenario where a different version of thunderbird is the default mail client in a different directory      // from where the installer is putting it. So clear out our scratchpad registry entries to make Thunderbird ask the user

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -