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 24KB

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