Skip to content

Commit

Permalink
Ignore case when getting created channels. Set load channel history t…
Browse files Browse the repository at this point in the history
…o false as default. Correctly handle NOTICE messages.
  • Loading branch information
matty-r committed Mar 5, 2024
1 parent 417511f commit e8d2f15
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
34 changes: 17 additions & 17 deletions src/urChatBasic/backend/MessageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,7 @@ public void messageExec (Message myMessage)
// CAP ACK or CAP LS?
switch (myMessage.subType)
{
case "LS" ->
{
case "LS" -> {
printServerText(myMessage.body);

serverBase.setCapabilities(myMessage.body);
Expand All @@ -706,8 +705,7 @@ public void messageExec (Message myMessage)
serverBase.nickservRequestAuthentication();
}
}
case "ACK" ->
{
case "ACK" -> {
printServerText("Begin SASL Authentication");
serverBase.saslDoAuthentication();
}
Expand All @@ -733,20 +731,21 @@ public class NoticeMessage implements MessageBase
@Override
public void messageExec (Message myMessage)
{
if (myMessage.nick != null && myMessage.nick.equalsIgnoreCase("NickServ"))
// Send the message to the Channel or Private Channel if that is where it needs to go
// otherwise just print it as server text
IRCChannelBase messageChannel = myMessage.messageHandler.serverBase.getCreatedChannel(myMessage.getChannel());

if (messageChannel == null)
{
printPrivateText(myMessage.nick, myMessage.body, myMessage.nick);
serverBase.reconnectChannels();
messageChannel = myMessage.messageHandler.serverBase.getCreatedPrivateChannel(myMessage.getNick());
}

if (messageChannel != null)
{
messageChannel.printText(myMessage.getBody(), Constants.EVENT_USER);
} else
{
IRCChannelBase messageChannel = myMessage.messageHandler.serverBase.getCreatedChannel(myMessage.getChannel());
if (messageChannel != null)
{
messageChannel.printText(myMessage.getBody(), Constants.EVENT_USER);
} else
{
printServerText(myMessage.body);
}
printServerText(myMessage.body);
}
}
}
Expand Down Expand Up @@ -818,10 +817,11 @@ public class DisconnectErrorMessage implements MessageBase
public void messageExec (Message myMessage)
{
// Are we just quitting, then don't show an error message.
if(myMessage.getBody().contains("Goodbye cruel world"))
if (myMessage.getBody().contains("Goodbye cruel world"))
{
gui.quitServer(myMessage.messageHandler.serverBase);
} else {
} else
{
Constants.LOGGER.error(myMessage.getBody());
MessageDialog dialog = new MessageDialog("startUp() failed! " + myMessage.getBody(), "Error", JOptionPane.ERROR_MESSAGE);
dialog.setVisible(true);
Expand Down
4 changes: 2 additions & 2 deletions src/urChatBasic/base/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class Constants
{
public static String UR_VERSION = "v0.6.0";
public static String UR_VERSION = "v0.7.0";
public static String APP_NAME = "urChatClient" + UR_VERSION;
public static String URL_SEPARATOR = "/";
public static final String RESOURCES_PATH = URL_SEPARATOR + "resources" + URL_SEPARATOR;
Expand Down Expand Up @@ -130,7 +130,7 @@ public class Constants
public static final Boolean DEFAULT_USERS_LIST_ACTIVE = true;
public static final Boolean DEFAULT_EVENT_TICKER_JOINS_QUITS = true;
public static final Boolean DEFAULT_MAIN_WINDOW_JOINS_QUITS = true;
public static final Boolean DEFAULT_LOAD_CHANNEL_LOGS_ON_JOIN = true;
public static final Boolean DEFAULT_LOAD_CHANNEL_LOGS_ON_JOIN = false;
public static final Boolean DEFAULT_LOG_CHANNEL_ACTIVITY = true;
public static final Boolean DEFAULT_LOG_SERVER_ACTIVITY = true;
public static final Boolean DEFAULT_AUTO_CONNECT_FAVOURITES = false;
Expand Down
2 changes: 1 addition & 1 deletion src/urChatBasic/frontend/IRCServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public IRCChannelBase getCreatedChannel (String channelName, boolean asPrivate)
IRCChannelBase returnChannel = null;

for (IRCChannelBase tempChannel : createdChannels)
if (tempChannel.getName().equals(channelName))
if (tempChannel.getName().equalsIgnoreCase(channelName))
{
if (asPrivate && tempChannel instanceof IRCPrivate || !asPrivate)
returnChannel = tempChannel;
Expand Down

0 comments on commit e8d2f15

Please sign in to comment.