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