You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc;
  23. import com.dmdirc.actions.ActionManager;
  24. import com.dmdirc.actions.CoreActionType;
  25. import com.dmdirc.identities.IdentityManager;
  26. import com.dmdirc.plugins.PluginManager;
  27. import com.dmdirc.ui.MainFrame;
  28. import com.dmdirc.updater.UpdateChannel;
  29. import com.dmdirc.updater.UpdateChecker;
  30. /**
  31. * Main class, handles initialisation.
  32. * @author chris
  33. */
  34. public final class Main {
  35. /**
  36. * Stores the current textual program version.
  37. */
  38. public static final String VERSION = "0.4";
  39. /**
  40. * Stores the release date of this version.
  41. */
  42. public static final int RELEASE_DATE = 20070611;
  43. /**
  44. * Stores the update channel that this version came from, if any.
  45. */
  46. public static final UpdateChannel UPDATE_CHANNEL = UpdateChannel.STABLE;
  47. /**
  48. * Prevents creation of main.
  49. */
  50. private Main() {
  51. }
  52. /**
  53. * Entry procedure.
  54. * @param args the command line arguments
  55. */
  56. public static void main(final String[] args) {
  57. MainFrame.initUISettings();
  58. IdentityManager.load();
  59. ActionManager.init();
  60. PluginManager.getPluginManager();
  61. ActionManager.loadActions();
  62. MainFrame.getMainFrame();
  63. ActionManager.processEvent(CoreActionType.CLIENT_OPENED, null);
  64. UpdateChecker.init();
  65. }
  66. /**
  67. * Quits the client nicely.
  68. * @param reason The quit reason to send
  69. */
  70. public static void quit(final String reason) {
  71. ActionManager.processEvent(CoreActionType.CLIENT_CLOSED, null);
  72. ServerManager.getServerManager().disconnectAll(reason);
  73. Config.save();
  74. System.exit(0);
  75. }
  76. /**
  77. * Quits the client nicely, with the default closing message.
  78. */
  79. public static void quit() {
  80. quit(Config.getOption("general", "closemessage"));
  81. }
  82. }