diff --git a/pitiupi.chat/build/built-jar.properties b/pitiupi.chat/build/built-jar.properties
index ab84885..5d16962 100644
--- a/pitiupi.chat/build/built-jar.properties
+++ b/pitiupi.chat/build/built-jar.properties
@@ -1,6 +1,6 @@
-#Mon, 17 Aug 2026 14:26:26 -0300
+#Tue, 29 Sep 2026 11:11:06 -0300
-C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi.chat=
+C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi.chat=
-C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi=
+C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi=
diff --git a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow$1.class b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow$1.class
index 254570a..62a7d32 100644
Binary files a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow$1.class and b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow$1.class differ
diff --git a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class
index 15ff534..23f514a 100644
Binary files a/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class and b/pitiupi.chat/build/classes/pitiupi/chat/GUI/ChatWindow.class differ
diff --git a/pitiupi.chat/build/classes/pitiupi/chat/plugin/ChatPlugin.class b/pitiupi.chat/build/classes/pitiupi/chat/plugin/ChatPlugin.class
index b5d0c5d..73c97c9 100644
Binary files a/pitiupi.chat/build/classes/pitiupi/chat/plugin/ChatPlugin.class and b/pitiupi.chat/build/classes/pitiupi/chat/plugin/ChatPlugin.class differ
diff --git a/pitiupi.chat/src/pitiupi.chat.iml b/pitiupi.chat/src/pitiupi.chat.iml
new file mode 100644
index 0000000..937cc1c
--- /dev/null
+++ b/pitiupi.chat/src/pitiupi.chat.iml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java b/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
index c963334..b0cf6d8 100644
--- a/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
+++ b/pitiupi.chat/src/pitiupi/chat/GUI/ChatWindow.java
@@ -12,6 +12,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import pitiupi.chat.net.ChatMessage;
import pitiupi.GUI.MainWindow;
+import pitiupi.control.ConnectionManager;
import pitiupi.net.Message;
/**
@@ -29,10 +30,10 @@ public class ChatWindow extends javax.swing.JDialog {
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTextArea jTextArea1;
- private final MainWindow mainWindow;
+ private final ConnectionManager connectionManager;
- public ChatWindow(MainWindow mainWindow) {
- this.mainWindow = mainWindow;
+ public ChatWindow(ConnectionManager connectionManager) {
+ this.connectionManager = connectionManager;
initComponents();
}
@@ -94,17 +95,13 @@ public class ChatWindow extends javax.swing.JDialog {
if (jTextArea1.getText().trim().isEmpty()) {
return;
}
- ChatMessage message = new ChatMessage(mainWindow.getUserName(), jTextArea1.getText());
+ ChatMessage message = new ChatMessage(connectionManager.getUserName(), jTextArea1.getText());
this.sendChatMessage(message);
jTextArea1.setText("");
}
public void sendChatMessage(Message message) {
- try {
- mainWindow.getSocketUDP().sendMulticast(message.toByteArray());
- } catch (IOException ex) {
- Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
- }
+ connectionManager.sendUdpMulticast(message);
}
public void receiveChatMessage(ChatMessage message) {
diff --git a/pitiupi.chat/src/pitiupi/chat/plugin/ChatPlugin.java b/pitiupi.chat/src/pitiupi/chat/plugin/ChatPlugin.java
index 44f3911..7658b31 100644
--- a/pitiupi.chat/src/pitiupi/chat/plugin/ChatPlugin.java
+++ b/pitiupi.chat/src/pitiupi/chat/plugin/ChatPlugin.java
@@ -11,6 +11,8 @@ import pitiupi.GUI.MainWindow;
import pitiupi.chat.GUI.ChatMenu;
import pitiupi.chat.GUI.ChatWindow;
import pitiupi.chat.net.ChatMessage;
+import pitiupi.control.ConnectionManager;
+import pitiupi.control.GuiManager;
import pitiupi.net.Message;
import pitiupi.plugin.Plugin;
@@ -21,16 +23,14 @@ import pitiupi.plugin.Plugin;
public class ChatPlugin implements Plugin {
private ChatWindow chatWindow;
- private MainWindow mainWindow;
public ChatPlugin() {
}
@Override
- public void createPlugin(MainWindow mainWindow) {
- this.mainWindow = mainWindow;
- this.chatWindow = new ChatWindow(mainWindow);
- this.mainWindow.addMenu(new ChatMenu(chatWindow));
+ public void createPlugin(ConnectionManager connectionManager, GuiManager guiManager) {
+ this.chatWindow = new ChatWindow(connectionManager);
+ guiManager.addMenu(new ChatMenu(chatWindow));
}
@Override
@@ -42,9 +42,7 @@ public class ChatPlugin implements Plugin {
if (ois.readObject() instanceof ChatMessage msg) {
this.chatWindow.receiveChatMessage(msg);
}
- } catch (IOException ex) {
- System.out.println(ex.toString());
- } catch (ClassNotFoundException ex) {
+ } catch (IOException | ClassNotFoundException ex) {
System.out.println(ex.toString());
}
}
@@ -64,6 +62,11 @@ public class ChatPlugin implements Plugin {
return "0";
}
+ @Override
+ public String getIdentifier() {
+ return "Pitiupi.Chat.Example";
+ }
+
@Override
public Message getMessage() {
return new ChatMessage();
diff --git a/pitiupi.mpChat/Makefile b/pitiupi.mpChat/Makefile
new file mode 100644
index 0000000..e2be90f
--- /dev/null
+++ b/pitiupi.mpChat/Makefile
@@ -0,0 +1,15 @@
+JAR = ../pitiupi/dist/pitiupi.jar
+OUT_DIR = /out
+META-INF_DIR = src/META-INF
+DIST = dist/mpChat.jar
+
+SOURCES = $(shell find -name "*.java")
+
+all:
+ mkdir -p $(OUT_DIR)
+ javac -cp "$(JAR)" -d "$(OUT_DIR)" $(SOURCES)
+ cp -r "$(META-INF_DIR)" "$(OUT_DIR)"
+ jar cf "$(DIST)" -C "$(OUT_DIR)" .
+
+clean:
+ rm -rf "$(OUT_DIR)"/*
\ No newline at end of file
diff --git a/pitiupi.testSocket/out/GUI/ChatMenu.class b/pitiupi.mpChat/out/GUI/ChatMenu.class
similarity index 68%
rename from pitiupi.testSocket/out/GUI/ChatMenu.class
rename to pitiupi.mpChat/out/GUI/ChatMenu.class
index 65067fe..e8b9851 100644
Binary files a/pitiupi.testSocket/out/GUI/ChatMenu.class and b/pitiupi.mpChat/out/GUI/ChatMenu.class differ
diff --git a/pitiupi.testSocket/out/GUI/ChatWindow.class b/pitiupi.mpChat/out/GUI/ChatWindow.class
similarity index 76%
rename from pitiupi.testSocket/out/GUI/ChatWindow.class
rename to pitiupi.mpChat/out/GUI/ChatWindow.class
index 6c30a83..97a91a4 100644
Binary files a/pitiupi.testSocket/out/GUI/ChatWindow.class and b/pitiupi.mpChat/out/GUI/ChatWindow.class differ
diff --git a/pitiupi.testSocket/out/GUI/PrivateChatWindow.class b/pitiupi.mpChat/out/GUI/PrivateChatWindow.class
similarity index 79%
rename from pitiupi.testSocket/out/GUI/PrivateChatWindow.class
rename to pitiupi.mpChat/out/GUI/PrivateChatWindow.class
index 1c2ed39..147cc53 100644
Binary files a/pitiupi.testSocket/out/GUI/PrivateChatWindow.class and b/pitiupi.mpChat/out/GUI/PrivateChatWindow.class differ
diff --git a/pitiupi.testSocket/out/GUI/PublicChatWindow.class b/pitiupi.mpChat/out/GUI/PublicChatWindow.class
similarity index 75%
rename from pitiupi.testSocket/out/GUI/PublicChatWindow.class
rename to pitiupi.mpChat/out/GUI/PublicChatWindow.class
index 5d2a67b..605cc2f 100644
Binary files a/pitiupi.testSocket/out/GUI/PublicChatWindow.class and b/pitiupi.mpChat/out/GUI/PublicChatWindow.class differ
diff --git a/pitiupi.testSocket/out/GUI/SocketTestMenu.class b/pitiupi.mpChat/out/GUI/SocketTestMenu.class
similarity index 100%
rename from pitiupi.testSocket/out/GUI/SocketTestMenu.class
rename to pitiupi.mpChat/out/GUI/SocketTestMenu.class
diff --git a/pitiupi.testSocket/out/GUI/SocketTestWindow.class b/pitiupi.mpChat/out/GUI/SocketTestWindow.class
similarity index 100%
rename from pitiupi.testSocket/out/GUI/SocketTestWindow.class
rename to pitiupi.mpChat/out/GUI/SocketTestWindow.class
diff --git a/pitiupi.mpChat/out/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.mpChat/out/META-INF/services/pitiupi.plugin.Plugin
new file mode 100644
index 0000000..3240a6f
--- /dev/null
+++ b/pitiupi.mpChat/out/META-INF/services/pitiupi.plugin.Plugin
@@ -0,0 +1 @@
+plugin.MultiProtocolChat
diff --git a/pitiupi.testSocket/out/control/ChatController.class b/pitiupi.mpChat/out/control/ChatController.class
similarity index 81%
rename from pitiupi.testSocket/out/control/ChatController.class
rename to pitiupi.mpChat/out/control/ChatController.class
index 958f814..bbfa82b 100644
Binary files a/pitiupi.testSocket/out/control/ChatController.class and b/pitiupi.mpChat/out/control/ChatController.class differ
diff --git a/pitiupi.mpChat/out/net/MpChatMessage.class b/pitiupi.mpChat/out/net/MpChatMessage.class
new file mode 100644
index 0000000..2f15121
Binary files /dev/null and b/pitiupi.mpChat/out/net/MpChatMessage.class differ
diff --git a/pitiupi.testSocket/out/net/TestChatMessage.class b/pitiupi.mpChat/out/net/TestChatMessage.class
similarity index 100%
rename from pitiupi.testSocket/out/net/TestChatMessage.class
rename to pitiupi.mpChat/out/net/TestChatMessage.class
diff --git a/pitiupi.testSocket/out/net/TestMessage.class b/pitiupi.mpChat/out/net/TestMessage.class
similarity index 100%
rename from pitiupi.testSocket/out/net/TestMessage.class
rename to pitiupi.mpChat/out/net/TestMessage.class
diff --git a/pitiupi.mpChat/out/plugin/MultiProtocolChat.class b/pitiupi.mpChat/out/plugin/MultiProtocolChat.class
new file mode 100644
index 0000000..bbae454
Binary files /dev/null and b/pitiupi.mpChat/out/plugin/MultiProtocolChat.class differ
diff --git a/pitiupi.testSocket/out/plugin/SocketTest.class b/pitiupi.mpChat/out/plugin/SocketTest.class
similarity index 100%
rename from pitiupi.testSocket/out/plugin/SocketTest.class
rename to pitiupi.mpChat/out/plugin/SocketTest.class
diff --git a/pitiupi.testSocket/out/plugin/TestChat.class b/pitiupi.mpChat/out/plugin/TestChat.class
similarity index 100%
rename from pitiupi.testSocket/out/plugin/TestChat.class
rename to pitiupi.mpChat/out/plugin/TestChat.class
diff --git a/pitiupi.mpChat/pitiupi.mpChat.iml b/pitiupi.mpChat/pitiupi.mpChat.iml
new file mode 100644
index 0000000..4e2cbb3
--- /dev/null
+++ b/pitiupi.mpChat/pitiupi.mpChat.iml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.testSocket/src/GUI/ChatMenu.java b/pitiupi.mpChat/src/GUI/ChatMenu.java
similarity index 88%
rename from pitiupi.testSocket/src/GUI/ChatMenu.java
rename to pitiupi.mpChat/src/GUI/ChatMenu.java
index 9b7e0e2..f336426 100644
--- a/pitiupi.testSocket/src/GUI/ChatMenu.java
+++ b/pitiupi.mpChat/src/GUI/ChatMenu.java
@@ -1,18 +1,15 @@
package GUI;
-import plugin.TestChat;
+import plugin.MultiProtocolChat;
import javax.swing.*;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
public class ChatMenu extends JMenu {
- private final TestChat testChat;
+ private final MultiProtocolChat multiProtocolChat;
- public ChatMenu(TestChat testChat) {
- this.testChat = testChat;
+ public ChatMenu(MultiProtocolChat multiProtocolChat) {
+ this.multiProtocolChat = multiProtocolChat;
this.setText("MP-Chat");
JMenuItem startPrivateChat = new JMenuItem("start Private Chat");
@@ -71,7 +68,7 @@ public class ChatMenu extends JMenu {
startButton.addActionListener(e -> {
String ip = ipField.getText();
- if (testChat.openConnection(ip)) dialog.dispose();
+ if (multiProtocolChat.openConnection(ip)) dialog.dispose();
else errorLabel.setVisible(true);
});
diff --git a/pitiupi.testSocket/src/GUI/ChatWindow.java b/pitiupi.mpChat/src/GUI/ChatWindow.java
similarity index 91%
rename from pitiupi.testSocket/src/GUI/ChatWindow.java
rename to pitiupi.mpChat/src/GUI/ChatWindow.java
index 3e87109..bca8e1c 100644
--- a/pitiupi.testSocket/src/GUI/ChatWindow.java
+++ b/pitiupi.mpChat/src/GUI/ChatWindow.java
@@ -1,7 +1,6 @@
package GUI;
-import net.TestChatMessage;
-import pitiupi.GUI.MainWindow;
+import net.MpChatMessage;
import pitiupi.control.ConnectionManager;
import javax.swing.*;
@@ -64,20 +63,20 @@ public abstract class ChatWindow extends JFrame {
protected abstract void initButtons(JPanel bottomPanel);
- protected TestChatMessage createMessage(String tipoMensagem) {
+ protected MpChatMessage createMessage(String tipoMensagem) {
try {
String nome = connectionManager.getUserName();
String ip = InetAddress.getLocalHost().getHostAddress();
String message = messageField.getText();
- return new TestChatMessage(nome, ip, tipoMensagem, message);
+ return new MpChatMessage(nome, ip, tipoMensagem, message);
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
- public void receiveMessage(TestChatMessage msg) {
+ public void receiveMessage(MpChatMessage msg) {
SwingUtilities.invokeLater(() -> {
String mensagem = String.format(
"[%s] %s (%s): %s%n",
diff --git a/pitiupi.testSocket/src/GUI/PrivateChatWindow.java b/pitiupi.mpChat/src/GUI/PrivateChatWindow.java
similarity index 89%
rename from pitiupi.testSocket/src/GUI/PrivateChatWindow.java
rename to pitiupi.mpChat/src/GUI/PrivateChatWindow.java
index ab99fbd..56f111b 100644
--- a/pitiupi.testSocket/src/GUI/PrivateChatWindow.java
+++ b/pitiupi.mpChat/src/GUI/PrivateChatWindow.java
@@ -1,7 +1,6 @@
package GUI;
-import net.TestChatMessage;
-import pitiupi.GUI.MainWindow;
+import net.MpChatMessage;
import pitiupi.control.ConnectionManager;
import pitiupi.net.tcp.TcpConnection;
@@ -35,7 +34,7 @@ public class PrivateChatWindow extends ChatWindow {
private void sendTCP() {
try {
- TestChatMessage msg = createMessage("TCP Private");
+ MpChatMessage msg = createMessage("TCP Private");
connection.send(msg.toByteArray());
} catch (Exception ex) {
diff --git a/pitiupi.testSocket/src/GUI/PublicChatWindow.java b/pitiupi.mpChat/src/GUI/PublicChatWindow.java
similarity index 90%
rename from pitiupi.testSocket/src/GUI/PublicChatWindow.java
rename to pitiupi.mpChat/src/GUI/PublicChatWindow.java
index 5639c2e..ff6967e 100644
--- a/pitiupi.testSocket/src/GUI/PublicChatWindow.java
+++ b/pitiupi.mpChat/src/GUI/PublicChatWindow.java
@@ -1,7 +1,6 @@
package GUI;
-import net.TestChatMessage;
-import pitiupi.GUI.MainWindow;
+import net.MpChatMessage;
import pitiupi.control.ConnectionManager;
import javax.swing.*;
@@ -57,7 +56,7 @@ public class PublicChatWindow extends ChatWindow {
private void sendTCP() {
try {
- TestChatMessage msg = createMessage("TCP Unicast");
+ MpChatMessage msg = createMessage("TCP Unicast");
InetAddress ip = InetAddress.getByName(ipField.getText());
@@ -70,7 +69,7 @@ public class PublicChatWindow extends ChatWindow {
private void sendUDP() {
try {
- TestChatMessage msg = createMessage("UDP Unicast");
+ MpChatMessage msg = createMessage("UDP Unicast");
InetAddress ip = InetAddress.getByName(ipField.getText());
@@ -83,7 +82,7 @@ public class PublicChatWindow extends ChatWindow {
private void sendMulticast() {
try {
- TestChatMessage msg = createMessage("UDP Multicast");
+ MpChatMessage msg = createMessage("UDP Multicast");
connectionManager.sendUdpMulticast(msg);
diff --git a/pitiupi.mpChat/src/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.mpChat/src/META-INF/services/pitiupi.plugin.Plugin
new file mode 100644
index 0000000..3240a6f
--- /dev/null
+++ b/pitiupi.mpChat/src/META-INF/services/pitiupi.plugin.Plugin
@@ -0,0 +1 @@
+plugin.MultiProtocolChat
diff --git a/pitiupi.testSocket/src/control/ChatController.java b/pitiupi.mpChat/src/control/ChatController.java
similarity index 90%
rename from pitiupi.testSocket/src/control/ChatController.java
rename to pitiupi.mpChat/src/control/ChatController.java
index 00af149..e437a4b 100644
--- a/pitiupi.testSocket/src/control/ChatController.java
+++ b/pitiupi.mpChat/src/control/ChatController.java
@@ -4,8 +4,7 @@ import GUI.ChatMenu;
import GUI.ChatWindow;
import GUI.PrivateChatWindow;
import GUI.PublicChatWindow;
-import net.TestChatMessage;
-import pitiupi.GUI.MainWindow;
+import net.MpChatMessage;
import pitiupi.control.ConnectionManager;
import pitiupi.net.tcp.TcpConnection;
@@ -53,10 +52,10 @@ public class ChatController {
removedWindow.dispose();
}
- public void receivePublic(TestChatMessage message) {
+ public void receivePublic(MpChatMessage message) {
publicChatWindow.receiveMessage(message);
}
- public void receivePrivate(TcpConnection tcpConnection, TestChatMessage message) {
+ public void receivePrivate(TcpConnection tcpConnection, MpChatMessage message) {
chatWindows.get(tcpConnection).receiveMessage(message);
}
}
diff --git a/pitiupi.testSocket/src/net/TestChatMessage.java b/pitiupi.mpChat/src/net/MpChatMessage.java
similarity index 76%
rename from pitiupi.testSocket/src/net/TestChatMessage.java
rename to pitiupi.mpChat/src/net/MpChatMessage.java
index 3b9a499..731367b 100644
--- a/pitiupi.testSocket/src/net/TestChatMessage.java
+++ b/pitiupi.mpChat/src/net/MpChatMessage.java
@@ -2,20 +2,20 @@ package net;
import pitiupi.net.Message;
-public class TestChatMessage extends Message {
+public class MpChatMessage extends Message {
private String nome;
private String ip;
private String tipoMensagem;
private String message;
- public TestChatMessage(String nome, String ip, String tipoMensagem, String message) {
+ public MpChatMessage(String nome, String ip, String tipoMensagem, String message) {
this.nome = nome;
this.ip = ip;
this.tipoMensagem = tipoMensagem;
this.message = message;
}
- public TestChatMessage(){}
+ public MpChatMessage(){}
public String getNome() {
return nome;
diff --git a/pitiupi.mpChat/src/plugin/MultiProtocolChat.java b/pitiupi.mpChat/src/plugin/MultiProtocolChat.java
new file mode 100644
index 0000000..089c582
--- /dev/null
+++ b/pitiupi.mpChat/src/plugin/MultiProtocolChat.java
@@ -0,0 +1,107 @@
+package plugin;
+
+import GUI.ChatMenu;
+import control.ChatController;
+import net.MpChatMessage;
+import pitiupi.control.ConnectionManager;
+import pitiupi.control.GuiManager;
+import pitiupi.net.Message;
+import pitiupi.net.tcp.TcpConnection;
+import pitiupi.plugin.PrivateConnectionPlugin;
+
+import javax.swing.*;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.InetAddress;
+
+public class MultiProtocolChat implements PrivateConnectionPlugin{
+ ChatController chatController;
+ ConnectionManager connectionManager;
+ GuiManager guiManager;
+
+ @Override
+ public String getName() {
+ return "MultiProtocol chat";
+ }
+
+ @Override
+ public String getAuthor() {
+ return "Gustavo Henrique";
+ }
+
+ @Override
+ public String getVersion() {
+ return "0";
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "Multi.Protocol.Chat.Pitiupi";
+ }
+
+ @Override
+ public void createPlugin(ConnectionManager connectionManager, GuiManager guiManager) {
+ this.connectionManager = connectionManager;
+ this.guiManager = guiManager;
+
+ ChatMenu chatMenu = new ChatMenu(this);
+ chatController = new ChatController(connectionManager, chatMenu);
+ guiManager.addMenu(chatMenu);
+ }
+
+ @Override
+ public Message getMessage() {
+ return new MpChatMessage();
+ }
+
+ @Override
+ public void receiveMessage(byte[] message) {
+ MpChatMessage mpChatMessage = parseMessage(message);
+ chatController.receivePublic(mpChatMessage);
+ }
+
+
+ @Override
+ public void receivePrivateConnection(TcpConnection tcpConnection) {
+ SwingUtilities.invokeLater(() -> {
+ chatController.addChatWindow(tcpConnection);
+ });
+ }
+
+ @Override
+ public void receiveBytes(TcpConnection connection, byte[] bytes) {
+ MpChatMessage mpChatMessage = parseMessage(bytes);
+ chatController.receivePrivate(connection, mpChatMessage);
+ }
+
+ @Override
+ public void onSocketClosed(TcpConnection tcpConnection) {
+ chatController.removeChatWindow(tcpConnection);
+ }
+
+ public boolean openConnection(String ip) {
+ try {
+ connectionManager.connectPluginTcp(InetAddress.getByName(ip), getIdentifier(), getIdentifier());
+ return true;
+ }
+ catch (Exception e) {
+ System.out.println("Error opening connection: " + e.getMessage());
+ }
+ return false;
+ }
+
+ private MpChatMessage parseMessage(byte[] bytes) {
+ ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois;
+ try {
+ ois = new ObjectInputStream(bis);
+ if (ois.readObject() instanceof MpChatMessage msg) {
+ return msg;
+ }
+ } catch (IOException | ClassNotFoundException ex) {
+ System.out.println(ex.toString());
+ }
+ return null;
+ }
+}
diff --git a/pitiupi.screenCast/.idea/workspace.xml b/pitiupi.screenCast/.idea/workspace.xml
index 61262cc..0438088 100644
--- a/pitiupi.screenCast/.idea/workspace.xml
+++ b/pitiupi.screenCast/.idea/workspace.xml
@@ -5,24 +5,10 @@
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
@@ -46,10 +32,12 @@
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true",
- "git-widget-placeholder": "feature/unicast",
+ "RunOnceActivity.typescript.service.memoryLimit.init": "true",
+ "codeWithMe.voiceChat.enabledByDefault": "false",
+ "git-widget-placeholder": "feature/separacao-gerenciadores",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
- "last_opened_file_path": "C:/Users/extre/OneDrive/Documentos/Faculdade/2026_02/Monitoria/Pitiupi/pitiupi.screenCast",
+ "last_opened_file_path": "C:/Users/Gustavo/OneDrive/Documentos/Faculdade/2026_2/Monitoria/pitiupi/pitiupi.screenCast",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2",
@@ -57,17 +45,6 @@
}
}]]>
-
-
-
-
-
-
-
-
-
-
-
@@ -102,11 +79,23 @@
+
+
+
+
+
+
+
+
+
+
+
-
+
+
@@ -120,4 +109,7 @@
+
+
+
\ No newline at end of file
diff --git a/pitiupi.screenCast/build/built-jar.properties b/pitiupi.screenCast/build/built-jar.properties
index c3e64e2..1f21a31 100644
--- a/pitiupi.screenCast/build/built-jar.properties
+++ b/pitiupi.screenCast/build/built-jar.properties
@@ -1,6 +1,6 @@
-#Mon, 17 Aug 2026 14:35:40 -0300
+#Tue, 29 Sep 2026 11:04:58 -0300
-C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi.screenCast=
+C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi.screenCast=
-C\:\\Users\\extre\\OneDrive\\Documentos\\Faculdade\\2026_02\\Monitoria\\Pitiupi\\pitiupi=
+C\:\\Users\\Gustavo\\OneDrive\\Documentos\\Faculdade\\2026_2\\Monitoria\\pitiupi\\pitiupi=
diff --git a/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class b/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class
index 285c323..f8d140d 100644
Binary files a/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class and b/pitiupi.screenCast/build/classes/pitiupi/screenCast/GUI/ScreenCastWindow.class differ
diff --git a/pitiupi.screenCast/build/classes/pitiupi/screenCast/plugin/ScreenCastPlugin.class b/pitiupi.screenCast/build/classes/pitiupi/screenCast/plugin/ScreenCastPlugin.class
index 77a7e76..b26bee9 100644
Binary files a/pitiupi.screenCast/build/classes/pitiupi/screenCast/plugin/ScreenCastPlugin.class and b/pitiupi.screenCast/build/classes/pitiupi/screenCast/plugin/ScreenCastPlugin.class differ
diff --git a/pitiupi.screenCast/src/pitiupi.screenCast.iml b/pitiupi.screenCast/src/pitiupi.screenCast.iml
new file mode 100644
index 0000000..937cc1c
--- /dev/null
+++ b/pitiupi.screenCast/src/pitiupi.screenCast.iml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java b/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
index 399f15a..cfd0022 100644
--- a/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
+++ b/pitiupi.screenCast/src/pitiupi/screenCast/GUI/ScreenCastWindow.java
@@ -5,6 +5,8 @@
*/
package pitiupi.screenCast.GUI;
+import pitiupi.control.ConnectionManager;
+import pitiupi.control.GuiManager;
import pitiupi.screenCast.control.AlarmClock;
import pitiupi.screenCast.control.ImageTransformation;
import pitiupi.screenCast.control.ScreenShot;
@@ -38,10 +40,13 @@ public class ScreenCastWindow extends javax.swing.JFrame {
public final static int TIME = 1000;
private float compressRatio;
- private final MainWindow mainWindow;
+ private final ConnectionManager connectionManager;
+ private final GuiManager guiManager;
+
+ public ScreenCastWindow(ConnectionManager connectionManager, GuiManager guiManager) {
+ this.connectionManager = connectionManager;
+ this.guiManager = guiManager;
- public ScreenCastWindow(MainWindow mainWindow) {
- this.mainWindow = mainWindow;
this.compressRatio = 0.5f;
this.initComponents();
}
@@ -91,19 +96,12 @@ public class ScreenCastWindow extends javax.swing.JFrame {
BufferedImage image = ScreenShot.takeAShot();
BufferedImage rescaled = ImageTransformation.resize(image, 1024, 768);
byte[] byteImage = ImageTransformation.compress(rescaled, compressRatio);
- ScreenCastMessage message = new ScreenCastMessage(this.mainWindow.getUserName(), byteImage);
- msg = message.toByteArray();
+ ScreenCastMessage message = new ScreenCastMessage(this.connectionManager.getUserName(), byteImage);
+
+ if (!connectionManager.sendUdpMulticast(message)) this.compressRatio -= 0.1f;
} catch (AWTException | IOException ex) {
Logger.getLogger(AlarmClock.class.getName()).log(Level.SEVERE, null, ex);
}
- if (msg != null) {
- try {
- this.mainWindow.getSocketUDP().sendMulticast(msg);
- } catch (IOException ex) {
- System.out.println(ex.toString());
- this.compressRatio -= 0.1f;
- }
- }
}
public void receiveScreenCastMessage(ScreenCastMessage message) {
diff --git a/pitiupi.screenCast/src/pitiupi/screenCast/plugin/ScreenCastPlugin.java b/pitiupi.screenCast/src/pitiupi/screenCast/plugin/ScreenCastPlugin.java
index b8d593a..50641a6 100644
--- a/pitiupi.screenCast/src/pitiupi/screenCast/plugin/ScreenCastPlugin.java
+++ b/pitiupi.screenCast/src/pitiupi/screenCast/plugin/ScreenCastPlugin.java
@@ -8,6 +8,8 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import pitiupi.GUI.MainWindow;
+import pitiupi.control.ConnectionManager;
+import pitiupi.control.GuiManager;
import pitiupi.net.Message;
import pitiupi.plugin.Plugin;
import pitiupi.screenCast.GUI.ScreenCastMenu;
@@ -21,7 +23,6 @@ import pitiupi.screenCast.net.ScreenCastMessage;
public class ScreenCastPlugin implements Plugin {
private ScreenCastWindow screenCastWindow;
- private MainWindow mainWindow;
@Override
public String getName() {
@@ -39,10 +40,14 @@ public class ScreenCastPlugin implements Plugin {
}
@Override
- public void createPlugin(MainWindow mainWindow) {
- this.mainWindow = mainWindow;
- this.screenCastWindow = new ScreenCastWindow(mainWindow);
- this.mainWindow.addMenu(new ScreenCastMenu(screenCastWindow));
+ public String getIdentifier() {
+ return "Pitiupi.ScreenCast.Example";
+ }
+
+ @Override
+ public void createPlugin(ConnectionManager connectionManager, GuiManager guiManager) {
+ this.screenCastWindow = new ScreenCastWindow(connectionManager, guiManager);
+ guiManager.addMenu(new ScreenCastMenu(screenCastWindow));
}
@Override
@@ -54,9 +59,7 @@ public class ScreenCastPlugin implements Plugin {
if (ois.readObject() instanceof ScreenCastMessage msg) {
this.screenCastWindow.receiveScreenCastMessage(msg);
}
- } catch (IOException ex) {
- System.out.println(ex.toString());
- } catch (ClassNotFoundException ex) {
+ } catch (IOException | ClassNotFoundException ex) {
System.out.println(ex.toString());
}
}
diff --git a/pitiupi.testSocket/Makefile b/pitiupi.testSocket/Makefile
deleted file mode 100644
index e69de29..0000000
diff --git a/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin
deleted file mode 100644
index 58a4118..0000000
--- a/pitiupi.testSocket/out/META-INF/services/pitiupi.plugin.Plugin
+++ /dev/null
@@ -1 +0,0 @@
-plugin.TestChat
diff --git a/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin b/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin
deleted file mode 100644
index 58a4118..0000000
--- a/pitiupi.testSocket/src/META-INF/services/pitiupi.plugin.Plugin
+++ /dev/null
@@ -1 +0,0 @@
-plugin.TestChat
diff --git a/pitiupi/src/pitiupi/GUI/MainWindow.java b/pitiupi/src/pitiupi/GUI/MainWindow.java
index 4facd60..139f697 100644
--- a/pitiupi/src/pitiupi/GUI/MainWindow.java
+++ b/pitiupi/src/pitiupi/GUI/MainWindow.java
@@ -116,7 +116,7 @@ public class MainWindow extends javax.swing.JFrame {
}
private void updateStatus() {
- this.status.setText("Connected on port " + connectionManager + " name " + connectionManager.getUserName());
+ this.status.setText("Connected on port " + connectionManager.getUserPort() + " name " + connectionManager.getUserName());
}
}