From b6f5ec7d22d367ac88491ec29ae18d0d531157c2 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 10 Nov 2019 20:34:24 +0000 Subject: [PATCH] wip on chat --- .../groovy/com/muwire/core/MuWireSettings.groovy | 3 +++ .../core/chat/ChatConnectionAttemptStatus.java | 5 +++++ .../com/muwire/core/chat/ChatConnectionEvent.groovy | 9 +++++++++ .../muwire/core/chat/ChatDisconnectionEvent.groovy | 8 ++++++++ .../com/muwire/core/chat/ChatMessageEvent.groovy | 12 ++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 core/src/main/groovy/com/muwire/core/chat/ChatConnectionAttemptStatus.java create mode 100644 core/src/main/groovy/com/muwire/core/chat/ChatConnectionEvent.groovy create mode 100644 core/src/main/groovy/com/muwire/core/chat/ChatDisconnectionEvent.groovy create mode 100644 core/src/main/groovy/com/muwire/core/chat/ChatMessageEvent.groovy diff --git a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy index 022d1a6f..a31384a5 100644 --- a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy +++ b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy @@ -31,6 +31,7 @@ class MuWireSettings { boolean shareHiddenFiles boolean searchComments boolean browseFiles + boolean enableChat Set watchedDirectories float downloadSequentialRatio int hostClearInterval, hostHopelessInterval, hostRejectInterval @@ -79,6 +80,7 @@ class MuWireSettings { speedSmoothSeconds = Integer.valueOf(props.getProperty("speedSmoothSeconds","60")) totalUploadSlots = Integer.valueOf(props.getProperty("totalUploadSlots","-1")) uploadSlotsPerUser = Integer.valueOf(props.getProperty("uploadSlotsPerUser","-1")) + enableChat = Boolean.valueOf(props.getProperty("enableChat","false")) watchedDirectories = DataUtil.readEncodedSet(props, "watchedDirectories") watchedKeywords = DataUtil.readEncodedSet(props, "watchedKeywords") @@ -127,6 +129,7 @@ class MuWireSettings { props.setProperty("speedSmoothSeconds", String.valueOf(speedSmoothSeconds)) props.setProperty("totalUploadSlots", String.valueOf(totalUploadSlots)) props.setProperty("uploadSlotsPerUser", String.valueOf(uploadSlotsPerUser)) + props.setProperty("enableChat", String.valueOf(enableChat)) DataUtil.writeEncodedSet(watchedDirectories, "watchedDirectories", props) DataUtil.writeEncodedSet(watchedKeywords, "watchedKeywords", props) diff --git a/core/src/main/groovy/com/muwire/core/chat/ChatConnectionAttemptStatus.java b/core/src/main/groovy/com/muwire/core/chat/ChatConnectionAttemptStatus.java new file mode 100644 index 00000000..d736eca4 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/chat/ChatConnectionAttemptStatus.java @@ -0,0 +1,5 @@ +package com.muwire.core.chat; + +public enum ChatConnectionAttemptStatus { + SUCCESSFUL, REJECTED, FAILED +} diff --git a/core/src/main/groovy/com/muwire/core/chat/ChatConnectionEvent.groovy b/core/src/main/groovy/com/muwire/core/chat/ChatConnectionEvent.groovy new file mode 100644 index 00000000..65b314ec --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/chat/ChatConnectionEvent.groovy @@ -0,0 +1,9 @@ +package com.muwire.core.chat + +import com.muwire.core.Event +import com.muwire.core.Persona + +class ChatConnectionEvent extends Event { + ChatConnectionAttemptStatus status + Persona persona +} diff --git a/core/src/main/groovy/com/muwire/core/chat/ChatDisconnectionEvent.groovy b/core/src/main/groovy/com/muwire/core/chat/ChatDisconnectionEvent.groovy new file mode 100644 index 00000000..003361c1 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/chat/ChatDisconnectionEvent.groovy @@ -0,0 +1,8 @@ +package com.muwire.core.chat + +import com.muwire.core.Event +import com.muwire.core.Persona + +class ChatDisconnectionEvent extends Event { + Persona persona +} diff --git a/core/src/main/groovy/com/muwire/core/chat/ChatMessageEvent.groovy b/core/src/main/groovy/com/muwire/core/chat/ChatMessageEvent.groovy new file mode 100644 index 00000000..c4d103fe --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/chat/ChatMessageEvent.groovy @@ -0,0 +1,12 @@ +package com.muwire.core.chat + +import com.muwire.core.Event +import com.muwire.core.Persona + +class ChatMessageEvent extends Event { + String payload + Persona sender + String room + long chatTime + byte [] sig +}