home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / messenger.jar / content / messenger / SmtpServerEdit.js < prev    next >
Text File  |  2001-02-14  |  2KB  |  66 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  *
  13.  * The Original Code is Mozilla Communicator client code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape Communications
  16.  * Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  * Alec Flett <alecf@netscape.com>
  22.  */
  23.  
  24.  
  25. var smtpService;
  26. var smtpServer;
  27.  
  28. function onLoad(event)
  29. {
  30.  
  31.     if (!smtpService) {
  32.         smtpService =
  33.             Components.classes["@mozilla.org/messengercompose/smtp;1"].getService(Components.interfaces.nsISmtpService);
  34.     }
  35.  
  36.     var server = window.arguments[0].server;
  37.  
  38.     initializeDialog(server);
  39.  
  40.     doSetOKCancel(onOk, 0);
  41. }
  42.  
  43. function initializeDialog(server)
  44. {
  45.     smtpServer = server;
  46.  
  47.     initSmtpSettings(server);
  48. }
  49.  
  50. function onOk()
  51. {
  52.     // if we didn't have an SMTP server to initialize with,
  53.     // we must be creating one.
  54.     try {
  55.         if (!smtpServer)
  56.             smtpServer = smtpService.createSmtpServer();
  57.         
  58.         saveSmtpSettings(smtpServer);
  59.     } catch (ex) {
  60.         dump("Error saving smtp server: " + ex + "\n");
  61.     }
  62.  
  63.     window.arguments[0].result = true;
  64.     window.close();
  65. }
  66.