Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Testing alternative send mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed May 17, 2015
1 parent dadd45c commit 62548bc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/cnaude/purpleirc/IRCMessageHandler.java
Expand Up @@ -204,7 +204,7 @@ public void processMessage(PurpleBot ircBot, User user, Channel channel, String
.replace("%CMDPREFIX%", ircBot.commandPrefix);
if (!invalidIrcCommand.isEmpty()) {
if (ircBot.invalidCommandCTCP.get(myChannel)) {
ircBot.blockingCTCPMessage(target, invalidIrcCommand);
ircBot.asyncCTCPMessage(target, invalidIrcCommand);
} else {
ircBot.asyncIRCMessage(target, invalidIrcCommand);
}
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/com/cnaude/purpleirc/IRCMessageQueueWatcher.java
Expand Up @@ -59,13 +59,32 @@ private void queueAndSend() {
if (ircMessage != null) {
plugin.logDebug("[" + queue.size() + "]: queueAndSend message detected");
if (ircMessage.ctcpResponse) {
ircBot.blockingCTCPMessage(ircMessage.target, ircMessage.message);
blockingCTCPMessage(ircMessage.target, ircMessage.message);
} else {
ircBot.blockingIRCMessage(ircMessage.target, ircMessage.message);
blockingIRCMessage(ircMessage.target, ircMessage.message);
}
}
}

private void blockingIRCMessage(final String target, final String message) {
if (!ircBot.isConnected()) {
return;
}
plugin.logDebug("[blockingIRCMessage] About to send IRC message to " + target + ": " + message);
//ircBot.bot.sendIRC().message(target, message);
ircBot.bot.sendRaw().rawLineNow("PRIVMSG " + target + " :" + message);
plugin.logDebug("[blockingIRCMessage] Message sent to " + target + ": " + message);
}

private void blockingCTCPMessage(final String target, final String message) {
if (!ircBot.isConnected()) {
return;
}
plugin.logDebug("[blockingCTCPMessage] About to send IRC message to " + target + ": " + message);
ircBot.bot.sendIRC().ctcpResponse(target, message);
plugin.logDebug("[blockingCTCPMessage] Message sent to " + target + ": " + message);
}

public void cancel() {
timer.cancel();
}
Expand Down
22 changes: 1 addition & 21 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -79,7 +79,7 @@
*/
public final class PurpleBot {

private PircBotX bot;
protected PircBotX bot;

protected boolean goodBot;
public final PurpleIRC plugin;
Expand Down Expand Up @@ -462,26 +462,6 @@ public void asyncCTCPMessage(final String target, final String message) {
.gameColorsToIrc(message), true));
}

public void blockingIRCMessage(final String target, final String message) {
if (!this.isConnected()) {
return;
}
String fMessage = plugin.colorConverter.gameColorsToIrc(message);
plugin.logDebug("[blockingIRCMessage] About to send IRC message to " + target + ": " + fMessage);
bot.sendIRC().message(target, fMessage);
plugin.logDebug("[blockingIRCMessage] Message sent to " + target + ": " + fMessage);
}

public void blockingCTCPMessage(final String target, final String message) {
if (!this.isConnected()) {
return;
}
String fMessage = plugin.colorConverter.gameColorsToIrc(message);
plugin.logDebug("[blockingCTCPMessage] About to send IRC message to " + target + ": " + fMessage);
bot.sendIRC().ctcpResponse(target, fMessage);
plugin.logDebug("[blockingCTCPMessage] Message sent to " + target + ": " + fMessage);
}

public void asyncCTCPCommand(final String target, final String command) {
if (!this.isConnected()) {
return;
Expand Down

0 comments on commit 62548bc

Please sign in to comment.