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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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 com.dmdirc.parser.irc.TimestampedIRCProcessor;
  52. import java.time.LocalDateTime;
  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 date The LocalDateTime that this event occurred at.
  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 LocalDateTime 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. final IRCChannelClientInfo iChannelClient = iChannel.getChannelClient(token[0], true);
  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 LocalDateTime 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 LocalDateTime 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 LocalDateTime 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 LocalDateTime 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 LocalDateTime 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 LocalDateTime 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 LocalDateTime 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 LocalDateTime date, final String sMessage,
  391. final String sHost) {
  392. getCallbackManager().publish(new PrivateActionEvent(parser, date, sMessage, sHost));
  393. }
  394. /**
  395. * Callback to all objects implementing the PrivateCTCP Callback.
  396. *
  397. * @param date The date of this line
  398. * @param sType Type of CTCP (VERSION, TIME etc)
  399. * @param sMessage Additional contents
  400. * @param sHost Hostname of sender (or servername)
  401. */
  402. protected void callPrivateCTCP(final LocalDateTime date, final String sType,
  403. final String sMessage, final String sHost) {
  404. getCallbackManager().publish(new PrivateCTCPEvent(parser, date, sType, sMessage, sHost));
  405. }
  406. /**
  407. * Callback to all objects implementing the PrivateCTCPReply Callback.
  408. *
  409. * @param date The date of this line
  410. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  411. * @param sMessage Reply Contents
  412. * @param sHost Hostname of sender (or servername)
  413. */
  414. protected void callPrivateCTCPReply(final LocalDateTime date, final String sType,
  415. final String sMessage, final String sHost) {
  416. getCallbackManager().publish(
  417. new PrivateCTCPReplyEvent(parser, date, sType, sMessage, sHost));
  418. }
  419. /**
  420. * Callback to all objects implementing the PrivateMessage Callback.
  421. *
  422. * @param date The date of this line
  423. * @param sMessage Message contents
  424. * @param sHost Hostname of sender (or servername)
  425. */
  426. protected void callPrivateMessage(final LocalDateTime date, final String sMessage,
  427. 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 LocalDateTime date, final String sMessage,
  438. 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 LocalDateTime date, final String sMessage,
  449. final String sHost) {
  450. getCallbackManager().publish(new ServerNoticeEvent(parser, date, sMessage, sHost));
  451. }
  452. /**
  453. * Callback to all objects implementing the UnknownAction Callback.
  454. *
  455. * @param date The date of this line
  456. * @param sMessage Action contents
  457. * @param sTarget Actual target of action
  458. * @param sHost Hostname of sender (or servername)
  459. */
  460. protected void callUnknownAction(final LocalDateTime date, final String sMessage,
  461. final String sTarget, final String sHost) {
  462. getCallbackManager().publish(new UnknownActionEvent(parser, date, sMessage, sTarget, sHost));
  463. }
  464. /**
  465. * Callback to all objects implementing the UnknownCTCP Callback.
  466. *
  467. * @param date The date of this line
  468. * @param sType Type of CTCP (VERSION, TIME etc)
  469. * @param sMessage Additional contents
  470. * @param sTarget Actual Target of CTCP
  471. * @param sHost Hostname of sender (or servername)
  472. */
  473. protected void callUnknownCTCP(final LocalDateTime date, final String sType,
  474. final String sMessage, final String sTarget, final String sHost) {
  475. getCallbackManager().publish(
  476. new UnknownCTCPEvent(parser, date, sType, sMessage, sTarget, sHost));
  477. }
  478. /**
  479. * Callback to all objects implementing the UnknownCTCPReply Callback.
  480. *
  481. * @param date The date of this line
  482. * @param sType Type of CTCPRReply (VERSION, TIME etc)
  483. * @param sMessage Reply Contents
  484. * @param sTarget Actual Target of CTCPReply
  485. * @param sHost Hostname of sender (or servername)
  486. */
  487. protected void callUnknownCTCPReply(final LocalDateTime date, final String sType,
  488. final String sMessage, final String sTarget, final String sHost) {
  489. getCallbackManager().publish(
  490. new UnknownCTCPReplyEvent(parser, date, sType, sMessage, sTarget, sHost));
  491. }
  492. /**
  493. * Callback to all objects implementing the UnknownMessage Callback.
  494. *
  495. * @param date The date of this line
  496. * @param sMessage Message contents
  497. * @param sTarget Actual target of message
  498. * @param sHost Hostname of sender (or servername)
  499. */
  500. protected void callUnknownMessage(final LocalDateTime date, final String sMessage,
  501. final String sTarget, final String sHost) {
  502. getCallbackManager().publish(
  503. new UnknownMessageEvent(parser, date, sMessage, sTarget, sHost));
  504. }
  505. /**
  506. * Callback to all objects implementing the UnknownNotice Callback.
  507. *
  508. * @param date The date of this line
  509. * @param sMessage Notice contents
  510. * @param sTarget Actual target of notice
  511. * @param sHost Hostname of sender (or servername)
  512. */
  513. protected void callUnknownNotice(final LocalDateTime date, final String sMessage,
  514. final String sTarget, final String sHost) {
  515. getCallbackManager().publish(new UnknownNoticeEvent(parser, date, sMessage, sTarget,
  516. sHost));
  517. }
  518. /**
  519. * Callback to all objects implementing the UnknownNotice Callback.
  520. *
  521. * @param date The date of this line
  522. * @param sMessage Notice contents
  523. * @param sTarget Actual target of notice
  524. * @param sHost Hostname of sender (or servername)
  525. */
  526. protected void callUnknownServerNotice(final LocalDateTime date, final String sMessage,
  527. final String sTarget, final String sHost) {
  528. getCallbackManager().publish(
  529. new UnknownServerNoticeEvent(parser, date, sMessage, sTarget, sHost));
  530. }
  531. }