Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

DCCEvents.java 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2006-2010 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.addons.dcc.actions;
  23. import com.dmdirc.Server;
  24. import com.dmdirc.actions.interfaces.ActionMetaType;
  25. import com.dmdirc.addons.dcc.DCCChatWindow;
  26. import com.dmdirc.addons.dcc.DCCSendWindow;
  27. import java.io.File;
  28. /**
  29. * Defines DCC-related events.
  30. *
  31. * @author Chris
  32. */
  33. public enum DCCEvents implements ActionMetaType {
  34. /** DCC Chat Request. */
  35. DCC_CHAT_REQUEST(new String[]{"server", "client"}, Server.class, String.class),
  36. /** DCC Chat Request Sent. */
  37. DCC_CHAT_REQUEST_SENT(new String[]{"server", "client"}, Server.class, String.class),
  38. /** DCC Message from another person. */
  39. DCC_CHAT_MESSAGE(new String[]{"DCCChatWindow", "Nickname", "Message"}, DCCChatWindow.class, String.class, String.class),
  40. /** DCC Message to another person. */
  41. DCC_CHAT_SELFMESSAGE(new String[]{"DCCChatWindow", "Message"}, DCCChatWindow.class, String.class),
  42. /** DCC Chat Socket Closed. */
  43. DCC_CHAT_SOCKETCLOSED(new String[]{"DCCChatWindow"}, DCCChatWindow.class),
  44. /** DCC Chat Socket Opened. */
  45. DCC_CHAT_SOCKETOPENED(new String[]{"DCCChatWindow"}, DCCChatWindow.class),
  46. /** DCC Send Socket Closed. */
  47. DCC_SEND_SOCKETCLOSED(new String[]{"DCCSendWindow"}, DCCSendWindow.class),
  48. /** DCC Send Socket Opened. */
  49. DCC_SEND_SOCKETOPENED(new String[]{"DCCSendWindow"}, DCCSendWindow.class),
  50. /** DCC Send Data Transfered */
  51. DCC_SEND_DATATRANSFERED(new String[]{"DCCSendWindow", "Bytes Transfered"}, DCCSendWindow.class, int.class),
  52. /** DCC Send Request. */
  53. DCC_SEND_REQUEST(new String[]{"server", "client", "file"}, Server.class, String.class, String.class),
  54. /** DCC Send Request Sent. */
  55. DCC_SEND_REQUEST_SENT(new String[]{"server", "client", "file"}, Server.class, String.class, File.class);
  56. /** The names of the arguments for this meta type. */
  57. private String[] argNames;
  58. /** The classes of the arguments for this meta type. */
  59. private Class[] argTypes;
  60. /**
  61. * Creates a new instance of this meta-type.
  62. *
  63. * @param argNames The names of the meta-type's arguments
  64. * @param argTypes The types of the meta-type's arguments
  65. */
  66. DCCEvents(final String[] argNames, final Class... argTypes) {
  67. this.argNames = argNames;
  68. this.argTypes = argTypes;
  69. }
  70. /** {@inheritDoc} */
  71. @Override
  72. public int getArity() {
  73. return argNames.length;
  74. }
  75. /** {@inheritDoc} */
  76. @Override
  77. public Class[] getArgTypes() {
  78. return argTypes;
  79. }
  80. /** {@inheritDoc} */
  81. @Override
  82. public String[] getArgNames() {
  83. return argNames;
  84. }
  85. /** {@inheritDoc} */
  86. @Override
  87. public String getGroup() {
  88. return "DCC Events";
  89. }
  90. }