Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
MainForm 2.3.0, Application 1.5.1: игнорирование пустых исходящих соо…
Browse files Browse the repository at this point in the history
…бщений.
  • Loading branch information
M-Sh-97 committed Dec 16, 2015
1 parent bd0c14e commit 4c4fa35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public void sendMessage(String text) {
if (currentSuccessConnection == ConnectionStatus.AS_CLIENT) {
outcomingConnection.sendMessage(text);
}
addMessage(localNick, text);
} catch (IOException e1) {
e1.printStackTrace();
}
Expand Down Expand Up @@ -312,7 +311,7 @@ public void makeOutcomingCall(String remoteIP) {
}
}

private void addMessage(String nick, String msgText) {
public void addMessage(String nick, String msgText) {
if (msgText != null) {
messageContainer.addMessage(nick, new Date(System.currentTimeMillis()), msgText);
}
Expand Down
8 changes: 6 additions & 2 deletions src/MainForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ public void actionPerformed(ActionEvent e) {
sendButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logicModel.sendMessage(myText.getText());
myText.setText("");
String text = myText.getText();
if (! text.isEmpty()) {
logicModel.sendMessage(text);
logicModel.addMessage(logicModel.getLocalNick(), text);
myText.setText("");
}
}
});

Expand Down

0 comments on commit 4c4fa35

Please sign in to comment.