Removed floofchat compatibility.

This commit is contained in:
armored-dragon 2024-11-30 00:32:20 -06:00
parent 6e4899f2c8
commit 8882468f3e
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B

View file

@ -28,7 +28,6 @@
var palData = AvatarManager.getPalData().data;
Controller.keyPressEvent.connect(keyPressEvent);
Messages.subscribe("Chat"); // Floofchat
Messages.subscribe("chat");
Messages.messageReceived.connect(receivedMessage);
AvatarManager.avatarAddedEvent.connect((sessionId) => {
@ -104,10 +103,7 @@
const timeArray = _formatTimestamp(currentTimestamp);
if (!message.channel) message.channel = "domain"; // We don't know where to put this message. Assume it is a domain wide message.
if (message.forApp) return; // Floofchat
// Floofchat compatibility hook
message = floofChatCompatibilityConversion(message);
message.channel = message.channel.toLowerCase();
// Check the channel. If the channel is not one we have, do nothing.
@ -216,8 +212,6 @@
action: "send_chat_message",
})
);
floofChatCompatibilitySendMessage(message, channel);
}
function _avatarAction(type, sessionId) {
Script.setTimeout(() => {
@ -304,34 +298,4 @@
function _emitEvent(packet = { type: "" }) {
chatOverlayWindow.sendToQml(packet);
}
//
// Floofchat compatibility functions
// Added to ease the transition between Floofchat to ArmoredChat
// These functions can be safely removed at a much later date.
function floofChatCompatibilityConversion(message) {
if (message.type === "TransmitChatMessage" && !message.forApp) {
return {
position: message.position,
message: message.message,
displayName: message.displayName,
channel: message.channel.toLowerCase(),
};
}
return message;
}
function floofChatCompatibilitySendMessage(message, channel) {
Messages.sendMessage(
"Chat",
JSON.stringify({
position: MyAvatar.position,
message: message,
displayName: MyAvatar.sessionDisplayName,
channel: channel.charAt(0).toUpperCase() + channel.slice(1),
type: "TransmitChatMessage",
forApp: "Floof",
})
);
}
})();