pax_global_header00006660000000000000000000000064131757421360014523gustar00rootroot0000000000000052 comment=78d72e2c33c4d2535893e489ded628627d4dae90 exteditor/000077500000000000000000000000001317574213600130765ustar00rootroot00000000000000exteditor/CHANGELOG.txt000066400000000000000000000112171317574213600151300ustar00rootroot00000000000000v1.0.2 (24 May 2017) [new] Compatible with Thunderbird 52 This version won't work on Thunderbird 51 and former. v1.0.0 (02 Jul 2011) [new] Compatible with Thunderbird 5.0 v0.9.0 (04 Jul 2010) [new] Compatible with Thunderbird 3.1 [new] Nez languages: uk-UA, ro-RO, ca-AD v0.8.0 (30 Aug 2008) [new] Compatible with Thunderbird 3 (and only Thunderbird 3) as of version beta1 [new] The behaviour will be more responsive when closing the external editor [new] New locales: zh-CN, fi-FI, be-BY, ar, zh-TW, ru-RU [bug] Correct a bug causing the Thunderbird editor window to remain disabled after an error when closing the external editor v0.7.4 (24 May 2008) [bug] Parts of the messages marked as quotations are now properly kept accross EE edition. Use an https update URL which will become mandatory for the update mechanism to keep working with Thunderbird 3 This version doesn't work yet on Thunderbird 3 v0.7.3 (08 Mar 2007) [bug] With TB 2.0, a plaintext message composer window switched to a html-like mode, after having used External Editor v0.7.2 (14 Fev 2006) [new] Added a 8+3 temporary filename option, to allow using DOS editors. [new] Polish locale [bug] Solves the double-newlines appearing when copy/pasting a block edited on Windows. v0.7.1 (19 sept 2005) [new] Compatible Thunderbird 1.5 . [new] Added a dutch locale. Update of the japanese locale. v0.7.0 (30 Aug 2005) [new] The extension has been localized. Locale available are: English French Italian Spanish Slovak Japanese [new] Compatible with Thunderbird 1.1 . [new] Option to specify if the editor handle Unicode characters. [bug] Whith accented characters inserted using a non Unicode editor, the extension crahsed. Now, it keeps your work without the Unicode conversion. You may get back to what you typed with Ctrl-Z (twice). [bug] The chosen editor in the preferences was not properly (and immediately) taken in account. It works fine now. v0.6.1 (27 Jun 2005) [bug] Corrects the bug about headersEnd and bt undefined, which appeared if the External Editor button had not been drag'n droppedin the messenger compose window toolbar. v0.6.0 (26 Apr 2005) [new] Unicode support (remember to set unicode encoding in the Compose window before launching External Editor: Menu Options/Character Encoding: Unicode (UTF-8) ). [bug] Headers which are not displayed in the editor are not suppressed anymore from the message headers list. v0.5.4 (14 Mar 2005) [bug] The extension did not work and froze Thunderbird if Yamb was not installed (chrome namespace error). [bug] The Html/Plain selector now works properly at the first run. v0.5.3 (08 Mar 2005) [new] Preferences to chose to edit headers and which of them will be edited. [new] No more space between the colon (:) and the headers name, to work with the GVIM syntax highlighting system. [new] The temporary file is now an eml file instead of a txt file. [new] Adds 'Newsgroup' to the editable headers. [bug] If the extenal editor path chosen with the file selection box contains spaces (ex: C:Program Files...), it is automaticaly quoted. [bug] A quoted executable doesn't lead anymore to a trailing quote on the extrernal editor button name. [bug] The menu entry "Tools/Edit in External Editor" is now working. [bug] The subject was not updated if it contained colons (:). v0.5.2 (18 Jan 2005) [new] The external editor arguments may contain spaces when quoted. [bug] No more "carriage return" visible under windows (New lines are homogeneous in headers and in the message body). v0.5.1 (14 Jan 2005) Adapted icon size (standard sizes have changed with TB 1.0). v0.5.0 (12 Jan 2005) [new] Added an entry in the Tool menu and a keyboard shortcut (Ctrl-E) for launching External Editor [new] External Editor got it's own icon (useless but prettier). v0.4.0 (15 Dec 2004) [new] Headers can now be edited in the external editor, given as a comma separated list in a paragraph before the message content; Supportedheaders are: Subject, To, Cc, Bcc, Reply-To. v0.3.0 (2 Dec 2004) Updated and checked for Thunderbird 1.0. v0.2.0 (21 Nov 2004) [bug] Xml tags () are not considered anymore as tags info when editing plain text. [new] When composing in HTML mode, the External Editor button now provides a drop down menu allowing to edit as HTML (thus keeping all textenhancements), or as plain text. [new] The executable may now contain options (example: xterm -e vi). v0.1.2 (19 Nov 2004) [bug] The preference file selection box works now properly on Unix. exteditor/LICENSE000066400000000000000000000405261317574213600141120ustar00rootroot00000000000000Mozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. exteditor/README.md000066400000000000000000000066141317574213600143640ustar00rootroot00000000000000# External Editor [![Latest release](https://badge.fury.io/gh/exteditor%2Fexteditor.svg)](https://github.com/exteditor/exteditor/releases) * See [Wiki](https://github.com/exteditor/exteditor/wiki) for documentation/screenshots etc. * [Changelog](CHANGELOG.txt) # Purpose Thunderbird mail client extension which allows to open and edit your messages in an external text editor such as **NEdit**, **emacs**, etc... # Installation The External Editor button is not visible by default; you must customize your composer toolbar: * Open the compose window * Select the menu **View/Toolbars/Customize...**, or right click on the toolbar and select **Customize...** * Drag and Drop the new icon **External Editor** on your toolbar * Click **OK** Then, open the extension option window and set your editor (without path or with an absolute path) # Usage Just click on the extension button or use the keyboard shortcut (Ctrl-E), edit your message in your editor (while editing, the compose window is disabled), save, close, and the message will be updated in the compose window. Emacs users can install this [major mode](http://os.inf.tu-dresden.de/~mp26/download/tbemail.el) designed for EE (look [here](http://os.inf.tu-dresden.de/~mp26/emacs.shtml) for details). ## HTML Edition When editing a HTML message, the External Editor button provides a drop-down menu allowing to edit as HTML (thus keeping all text enhancements), or as plain text. ## Unicode support Starting with version 0.6, unicode is supported. You must set unicode encoding in the Compose window **before** launching External Editor: Menu **Options/Character Encoding: Unicode (UTF-8)**. ## Headers Edition Headers can be edited in the external editor, given as a comma separated list in a paragraph before the message content. Supported headers are: `Subject, To, Cc, Bcc, Reply-To, Newsgroup.` Subject: Here is the subject To: adressTo1, adressTo2 Cc: adressCc1 Bcc: Reply-To: -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- ... the mail content begins here ... But you can then modify it, use multiple lines, and add as many headers type as you want. Example: To: adresseTo1, adresseTo2 adresseTo3 adresseTo4, adresseTo5 Cc: adresseCc1 adresseCc2, adresseCc3 To:adresseTo6 To:adresseTo7 ... -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- # Warnings * Your external editor **must** run in foreground, i.e. must not return before you close the file. * NEdit: use `"nedit"` or `"nc -wait"` * gvim: use `"gvim --nofork"` * and for vim: use `"xterm -e vim"` # Supported platforms External Editor has been tested on Windows (XP and later) and Linux. It also works on Mac OSX, beginning with Thunderbird 1.1. # How to build Make sure you have perl and zip installed on your system and run: make # Interesting posts and reference * [Security issue with subjects visible in tmp filenames](http://globs.org/thread.php?lng=en&pg=1037&fid=7&cat=1) * [Hot key disable/customization](http://globs.org/thread.php?lng=en&pg=2655&fid=2&cat=1) * [Change key binding](http://globs.org/thread.php?lng=en&pg=231&fid=10&cat=1) * https://developer.mozilla.org/en-US/docs/XUL * [When will XUL be deprecated for Thunderbird?](https://discourse.mozilla-community.org/t/introduction-to-add-on-development/608/27) exteditor/chrome.manifest000066400000000000000000000030701317574213600161030ustar00rootroot00000000000000 overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://exteditor/content/exteditor.xul overlay chrome://global/content/customizeToolbar.xul chrome://exteditor/content/exteditor.xul content exteditor jar:chrome/exteditor.jar!/content/ locale exteditor en-US jar:chrome/exteditor.jar!/locale/en-US/exteditor/ locale exteditor fr-FR jar:chrome/exteditor.jar!/locale/fr-FR/exteditor/ locale exteditor it-IT jar:chrome/exteditor.jar!/locale/it-IT/exteditor/ locale exteditor es-ES jar:chrome/exteditor.jar!/locale/es-ES/exteditor/ locale exteditor sk-SK jar:chrome/exteditor.jar!/locale/sk-SK/exteditor/ locale exteditor ja-JP jar:chrome/exteditor.jar!/locale/ja-JP/exteditor/ locale exteditor nl-NL jar:chrome/exteditor.jar!/locale/nl-NL/exteditor/ locale exteditor pl-PL jar:chrome/exteditor.jar!/locale/pl-PL/exteditor/ locale exteditor zh-TW jar:chrome/exteditor.jar!/locale/zh-TW/exteditor/ locale exteditor zh-CN jar:chrome/exteditor.jar!/locale/zh-CN/exteditor/ locale exteditor fi-FI jar:chrome/exteditor.jar!/locale/fi-FI/exteditor/ locale exteditor de-DE jar:chrome/exteditor.jar!/locale/de-DE/exteditor/ locale exteditor ru-RU jar:chrome/exteditor.jar!/locale/ru-RU/exteditor/ locale exteditor ar jar:chrome/exteditor.jar!/locale/ar/exteditor/ locale exteditor be-BY jar:chrome/exteditor.jar!/locale/be-BY/exteditor/ locale exteditor uk-UA jar:chrome/exteditor.jar!/locale/uk-UA/exteditor/ locale exteditor ro-RO jar:chrome/exteditor.jar!/locale/ro-RO/exteditor/ locale exteditor ca-AD jar:chrome/exteditor.jar!/locale/ca-AD/exteditor/ exteditor/chrome/000077500000000000000000000000001317574213600143535ustar00rootroot00000000000000exteditor/chrome/content/000077500000000000000000000000001317574213600160255ustar00rootroot00000000000000exteditor/chrome/content/emacs16.png000066400000000000000000000010511317574213600177670ustar00rootroot00000000000000PNG  IHDRhtIME * pHYs  d_gAMA aIDATxڕRAKQOa  {YD:JH'N!c"<{YăD"K%1xk%_IQwϟ[pjup=hX<5j6lH&VkS0Ę9H$I:5 :E"P(`Sh4H4cS I$WUd2A,<::dTǶVܳ|HFBό!VΨA'cbIENDB`exteditor/chrome/content/emacs24.png000066400000000000000000000017051317574213600177740ustar00rootroot00000000000000PNG  IHDRp ntIME 9jH pHYs  d_gAMA aTIDATxڭUQDa~M&GdEI2.$̑d$.Jɹ82]drd2L&$L&d2?oZ:8/}}G$^Z 67UȨ8> L&#X{ji1+^VY,JYIS;9\5>>!Jlbf-eS{s++eLbgUuw[;vwnw{擡) S/l PzFl6"!t:-lT(I`vv||Ǽpy#4"+dZ-%EhN@AUv[ʀWW1KV1 ypxPsrrE KKJû D:!@ B`ImL-%244t:QHo08i^ަC屵Qy>D @-,"@1W[A]]âd'P i*%n"DWG ,S6#>ݎ"}bј bښY1Uk=&)EDšfPBSᅢ0r$fG>_ "P(L8=Kw^g4),t_d(_63CoV Sr9NN(JF OQ!k;d0t^KMŔ(rOXЩ3;"sECx zr;ADc\N炔v>6H*' Es=2) { headerType = whichHeader.shift().replace(/\s+/g, "").toLowerCase(); // if the subject contains ":", the array has more than 2 members... var headerContent = whichHeader.join(":").replace(/^\s+/, ""); if (headerHash[headerType] === undefined) { headerHash[headerType] = headerContent; } else { headerHash[headerType] += ","+headerContent; } } else { // if not only spaces or empty line if (/\w/.test(headersLines[i])) { headerHash[headerType] += ","+headersLines[i]; } } } var subject = headerHash[exteditor_SUBJECT.toLowerCase()]; if (subject !== undefined) { document.getElementById('msgSubject').value = subject; gMsgCompose.compFields.subject = subject; } var msgCompFields = gMsgCompose.compFields; Recipients2CompFields(msgCompFields); if (prefEditHeaders[exteditor_TO]) msgCompFields.to = headerHash[exteditor_TO.toLowerCase()]; if (prefEditHeaders[exteditor_CC]) msgCompFields.cc = headerHash[exteditor_CC.toLowerCase()]; if (prefEditHeaders[exteditor_BCC]) msgCompFields.bcc = headerHash[exteditor_BCC.toLowerCase()]; if (prefEditHeaders[exteditor_REPLY_TO]) msgCompFields.replyTo = headerHash[exteditor_REPLY_TO.toLowerCase()]; if (prefEditHeaders[exteditor_NEWSGROUP]) msgCompFields.newsgroups = headerHash[exteditor_NEWSGROUP.toLowerCase()]; CompFields2Recipients(msgCompFields); } } else { // No headers edition here messageText = content; } // Replace \r\n by \n if (osType=="win") { messageText = messageText.replace(/\r\n/g, "\n"); } } catch(e) { // A message could be displayed her, but I don't wan't to bother with localizations... } finally { setEditorDisabled(false); } var editor = GetCurrentEditor(); if (isEditAsHtml()) { editor.rebuildDocumentFromSource(""); // is there a Clear() method somewhere ? editor.insertHTML(messageText); } else { // Don't use rebuildDocumentFromSource() here: it turns the editor in a // html mode in which multiple spaces disapear. var wholeDocRange = editor.document.createRange(); var rootNode = editor.rootElement.QueryInterface(Components.interfaces.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode); editor.selection.addRange(wholeDocRange); try { editor.selection.deleteFromDocument(); } catch(e) { // The selection did not exist yet. Everything should be fine } editor.QueryInterface(Components.interfaces.nsIEditorMailSupport).insertTextWithQuotations(messageText); } } //----------------------------------------------------------------------------- function extEditorError(msg) { msg = "ExtEditor: " + msg; alert(msg); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- function tryCloseExtEditor() { if (isEditorDisabled) { extEditorError(getLocaleString("CloseYourExternalEditorFirst")); return false; } return true; } //----------------------------------------------------------------------------- function initExteditor() { if (window.navigator.platform.toLowerCase().indexOf("win") != -1) { dirSeparator = '\\'; pathSeparator = ';'; osType = 'win'; newLine = "\r\n"; } else { dirSeparator = '/'; pathSeparator = ':'; osType = 'unix'; newLine = "\n"; } settingsObserver = new extEditorSettingsObserver(); var editHtmlAsHtml = nsPreferences.getBoolPref('exteditor.html.editAsHtml', true); prefNotifierExe = nsPreferences.copyUnicharPref('exteditor.default.editor', ""); prefEditorUnicode = nsPreferences.getBoolPref('exteditor.editor.unicode', true); prefEditor83Filename = nsPreferences.getBoolPref('exteditor.editor.83filename', false); prefEditHeaders[exteditor_GLOBAL] = nsPreferences.getBoolPref('exteditor.headers.edit', true); prefEditHeaders[exteditor_SUBJECT] = nsPreferences.getBoolPref('exteditor.headers.edit.subject', true); prefEditHeaders[exteditor_TO] = nsPreferences.getBoolPref('exteditor.headers.edit.to', true); prefEditHeaders[exteditor_CC] = nsPreferences.getBoolPref('exteditor.headers.edit.cc', true); prefEditHeaders[exteditor_BCC] = nsPreferences.getBoolPref('exteditor.headers.edit.bcc', true); prefEditHeaders[exteditor_REPLY_TO] = nsPreferences.getBoolPref('exteditor.headers.edit.replyto', false); prefEditHeaders[exteditor_NEWSGROUP] = nsPreferences.getBoolPref('exteditor.headers.edit.newsgroup', false); initButton(prefNotifierExe, editHtmlAsHtml); headersEnd = "-=-=-=-=-=-=-=-=-=# " + getLocaleString("DontRemoveThisLine") + " #=-=-=-=-=-=-=-=-=-" + newLine; } //----------------------------------------------------------------------------- function savePrefEditHtmlAsHtml(flag) { nsPreferences.setBoolPref('exteditor.html.editAsHtml', flag); } //----------------------------------------------------------------------------- function tmpDir() { var tmpdir; try { tmpdir = Components.classes["@mozilla.org/file/directory_service;1"]. createInstance(Components.interfaces.nsIProperties). get("TmpD", Components.interfaces.nsIFile).target; } catch(e) { tmpdir = (osType=='unix') ? "/tmp" : "C:\\Temp" ; } return tmpdir; } //----------------------------------------------------------------------------- function tmpFilename(str, use83filename) { var d = new Date(); var t = d.getTime(); var fn = tmpDir() + dirSeparator; var basenameLenLimit = 80; // limit basename to X chars (don't use values smaller than t.length) if (use83filename) { fn += t.toString().substr(-8,8) + ".eml"; // Last 8 chars of the time } else { if (str=="") { str = "Untitled"; } else { str = str.replace(/[\s_]+/g,"_").replace(/[^a-zA-Z0-9_\-]+/g,'').replace(/_+/g,"_"); } var suffix = "_" + t + ".eml"; fn += str.substr(0, basenameLenLimit - suffix.length) + suffix; } return fn; } //----------------------------------------------------------------------------- function setEditorDisabled(flag) { var val = flag ? "true" : "false"; var list = new Array( 'exteditor_bt' , 'cmd_sendNow' , 'cmd_sendLater' , 'cmd_sendButton' , 'cmd_sendWithCheck' , 'cmd_print' , 'cmd_saveDefault' , 'cmd_saveAsFile' , 'cmd_saveAsTemplate' , 'cmd_spelling' , 'menu_Edit' ); for (var i = 0; i undefined if (elt!=undefined) { elt.setAttribute("disabled", val); } } list = new Array( 'content-frame' , 'addressingWidget' , 'msgSubject' ); for (var i = 0; i undefined if (elt!=undefined) { elt.setAttribute("collapsed", val); } } isEditorDisabled = flag; } //----------------------------------------------------------------------------- function initButton(editorExe, editHtmlAsHtml) { var editorName; if (/notepad/.test(editorExe)) { editorName = "Notepad"; } else if (/nedit/.test(editorExe)) { editorName = "NEdit"; } else if (/emacs/.test(editorExe)) { editorName = "Emacs"; } else if (/gvim/.test(editorExe)) { editorName = "Gvim"; } else if (/vim/.test(editorExe)) { editorName = "Vim"; } else if (/vi/.test(editorExe)) { editorName = "Vi"; } else { editorName= editorExe.substring(editorExe.lastIndexOf(dirSeparator)+1, editorExe.length); editorName = editorName.replace(/"/g, ""); if (osType=="win") { editorName = editorName.replace(/\.(exe|EXE)$/, ""); } } var bt = document.getElementById('exteditor_bt'); // The External editor button has not been drag'n dropped // in the messenger compose window toolbar. // The user may prefer typing Ctrl-E and not see the button... if (bt!=undefined) { bt.setAttribute("label", editorName); // Hide or show the HTML dropdown menu if (IsHTMLEditor()) { bt.setAttribute("type", "menu-button"); } else { bt.removeAttribute("type"); } // select the item menu according to the preference if (editHtmlAsHtml!=undefined) { document.getElementById('exteditor_editAsHtml').setAttribute('checked', editHtmlAsHtml); document.getElementById('exteditor_editAsPlain').setAttribute('checked', ! editHtmlAsHtml); } } } //----------------------------------------------------------------------------- function isEditAsHtml() { // why is this checked attribute returned as a string rather than as a bool ??? return ( IsHTMLEditor() && document.getElementById('exteditor_editAsHtml').getAttribute('checked') == "true" ); } //----------------------------------------------------------------------------- function extEditorDeleteFile(filename) { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filename); if (file.exists()) { try { file.remove(false); } catch (e) { extEditorError(getLocaleString("CantDeleteFile") + " '" + file.path + "': " + e); } } } //----------------------------------------------------------------------------- function extEditorWriteFile(data, isUnicode, filename) { try { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filename); try { /* raises an error if the file already exists */ file.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0600); } catch (e) { extEditorError(getLocaleString("CantCreateTmpFile") + " '" + filename + "': " + e); return false; } if (isUnicode) { var uc = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance(Components.interfaces.nsIScriptableUnicodeConverter); uc.charset = "UTF-8"; var data = uc.ConvertFromUnicode(data); } var stream = Components.classes["@mozilla.org/network/file-output-stream;1"]. createInstance(Components.interfaces.nsIFileOutputStream); var PR_WRONLY = 0x02; stream.init(file, PR_WRONLY, 0600, 0); stream.write(data, data.length); stream.flush() stream.close(); } catch (e) { extEditorError(getLocaleString("CantWriteFile") + " '" + filename + "': " + e); return false; } return true; } //----------------------------------------------------------------------------- function extEditorReadFile(filename, isUnicode) { var MODE_RDONLY = 0x01; var PERM_IRUSR = 00400; try { var file = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filename); if (file.exists() && file.isReadable()) { var is = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); is.init(file, MODE_RDONLY, PERM_IRUSR, 0); var sis = Components.classes["@mozilla.org/scriptableinputstream;1"]. createInstance(Components.interfaces.nsIScriptableInputStream); sis.init(is); var data = sis.read(sis.available()); sis.close(); is.close(); if (isUnicode) { var uc = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance(Components.interfaces.nsIScriptableUnicodeConverter); uc.charset = "UTF-8"; try { data = uc.ConvertToUnicode(data); } catch (e) { extEditorError(getLocaleString("CouldNotConvertFromUnicode")); } } return data; } else { extEditorError(getLocaleString("TmpFileDoesntExistOrNotReadable") + ": '" + filename + "'"); return null; } } catch (e) { extEditorError(getLocaleString("CantReadFile") + " '" + filename + "': " + e); } return null; } //----------------------------------------------------------------------------- function extEditorRunProgram(executable, args, observer) { if (executable == null) { return false; // no command is set } var list = analyzeCmdLine(executable); executable = list.shift().replace(/(^\s+)|(\s+$)/g,''); while(list.length>0) args.unshift(list.pop()); // Special handling of vb or java scripts if (osType=="win" && /\.(vbs|js)$/.test(executable)) { args.unshift(executable); executable = "wscript.exe"; } // replace any null or undefined value by an empty string for (i = 0; i < args.length; i++) { if (args[i]==null || args[i]==undefined) { args[i]=""; } } try { var exec = Components.classes["@mozilla.org/file/local;1"]. createInstance(Components.interfaces.nsILocalFile); var pr = Components.classes["@mozilla.org/process/util;1"]. createInstance(Components.interfaces.nsIProcess); // If executable is an absolute path, run it or fail. If not, then // look for it in $PATH. if (executable.indexOf(dirSeparator)!=-1) { exec.initWithPath(executable); if (! exec.exists()) { extEditorError(getLocaleString("ExeDoesntExist") + ": '" + executable + "'"); return false; } } else { try { var env = Components.classes["@mozilla.org/process/environment;1"]. getService(Components.interfaces.nsIEnvironment); var path = env.get("PATH").split(pathSeparator); var found = false; for (i = 0; i < path.length; i++) { try { exec.initWithPath(path[i]); exec.appendRelativePath(executable); if (exec.exists()) { found = true; break; } } catch (e) { // do nothing } } } catch (e) { // do nothing } if (!found) { extEditorError(getLocaleString("ExeNotInPath") + ": '" + executable + "'"); return false; } } pr.init(exec); pr.runAsync(args, args.length, observer); } catch (e) { extEditorError(getLocaleString("CantRunExe") + ": '" + executable + "' (args: " + args.join(" ") + "): " + e); return false; } return true; } //----------------------------------------------------------------------------- // Parses a cmd line and return a list of tokens: // - tokens are created from the line split on spaces // - spaces inside quotes don't split the line //----------------------------------------------------------------------------- function analyzeCmdLine(str) { var args = new Array; str = str.replace(/\s+/, " "); var quote = ""; var buffer = ""; for (var i=0; i< str.length; i++) { var car = str[i]; switch (car) { case "'": case '"': if (quote=="") { quote = car; } else { args.push(buffer); buffer = ""; quote = ""; } break; case " ": if (quote=="") { if (buffer!="") { args.push(buffer); buffer = ""; } } else { buffer += " "; } break; default: buffer += car; break; } } if (buffer!="") { args.push(buffer); buffer = ""; } return args; } //----------------------------------------------------------------------------- function printList(titre, array) { var msg = titre +"\nNb elements: " + array.length + "\n"; for (i = 0; i < array.length; i++) { msg += "\n" + i + ": " + array[i]; } extEditorError(msg); } exteditor/chrome/content/exteditor.png000066400000000000000000000031111317574213600205360ustar00rootroot00000000000000PNG  IHDR szzbKGDIDATxkT?1gN2I4b.h[EdihlŊ٥TF5LfL49gί6[q B8^<|f&''{.Rt:-> NKPq0 x]I$XE"C8CCCd2,ZVT*%=ϋn5kijjBUUhimm}* b{f70 ,BUըEAO,CQ[4ٲe B1^ķAV#VVV,  cRJqa5Pܹs)|<\J%0DUUZZZPUzNVh!zT۶q])%B$Inܸm['Tk)^Vi48C[[iia }<ϣ0Bj0gC8?娴/&JD|>/+ |>m]1 D"i_Ma(Bkk+\ϮPV8~?6}'!Y|Q@z"bJMꨭ0 f"Sm2OOɽx˪BvPbzXYޢXKXE:5^L7xsy42UhǎcǎѣGiiiYڶ(3OFY(4ukRw6'Qt@A.K* ^edb$18f3??ɞ4MaϰqsuFf&rSwo44\JAʹ)pVxux