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

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