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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. /*
  2. * Copyright (c) 2006-2017 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 java.time.LocalDateTime;
  52. import java.util.regex.PatternSyntaxException;
  53. import javax.inject.Inject;
  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 IRCProcessor {
  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. @Inject
  72. public ProcessMessage(final IRCParser parser, final PrefixModeManager prefixModeManager) {
  73. super(parser, "PRIVMSG", "NOTICE");
  74. this.prefixModeManager = prefixModeManager;
  75. }
  76. /**
  77. * Process PRIVMSGs and NOTICEs.
  78. * This horrible thing handles PRIVMSGs and NOTICES<br>
  79. * This inclues CTCPs and CTCPReplies<br>
  80. * It handles all 3 targets (Channel, Private, Unknown)<br>
  81. * Actions are handled here aswell separately from CTCPs.<br>
  82. * Each type has 5 Calls, making 15 callbacks handled here.
  83. *
  84. * @param date The LocalDateTime that this event occurred at.
  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 LocalDateTime 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. final IRCChannelClientInfo iChannelClient = iChannel.getChannelClient(token[0], true);
  204. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  205. if (isAction) {
  206. callChannelAction(date, iChannel, iChannelClient, sMessage, firstToken);
  207. } else {
  208. if (isCTCP) {
  209. callChannelCTCP(date, iChannel, iChannelClient, sCTCP, sMessage, firstToken);
  210. } else if (hasModePrefix) {
  211. callChannelModeMessage(date, modePrefix, iChannel, iChannelClient, sMessage, firstToken);
  212. } else {
  213. callChannelMessage(date, iChannel, iChannelClient, sMessage, firstToken);
  214. }
  215. }
  216. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  217. if (isCTCP) {
  218. callChannelCTCPReply(date, iChannel, iChannelClient, sCTCP, sMessage, firstToken);
  219. } else if (hasModePrefix) {
  220. callChannelModeNotice(date, modePrefix, iChannel, iChannelClient, sMessage, firstToken);
  221. } else {
  222. callChannelNotice(date, iChannel, iChannelClient, sMessage, firstToken);
  223. }
  224. }
  225. } else if (parser.getStringConverter().equalsIgnoreCase(token[2], parser.getMyNickname())) {
  226. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  227. if (isAction) {
  228. callPrivateAction(date, sMessage, firstToken);
  229. } else {
  230. if (isCTCP) {
  231. callPrivateCTCP(date, sCTCP, sMessage, firstToken);
  232. } else {
  233. callPrivateMessage(date, sMessage, firstToken);
  234. }
  235. }
  236. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  237. if (isCTCP) {
  238. callPrivateCTCPReply(date, sCTCP, sMessage, firstToken);
  239. } else {
  240. if (firstToken.indexOf('@') == -1) {
  241. callServerNotice(date, sMessage, firstToken);
  242. } else {
  243. callPrivateNotice(date, sMessage, firstToken);
  244. }
  245. }
  246. }
  247. } else {
  248. callDebugInfo(IRCParser.DEBUG_INFO, "Message for Other (%s)", token[2]);
  249. if ("PRIVMSG".equalsIgnoreCase(sParam)) {
  250. if (isAction) {
  251. callUnknownAction(date, sMessage, token[2], firstToken);
  252. } else {
  253. if (isCTCP) {
  254. callUnknownCTCP(date, sCTCP, sMessage, token[2], firstToken);
  255. } else {
  256. callUnknownMessage(date, sMessage, token[2], firstToken);
  257. }
  258. }
  259. } else if ("NOTICE".equalsIgnoreCase(sParam)) {
  260. if (isCTCP) {
  261. callUnknownCTCPReply(date, sCTCP, sMessage, token[2], firstToken);
  262. } else {
  263. if (firstToken.indexOf('@') == -1) {
  264. callUnknownServerNotice(date, sMessage, token[2], firstToken);
  265. } else {
  266. callUnknownNotice(date, sMessage, token[2], firstToken);
  267. }
  268. }
  269. }
  270. }
  271. }
  272. /**
  273. * Callback to all objects implementing the ChannelAction Callback.
  274. *
  275. * @param date The date of this line
  276. * @param cChannel Channel where the action was sent to
  277. * @param cChannelClient ChannelClient who sent the action (may be null if server)
  278. * @param sMessage action contents
  279. * @param sHost Hostname of sender (or servername)
  280. */
  281. protected void callChannelAction(final LocalDateTime date, final ChannelInfo cChannel,
  282. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  283. getCallbackManager().publish(
  284. new ChannelActionEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  285. }
  286. /**
  287. * Callback to all objects implementing the ChannelCTCP Callback.
  288. *
  289. * @param date The date of this line
  290. * @param cChannel Channel where CTCP was sent
  291. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  292. * @param sType Type of CTCP (VERSION, TIME etc)
  293. * @param sMessage Additional contents
  294. * @param sHost Hostname of sender (or servername)
  295. */
  296. protected void callChannelCTCP(final LocalDateTime date, final ChannelInfo cChannel,
  297. final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
  298. final String sHost) {
  299. getCallbackManager().publish(
  300. new ChannelCTCPEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
  301. sHost));
  302. }
  303. /**
  304. * Callback to all objects implementing the ChannelCTCPReply Callback.
  305. *
  306. * @param date The date of this line
  307. * @param cChannel Channel where CTCPReply was sent
  308. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  309. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  310. * @param sMessage Reply Contents
  311. * @param sHost Hostname of sender (or servername)
  312. */
  313. protected void callChannelCTCPReply(final LocalDateTime date, final ChannelInfo cChannel,
  314. final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
  315. final String sHost) {
  316. getCallbackManager().publish(
  317. new ChannelCTCPReplyEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
  318. sHost));
  319. }
  320. /**
  321. * Callback to all objects implementing the ChannelMessage Callback.
  322. *
  323. * @param date The date of this line
  324. * @param cChannel Channel where the message was sent to
  325. * @param cChannelClient ChannelClient who sent the message (may be null if server)
  326. * @param sMessage Message contents
  327. * @param sHost Hostname of sender (or servername)
  328. */
  329. protected void callChannelMessage(final LocalDateTime date, final ChannelInfo cChannel,
  330. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  331. getCallbackManager().publish(
  332. new ChannelMessageEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  333. }
  334. /**
  335. * Callback to all objects implementing the ChannelNotice Callback.
  336. *
  337. * @param date The date of this line
  338. * @param cChannel Channel where the notice was sent to
  339. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  340. * @param sMessage notice contents
  341. * @param sHost Hostname of sender (or servername)
  342. */
  343. protected void callChannelNotice(final LocalDateTime date, final ChannelInfo cChannel,
  344. final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
  345. getCallbackManager().publish(
  346. new ChannelNoticeEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
  347. }
  348. /**
  349. * Callback to all objects implementing the ChannelModeNotice Callback.
  350. *
  351. * @param date The date of this line
  352. * @param prefix Prefix that was used to send this notice.
  353. * @param cChannel Channel where the notice was sent to
  354. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  355. * @param sMessage notice contents
  356. * @param sHost Hostname of sender (or servername)
  357. */
  358. protected void callChannelModeNotice(final LocalDateTime date, final char prefix,
  359. final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
  360. final String sMessage, final String sHost) {
  361. getCallbackManager().publish(
  362. new ChannelModeNoticeEvent(parser, date, cChannel, prefix, cChannelClient, sMessage,
  363. sHost));
  364. }
  365. /**
  366. * Callback to all objects implementing the ChannelModeMessage Callback.
  367. *
  368. * @param date The date of this line
  369. * @param prefix Prefix that was used to send this notice.
  370. * @param cChannel Channel where the notice was sent to
  371. * @param cChannelClient ChannelClient who sent the notice (may be null if server)
  372. * @param sMessage message contents
  373. * @param sHost Hostname of sender (or servername)
  374. */
  375. protected void callChannelModeMessage(final LocalDateTime date, final char prefix,
  376. final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
  377. final String sMessage, final String sHost) {
  378. getCallbackManager().publish(
  379. new ChannelModeMessageEvent(parser, date, cChannel, prefix, cChannelClient,
  380. sMessage, sHost));
  381. }
  382. /**
  383. * Callback to all objects implementing the PrivateAction Callback.
  384. *
  385. * @param date The date of this line
  386. * @param sMessage action contents
  387. * @param sHost Hostname of sender (or servername)
  388. */
  389. protected void callPrivateAction(final LocalDateTime date, final String sMessage,
  390. 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 LocalDateTime date, final String sType,
  402. final String sMessage, 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 LocalDateTime date, final String sType,
  414. final String sMessage, 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 LocalDateTime date, final String sMessage,
  426. final String sHost) {
  427. getCallbackManager().publish(new PrivateMessageEvent(parser, date, sMessage, sHost));
  428. }
  429. /**
  430. * Callback to all objects implementing the PrivateNotice Callback.
  431. *
  432. * @param date The date of this line
  433. * @param sMessage Notice contents
  434. * @param sHost Hostname of sender (or servername)
  435. */
  436. protected void callPrivateNotice(final LocalDateTime date, final String sMessage,
  437. 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 LocalDateTime date, final String sMessage,
  448. 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 LocalDateTime date, final String sMessage,
  460. final String sTarget, 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 LocalDateTime date, final String sType,
  473. final String sMessage, 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 LocalDateTime date, final String sType,
  487. final String sMessage, 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 LocalDateTime date, final String sMessage,
  500. final String sTarget, 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 LocalDateTime date, final String sMessage,
  513. final String sTarget, final String sHost) {
  514. getCallbackManager().publish(new UnknownNoticeEvent(parser, date, sMessage, sTarget,
  515. sHost));
  516. }
  517. /**
  518. * Callback to all objects implementing the UnknownNotice Callback.
  519. *
  520. * @param date The date of this line
  521. * @param sMessage Notice contents
  522. * @param sTarget Actual target of notice
  523. * @param sHost Hostname of sender (or servername)
  524. */
  525. protected void callUnknownServerNotice(final LocalDateTime date, final String sMessage,
  526. final String sTarget, final String sHost) {
  527. getCallbackManager().publish(
  528. new UnknownServerNoticeEvent(parser, date, sMessage, sTarget, sHost));
  529. }
  530. }