wildfire chat server source initial submit
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
||||
+2
-60
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
@@ -16,68 +16,10 @@
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||
|
||||
import java.io.Serializable;
|
||||
import static io.moquette.spi.IMessagesStore.StoredMessage;
|
||||
|
||||
public class InterceptAcknowledgedMessage implements InterceptMessage {
|
||||
|
||||
class StoredMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1755296138639817304L;
|
||||
private MqttQoS m_qos;
|
||||
final byte[] m_payload;
|
||||
final String m_topic;
|
||||
private boolean m_retained;
|
||||
private String m_clientID;
|
||||
|
||||
public StoredMessage(byte[] message, MqttQoS qos, String topic) {
|
||||
m_qos = qos;
|
||||
m_payload = message;
|
||||
m_topic = topic;
|
||||
}
|
||||
|
||||
public void setQos(MqttQoS qos) {
|
||||
this.m_qos = qos;
|
||||
}
|
||||
|
||||
public MqttQoS getQos() {
|
||||
return m_qos;
|
||||
}
|
||||
|
||||
public String getTopic() {
|
||||
return m_topic;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return m_clientID;
|
||||
}
|
||||
|
||||
public void setClientID(String m_clientID) {
|
||||
this.m_clientID = m_clientID;
|
||||
}
|
||||
|
||||
public ByteBuf getPayload() {
|
||||
return Unpooled.copiedBuffer(m_payload);
|
||||
}
|
||||
|
||||
public void setRetained(boolean retained) {
|
||||
this.m_retained = retained;
|
||||
}
|
||||
|
||||
public boolean isRetained() {
|
||||
return m_retained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PublishEvent{clientID='" + m_clientID + '\'' + ", m_retain="
|
||||
+ m_retained + ", m_qos=" + m_qos + ", m_topic='" + m_topic + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
||||
private final StoredMessage msg;
|
||||
private final String username;
|
||||
private final String topic;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
@@ -18,8 +18,6 @@ package io.moquette.interception.messages;
|
||||
|
||||
import io.netty.handler.codec.mqtt.MqttConnectMessage;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class InterceptConnectMessage extends InterceptAbstractMessage {
|
||||
|
||||
private final MqttConnectMessage msg;
|
||||
@@ -74,7 +72,7 @@ public class InterceptConnectMessage extends InterceptAbstractMessage {
|
||||
}
|
||||
|
||||
public byte[] getPassword() {
|
||||
return msg.payload().password().getBytes(StandardCharsets.UTF_8);
|
||||
return msg.payload().password();
|
||||
}
|
||||
|
||||
public String getWillTopic() {
|
||||
@@ -82,6 +80,6 @@ public class InterceptConnectMessage extends InterceptAbstractMessage {
|
||||
}
|
||||
|
||||
public byte[] getWillMessage() {
|
||||
return msg.payload().willMessage().getBytes(StandardCharsets.UTF_8);
|
||||
return msg.payload().willMessage().getBytes();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
||||
+36
-36
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
public class InterceptDisconnectMessage implements InterceptMessage {
|
||||
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptDisconnectMessage(String clientID, String username) {
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
public class InterceptDisconnectMessage implements InterceptMessage {
|
||||
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptDisconnectMessage(String clientID, String username) {
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
|
||||
+50
-50
@@ -1,50 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||
|
||||
public class InterceptPublishMessage extends InterceptAbstractMessage {
|
||||
|
||||
private final MqttPublishMessage msg;
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptPublishMessage(MqttPublishMessage msg, String clientID, String username) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return msg.variableHeader().topicName();
|
||||
}
|
||||
|
||||
public ByteBuf getPayload() {
|
||||
return msg.payload();
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2012-2017 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.handler.codec.mqtt.MqttPublishMessage;
|
||||
|
||||
public class InterceptPublishMessage extends InterceptAbstractMessage {
|
||||
|
||||
private final MqttPublishMessage msg;
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptPublishMessage(MqttPublishMessage msg, String clientID, String username) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return msg.variableHeader().topicName();
|
||||
}
|
||||
|
||||
public ByteBuf getPayload() {
|
||||
return msg.payload();
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
import io.moquette.broker.subscriptions.Subscription;
|
||||
import io.netty.handler.codec.mqtt.MqttQoS;
|
||||
|
||||
public class InterceptSubscribeMessage implements InterceptMessage {
|
||||
|
||||
private final Subscription subscription;
|
||||
private final String username;
|
||||
|
||||
public InterceptSubscribeMessage(Subscription subscription, String username) {
|
||||
this.subscription = subscription;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return subscription.getClientId();
|
||||
}
|
||||
|
||||
public MqttQoS getRequestedQos() {
|
||||
return subscription.getRequestedQos();
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return subscription.getTopicFilter().toString();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012-2018 The original author or authors
|
||||
* ------------------------------------------------------
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* and Apache License v2.0 which accompanies this distribution.
|
||||
*
|
||||
* The Eclipse Public License is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* The Apache License v2.0 is available at
|
||||
* http://www.opensource.org/licenses/apache2.0.php
|
||||
*
|
||||
* You may elect to redistribute this code under either of these licenses.
|
||||
*/
|
||||
|
||||
package io.moquette.interception.messages;
|
||||
|
||||
public class InterceptUnsubscribeMessage implements InterceptMessage {
|
||||
|
||||
private final String topicFilter;
|
||||
private final String clientID;
|
||||
private final String username;
|
||||
|
||||
public InterceptUnsubscribeMessage(String topicFilter, String clientID, String username) {
|
||||
this.topicFilter = topicFilter;
|
||||
this.clientID = clientID;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getTopicFilter() {
|
||||
return topicFilter;
|
||||
}
|
||||
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user