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.

ProcessMessage.java 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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.parser.irc.processors;
  23. import com.dmdirc.parser.common.ParserError;
  24. import com.dmdirc.parser.events.ChannelActionEvent;
  25. import com.dmdirc.parser.events.ChannelCTCPEvent;
  26. import com.dmdirc.parser.events.ChannelCTCPReplyEvent;
  27. import com.dmdirc.parser.events.ChannelMessageEvent;
  28. import com.dmdirc.parser.events.ChannelModeMessageEvent;
  29. import com.dmdirc.parser.events.ChannelModeNoticeEvent;
  30. import com.dmdirc.parser.events.ChannelNoticeEvent;
  31. import com.dmdirc.parser.events.PrivateActionEvent;
  32. import com.dmdirc.parser.events.PrivateCTCPEvent;
  33. import com.dmdirc.parser.events.PrivateCTCPReplyEvent;
  34. import com.dmdirc.parser.events.PrivateMessageEvent;
  35. import com.dmdirc.parser.events.PrivateNoticeEvent;
  36. import com.dmdirc.parser.events.ServerNoticeEvent;
  37. import com.dmdirc.parser.events.UnknownActionEvent;
  38. import com.dmdirc.parser.events.UnknownCTCPEvent;
  39. import com.dmdirc.parser.events.UnknownCTCPReplyEvent;
  40. import com.dmdirc.parser.events.UnknownMessageEvent;
  41. import com.dmdirc.parser.events.UnknownNoticeEvent;
  42. import com.dmdirc.parser.events.UnknownServerNoticeEvent;
  43. import com.dmdirc.parser.interfaces.ChannelClientInfo;
  44. import com.dmdirc.parser.interfaces.ChannelInfo;
  45. import com.dmdirc.parser.interfaces.callbacks.ChannelActionListener;
  46. import com.dmdirc.parser.interfaces.callbacks.ChannelCtcpListener;
  47. import com.dmdirc.parser.interfaces.callbacks.ChannelCtcpReplyListener;
  48. import com.dmdirc.parser.interfaces.callbacks.ChannelMessageListener;
  49. import com.dmdirc.parser.interfaces.callbacks.ChannelModeMessageListener;
  50. import com.dmdirc.parser.interfaces.callbacks.ChannelModeNoticeListener;
  51. import com.dmdirc.parser.interfaces.callbacks.ChannelNoticeListener;
  52. import com.dmdirc.parser.interfaces.callbacks.PrivateActionListener;
  53. import com.dmdirc.parser.interfaces.callbacks.PrivateCtcpListener;
  54. import com.dmdirc.parser.interfaces.callbacks.PrivateCtcpReplyListener;
  55. import com.dmdirc.parser.interfaces.callbacks.PrivateMessageListener;
  56. import com.dmdirc.parser.interfaces.callbacks.PrivateNoticeListener;
  57. import com.dmdirc.parser.interfaces.callbacks.ServerNoticeListener;
  58. import com.dmdirc.parser.interfaces.callbacks.UnknownActionListener;
  59. import com.dmdirc.parser.interfaces.callbacks.UnknownCtcpListener;
  60. import com.dmdirc.parser.interfaces.callbacks.UnknownCtcpReplyListener;
  61. import com.dmdirc.parser.interfaces.callbacks.UnknownMessageListener;
  62. import com.dmdirc.parser.interfaces.callbacks.UnknownNoticeListener;
  63. import com.dmdirc.parser.interfaces.callbacks.UnknownServerNoticeListener;
  64. import com.dmdirc.parser.irc.IRCChannelClientInfo;
  65. import com.dmdirc.parser.irc.IRCChannelInfo;
  66. import com.dmdirc.parser.irc.IRCClientInfo;
  67. import com.dmdirc.parser.irc.IRCParser;
  68. import com.dmdirc.parser.irc.PrefixModeManager;
  69. import com.dmdirc.parser.irc.ProcessingManager;
  70. import com.dmdirc.parser.irc.ProcessorNotFoundException;
  71. import com.dmdirc.parser.irc.TimestampedIRCProcessor;
  72. import java.util.Date;
  73. import java.util.regex.PatternSyntaxException;
  74. /**
  75. * Process PRIVMSGs and NOTICEs.
  76. * This horrible handles PRIVMSGs and NOTICE<br>
  77. * This inclues CTCPs and CTCPReplies<br>
  78. * It handles all 3 targets (Channel, Private, Unknown)<br>
  79. * Actions are handled here aswell separately from CTCPs.<br>
  80. * Each type has 5 Calls, making 15 callbacks handled here.
  81. */
  82. public class ProcessMessage extends TimestampedIRCProcessor {
  83. /** The manager to use to access prefix modes. */
  84. private final PrefixModeManager prefixModeManager;
  85. /**
  86. * Create a new instance of the IRCProcessor Object.
  87. *
  88. * @param parser IRCParser That owns this IRCProcessor
  89. * @param prefixModeManager The manager to use to access prefix modes.
  90. * @param manager ProcessingManager that is in charge of this IRCProcessor
  91. */
  92. public ProcessMessage(final IRCParser parser, final PrefixModeManager prefixModeManager,
  93. final ProcessingManager manager) {
  94. super(parser, manager, "PRIVMSG", "NOTICE");
  95. this.prefixModeManager = prefixModeManager;
  96. }
  97. /**
  98. * Process PRIVMSGs and NOTICEs.
  99. * This horrible thing handles PRIVMSGs and NOTICES<br>
  100. * This inclues CTCPs and CTCPReplies<br>
  101. * It handles all 3 targets (Channel, Private, Unknown)<br>
  102. * Actions are handled here aswell separately from CTCPs.<br>
  103. * Each type has 5 Calls, making 15 callbacks handled here.
  104. *
  105. * @param sParam Type of line to process ("NOTICE", "PRIVMSG")
  106. * @param token IRCTokenised line to process
  107. */
  108. @Override
  109. public void process(final Date date, final String sParam, final String... token) {
  110. // Ignore people!
  111. String sMessage;
  112. if (token[0].charAt(0) == ':') {
  113. sMessage = token[0].substring(1);
  114. } else {
  115. sMessage = token[0];
  116. }
  117. // We use sMessage to be the users host (first token in the line)
  118. try {
  119. if (parser.getIgnoreList().matches(sMessage) > -1) {
  120. return;
  121. }
  122. } catch (PatternSyntaxException pse) {
  123. final ParserError pe = new ParserError(ParserError.ERROR_WARNING + ParserError.ERROR_USER, "Error with ignore list regex: " + pse, parser.getLastLine());
  124. pe.setException(pse);
  125. callErrorInfo(pe);
  126. }
  127. // Lines such as:
  128. // "nick!user@host PRIVMSG"
  129. // are invalid, stop processing.
  130. if (token.length < 3) {
  131. return;
  132. }
  133. // Is this actually a notice auth?
  134. if (token[0].indexOf('!') == -1 && "NOTICE".equalsIgnoreCase(token[1]) &&
  135. "AUTH".equalsIgnoreCase(token[2])) {
  136. try {
  137. parser.getProcessingManager().process(date, "Notice Auth", token);
  138. } catch (ProcessorNotFoundException e) {
  139. }
  140. return;
  141. }
  142. // "nick!user@host PRIVMSG #Channel" should be processed as "nick!user@host PRIVMSG #Channel :"
  143. if (token.length < 4) {
  144. sMessage = "";
  145. } else {
  146. sMessage = token[token.length - 1];
  147. }
  148. String[] bits = sMessage.split(" ", 2);
  149. String sCTCP = "";
  150. boolean isAction = false;
  151. boolean isCTCP = false;
  152. if (sMessage.length() > 1) {
  153. // Actions are special CTCPs
  154. // Bits is the message been split into 2 parts
  155. // the first word and the rest
  156. final Character char1 = (char) 1;
  157. if ("PRIVMSG".equalsIgnoreCase(sParam) && bits[0].equalsIgnoreCase(char1 + "ACTION") && Character.valueOf(sMessage.charAt(sMessage.length() - 1)).equals(char1)) {
  158. isAction = true;
  159. if (bits.length > 1) {
  160. sMessage = bits[1];
  161. sMessage = sMessage.substring(0, sMessage.length() - 1);
  162. } else {
  163. sMessage = "";
  164. }
  165. }
  166. // If the message is not an action, check if it is another type of CTCP
  167. // CTCPs have Character(1) at the start/end of the line
  168. if (!isAction && Character.valueOf(sMessage.charAt(0)).equals(char1) && Character.valueOf(sMessage.charAt(sMessage.length() - 1)).equals(char1)) {
  169. isCTCP = true;
  170. // Bits is the message been split into 2 parts, the first word and the rest
  171. // Some CTCPs have messages and some do not
  172. if (bits.length > 1) {
  173. sMessage = bits[1];
  174. } else {
  175. sMessage = "";
  176. }
  177. // Remove the leading char1
  178. bits = bits[0].split(char1.toString(), 2);
  179. sCTCP = bits[1];
  180. // remove the trailing char1
  181. if (sMessage.isEmpty()) {
  182. sCTCP = sCTCP.split(char1.toString(), 2)[0];
  183. } else {
  184. sMessage = sMessage.split(char1.toString(), 2)[0];
  185. }
  186. callDebugInfo(IRCParser.DEBUG_INFO, "CTCP: \"%s\" \"%s\"",
  187. sCTCP, sMessage);
  188. }
  189. }
  190. // Remove the leading : from the host.
  191. final String firstToken;
  192. if (token[0].charAt(0) == ':' && token[0].length() > 1) {
  193. firstToken = token[0].substring(1);
  194. } else {
  195. firstToken = token[0];
  196. }
  197. final IRCClientInfo iClient = getClientInfo(token[0]);
  198. // Facilitate DMDIRC Formatter
  199. if (IRCParser.ALWAYS_UPDATECLIENT && iClient != null && iClient.getHostname().isEmpty()) {
  200. iClient.setUserBits(firstToken, false);
  201. }
  202. // Fire the appropriate callbacks.
  203. // OnChannel* Callbacks are fired if the target was a channel
  204. // OnPrivate* Callbacks are fired if the target was us
  205. // OnUnknown* Callbacks are fired if the target was neither of the above
  206. // Actions and CTCPs are send as PRIVMSGS
  207. // CTCPReplies are sent as Notices
  208. // Check if we have a Mode Prefix for channel targets.
  209. // Non-Channel messages still use the whole token, even if the first char
  210. // is a prefix.
  211. // CTCP and CTCPReplies that are aimed at a channel with a prefix are
  212. // handled as if the prefix wasn't used. This can be changed in the future
  213. // if desired.
  214. final char modePrefix = token[2].charAt(0);
  215. final boolean hasModePrefix = prefixModeManager.isPrefix(modePrefix);
  216. final String targetName = hasModePrefix ? token[2].substring(1) : token[2];
  217. if (isValidChannelName(targetName)) {
  218. final IRCChannelInfo iChannel = getChannel(targetName);
  219. if (iChannel == null) {
  220. // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got message for channel ("+targetName+") that I am not on.", parser.getLastLine()));
  221. return;
  222. }
  223. IRCChannelClientInfo iChannelClient = null;
  224. if (iClient != null) {
  225. iChannelClient = iChannel.getChannelClient(iClient);
  226. }
  227. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  228. if (isAction) {
  229. callChannelAction(date, iChannel, iChannelClient, sMessage, firstToken);
  230. } else {
  231. if (isCTCP) {
  232. callChannelCTCP(date, iChannel, iChannelClient, sCTCP, sMessage, firstToken);
  233. } else if (hasModePrefix) {
  234. callChannelModeMessage(date, modePrefix, iChannel, iChannelClient, sMessage, firstToken);
  235. } else {
  236. callChannelMessage(date, iChannel, iChannelClient, sMessage, firstToken);
  237. }
  238. }
  239. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  240. if (isCTCP) {
  241. callChannelCTCPReply(date, iChannel, iChannelClient, sCTCP, sMessage, firstToken);
  242. } else if (hasModePrefix) {
  243. callChannelModeNotice(date, modePrefix, iChannel, iChannelClient, sMessage, firstToken);
  244. } else {
  245. callChannelNotice(date, iChannel, iChannelClient, sMessage, firstToken);
  246. }
  247. }
  248. } else if (parser.getStringConverter().equalsIgnoreCase(token[2], parser.getMyNickname())) {
  249. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  250. if (isAction) {
  251. callPrivateAction(date, sMessage, firstToken);
  252. } else {
  253. if (isCTCP) {
  254. callPrivateCTCP(date, sCTCP, sMessage, firstToken);
  255. } else {
  256. callPrivateMessage(date, sMessage, firstToken);
  257. }
  258. }
  259. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  260. if (isCTCP) {
  261. callPrivateCTCPReply(date, sCTCP, sMessage, firstToken);
  262. } else {
  263. if (firstToken.indexOf('@') == -1) {
  264. callServerNotice(date, sMessage, firstToken);
  265. } else {
  266. callPrivateNotice(date, sMessage, firstToken);
  267. }
  268. }
  269. }
  270. } else {
  271. callDebugInfo(IRCParser.DEBUG_INFO, "Message for Other (" + token[2] + ')');
  272. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  273. if (isAction) {
  274. callUnknownAction(date, sMessage, token[2], firstToken);
  275. } else {
  276. if (isCTCP) {
  277. callUnknownCTCP(date, sCTCP, sMessage, token[2], firstToken);
  278. } else {
  279. callUnknownMessage(date, sMessage, token[2], firstToken);
  280. }
  281. }
  282. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  283. if (isCTCP) {
  284. callUnknownCTCPReply(date, sCTCP, sMessage, token[2], firstToken);
  285. } else {
  286. if (firstToken.indexOf('@') == -1) {
  287. callUnknownServerNotice(date, sMessage, token[2], firstToken);
  288. } else {
  289. callUnknownNotice(date, sMessage, token[2], firstToken);
  290. }
  291. }
  292. }
  293. }
  294. }
  295. /**
  296. * Callback to all objects implementing the ChannelAction Callback.
  297. *
  298. * @see ChannelActionListener
  299. * @param date The date of this line
  300. * @param cChannel Channel where the action was sent to
  301. * @param cChannelClient ChannelClient who sent the action (may be null if server)
  302. * @param sMessage action contents
  303. * @param sHost Hostname of sender (or servername)
  304. */
  305. protected void callChannelAction(final Date date, final ChannelInfo cChannel,
  306. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  307. getCallbackManager().publish(
  308. new ChannelActionEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  309. }
  310. /**
  311. * Callback to all objects implementing the ChannelCTCP Callback.
  312. *
  313. * @see ChannelCtcpListener
  314. * @param date The date of this line
  315. * @param cChannel Channel where CTCP was sent
  316. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  317. * @param sType Type of CTCP (VERSION, TIME etc)
  318. * @param sMessage Additional contents
  319. * @param sHost Hostname of sender (or servername)
  320. */
  321. protected void callChannelCTCP(final Date date, final ChannelInfo cChannel,
  322. final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
  323. final String sHost) {
  324. getCallbackManager().publish(
  325. new ChannelCTCPEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
  326. sHost));
  327. }
  328. /**
  329. * Callback to all objects implementing the ChannelCTCPReply Callback.
  330. *
  331. * @see ChannelCtcpReplyListener
  332. * @param date The date of this line
  333. * @param cChannel Channel where CTCPReply was sent
  334. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  335. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  336. * @param sMessage Reply Contents
  337. * @param sHost Hostname of sender (or servername)
  338. */
  339. protected void callChannelCTCPReply(final Date date, final ChannelInfo cChannel,
  340. final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
  341. final String sHost) {
  342. getCallbackManager().publish(
  343. new ChannelCTCPReplyEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
  344. sHost));
  345. }
  346. /**
  347. * Callback to all objects implementing the ChannelMessage Callback.
  348. *
  349. * @see ChannelMessageListener
  350. * @param date The date of this line
  351. * @param cChannel Channel where the message was sent to
  352. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  353. * @param sMessage Message contents
  354. * @param sHost Hostname of sender (or servername)
  355. */
  356. protected void callChannelMessage(final Date date, final ChannelInfo cChannel,
  357. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  358. getCallbackManager().publish(
  359. new ChannelMessageEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  360. }
  361. /**
  362. * Callback to all objects implementing the ChannelNotice Callback.
  363. *
  364. * @see ChannelNoticeListener
  365. * @param date The date of this line
  366. * @param cChannel Channel where the notice was sent to
  367. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  368. * @param sMessage notice contents
  369. * @param sHost Hostname of sender (or servername)
  370. */
  371. protected void callChannelNotice(final Date date, final ChannelInfo cChannel,
  372. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  373. getCallbackManager().publish(
  374. new ChannelNoticeEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  375. }
  376. /**
  377. * Callback to all objects implementing the ChannelModeNotice Callback.
  378. *
  379. * @see ChannelModeNoticeListener
  380. * @param date The date of this line
  381. * @param prefix Prefix that was used to send this notice.
  382. * @param cChannel Channel where the notice was sent to
  383. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  384. * @param sMessage notice contents
  385. * @param sHost Hostname of sender (or servername)
  386. */
  387. protected void callChannelModeNotice(final Date date, final char prefix,
  388. final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
  389. final String sMessage, final String sHost) {
  390. getCallbackManager().publish(
  391. new ChannelModeNoticeEvent(parser, date, cChannel, prefix, cChannelClient, sMessage,
  392. sHost));
  393. }
  394. /**
  395. * Callback to all objects implementing the ChannelModeMessage Callback.
  396. *
  397. * @see ChannelModeMessageListener
  398. * @param date The date of this line
  399. * @param prefix Prefix that was used to send this notice.
  400. * @param cChannel Channel where the notice was sent to
  401. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  402. * @param sMessage message contents
  403. * @param sHost Hostname of sender (or servername)
  404. */
  405. protected void callChannelModeMessage(final Date date, final char prefix,
  406. final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
  407. final String sMessage, final String sHost) {
  408. getCallbackManager().publish(
  409. new ChannelModeMessageEvent(parser, date, cChannel, prefix, cChannelClient,
  410. sMessage, sHost));
  411. }
  412. /**
  413. * Callback to all objects implementing the PrivateAction Callback.
  414. *
  415. * @see PrivateActionListener
  416. * @param date The date of this line
  417. * @param sMessage action contents
  418. * @param sHost Hostname of sender (or servername)
  419. */
  420. protected void callPrivateAction(final Date date, final String sMessage, final String sHost) {
  421. getCallbackManager().publish(new PrivateActionEvent(parser, date, sMessage, sHost));
  422. }
  423. /**
  424. * Callback to all objects implementing the PrivateCTCP Callback.
  425. *
  426. * @see PrivateCtcpListener
  427. * @param date The date of this line
  428. * @param sType Type of CTCP (VERSION, TIME etc)
  429. * @param sMessage Additional contents
  430. * @param sHost Hostname of sender (or servername)
  431. */
  432. protected void callPrivateCTCP(final Date date, final String sType, final String sMessage,
  433. final String sHost) {
  434. getCallbackManager().publish(new PrivateCTCPEvent(parser, date, sType, sMessage, sHost));
  435. }
  436. /**
  437. * Callback to all objects implementing the PrivateCTCPReply Callback.
  438. *
  439. * @see PrivateCtcpReplyListener
  440. * @param date The date of this line
  441. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  442. * @param sMessage Reply Contents
  443. * @param sHost Hostname of sender (or servername)
  444. */
  445. protected void callPrivateCTCPReply(final Date date, final String sType, final String sMessage,
  446. final String sHost) {
  447. getCallbackManager().publish(
  448. new PrivateCTCPReplyEvent(parser, date, sType, sMessage, sHost));
  449. }
  450. /**
  451. * Callback to all objects implementing the PrivateMessage Callback.
  452. *
  453. * @see PrivateMessageListener
  454. * @param date The date of this line
  455. * @param sMessage Message contents
  456. * @param sHost Hostname of sender (or servername)
  457. */
  458. protected void callPrivateMessage(final Date date, final String sMessage, final String sHost) {
  459. getCallbackManager().publish(new PrivateMessageEvent(parser, date, sMessage, sHost));
  460. }
  461. /**
  462. * Callback to all objects implementing the PrivateNotice Callback.
  463. *
  464. * @see PrivateNoticeListener
  465. * @param date The date of this line
  466. * @param sMessage Notice contents
  467. * @param sHost Hostname of sender (or servername)
  468. */
  469. protected void callPrivateNotice(final Date date, final String sMessage, final String sHost) {
  470. getCallbackManager().publish(new PrivateNoticeEvent(parser, date, sMessage, sHost));
  471. }
  472. /**
  473. * Callback to all objects implementing the ServerNotice Callback.
  474. *
  475. * @see ServerNoticeListener
  476. * @param date The date of this line
  477. * @param sMessage Notice contents
  478. * @param sHost Hostname of sender (or servername)
  479. */
  480. protected void callServerNotice(final Date date, final String sMessage, final String sHost) {
  481. getCallbackManager().publish(new ServerNoticeEvent(parser, date, sMessage, sHost));
  482. }
  483. /**
  484. * Callback to all objects implementing the UnknownAction Callback.
  485. *
  486. * @see UnknownActionListener
  487. * @param date The date of this line
  488. * @param sMessage Action contents
  489. * @param sTarget Actual target of action
  490. * @param sHost Hostname of sender (or servername)
  491. */
  492. protected void callUnknownAction(final Date date, final String sMessage, final String sTarget,
  493. final String sHost) {
  494. getCallbackManager().publish(new UnknownActionEvent(parser, date, sMessage, sTarget, sHost));
  495. }
  496. /**
  497. * Callback to all objects implementing the UnknownCTCP Callback.
  498. *
  499. * @see UnknownCtcpListener
  500. * @param date The date of this line
  501. * @param sType Type of CTCP (VERSION, TIME etc)
  502. * @param sMessage Additional contents
  503. * @param sTarget Actual Target of CTCP
  504. * @param sHost Hostname of sender (or servername)
  505. */
  506. protected void callUnknownCTCP(final Date date, final String sType, final String sMessage,
  507. final String sTarget, final String sHost) {
  508. getCallbackManager().publish(
  509. new UnknownCTCPEvent(parser, date, sType, sMessage, sTarget, sHost));
  510. }
  511. /**
  512. * Callback to all objects implementing the UnknownCTCPReply Callback.
  513. *
  514. * @see UnknownCtcpReplyListener
  515. * @param date The date of this line
  516. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  517. * @param sMessage Reply Contents
  518. * @param sTarget Actual Target of CTCPReply
  519. * @param sHost Hostname of sender (or servername)
  520. */
  521. protected void callUnknownCTCPReply(final Date date, final String sType, final String sMessage,
  522. final String sTarget, final String sHost) {
  523. getCallbackManager().publish(
  524. new UnknownCTCPReplyEvent(parser, date, sType, sMessage, sTarget, sHost));
  525. }
  526. /**
  527. * Callback to all objects implementing the UnknownMessage Callback.
  528. *
  529. * @see UnknownMessageListener
  530. * @param date The date of this line
  531. * @param sMessage Message contents
  532. * @param sTarget Actual target of message
  533. * @param sHost Hostname of sender (or servername)
  534. */
  535. protected void callUnknownMessage(final Date date, final String sMessage, final String sTarget,
  536. final String sHost) {
  537. getCallbackManager().publish(
  538. new UnknownMessageEvent(parser, date, sMessage, sTarget, sHost));
  539. }
  540. /**
  541. * Callback to all objects implementing the UnknownNotice Callback.
  542. *
  543. * @see UnknownNoticeListener
  544. * @param date The date of this line
  545. * @param sMessage Notice contents
  546. * @param sTarget Actual target of notice
  547. * @param sHost Hostname of sender (or servername)
  548. */
  549. protected void callUnknownNotice(final Date date, final String sMessage, final String sTarget,
  550. final String sHost) {
  551. getCallbackManager().publish(new UnknownNoticeEvent(parser, date, sMessage, sTarget, sHost));
  552. }
  553. /**
  554. * Callback to all objects implementing the UnknownNotice Callback.
  555. *
  556. * @see UnknownServerNoticeListener
  557. * @param date The date of this line
  558. * @param sMessage Notice contents
  559. * @param sTarget Actual target of notice
  560. * @param sHost Hostname of sender (or servername)
  561. */
  562. protected void callUnknownServerNotice(final Date date, final String sMessage,
  563. final String sTarget, final String sHost) {
  564. getCallbackManager().publish(
  565. new UnknownServerNoticeEvent(parser, date, sMessage, sTarget, sHost));
  566. }
  567. }