Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ServerEvents.java 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2006-2015 DMDirc Developers
  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.actions.metatypes;
  23. import com.dmdirc.interfaces.Connection;
  24. import com.dmdirc.interfaces.actions.ActionMetaType;
  25. import com.dmdirc.parser.interfaces.ClientInfo;
  26. /**
  27. * Defines server-related events.
  28. */
  29. public enum ServerEvents implements ActionMetaType {
  30. /** Server ping event type. */
  31. SERVER_PING(new String[]{"server", "ping"}, Connection.class, Long.class),
  32. /** Server numeric event type. */
  33. SERVER_NUMERIC(new String[]{"server", "numeric", "arguments"}, Connection.class, Integer.class,
  34. String[].class),
  35. /** Server event with argument. */
  36. SERVER_EVENT_WITH_ARG(new String[]{"server", "message"}, Connection.class, String.class),
  37. /** Server nick change. */
  38. SERVER_NICKCHANGE(new String[]{"server", "old nickname", "new nickname"}, Connection.class,
  39. String.class, String.class),
  40. /** Server event, with source and argument. */
  41. SERVER_SOURCED_EVENT_WITH_ARG(new String[]{"server", "user", "message"}, Connection.class,
  42. ClientInfo.class, String.class),
  43. /** Server CTCP event. */
  44. SERVER_CTCP_EVENT(new String[]{"server", "user", "type", "content"}, Connection.class,
  45. ClientInfo.class, String.class, String.class),
  46. /** Server event with argument. */
  47. SERVER_UNKNOWN_EVENT(new String[]{"server", "source", "target", "message"}, Connection.class,
  48. String.class, String.class, String.class),
  49. /** Server invite event. */
  50. SERVER_INVITE(new String[]{"server", "source", "channel"}, Connection.class, ClientInfo.class,
  51. String.class),
  52. /** Server event type. */
  53. SERVER_EVENT(new String[]{"server"}, Connection.class);
  54. /** The names of the arguments for this meta type. */
  55. private final String[] argNames;
  56. /** The classes of the arguments for this meta type. */
  57. private final Class<?>[] argTypes;
  58. /**
  59. * Creates a new instance of this meta-type.
  60. *
  61. * @param argNames The names of the meta-type's arguments
  62. * @param argTypes The types of the meta-type's arguments
  63. */
  64. ServerEvents(final String[] argNames, final Class<?>... argTypes) {
  65. this.argNames = argNames;
  66. this.argTypes = argTypes;
  67. }
  68. @Override
  69. public int getArity() {
  70. return argNames.length;
  71. }
  72. @Override
  73. public Class<?>[] getArgTypes() {
  74. return argTypes;
  75. }
  76. @Override
  77. public String[] getArgNames() {
  78. return argNames;
  79. }
  80. @Override
  81. public String getGroup() {
  82. return "Server/Private Events";
  83. }
  84. }