diff --git a/osu!.sql b/osu!.sql index d95a428..1d3200b 100755 --- a/osu!.sql +++ b/osu!.sql @@ -47,7 +47,8 @@ CREATE TABLE `users_info` ( `web_session` varchar(64) NOT NULL, `verification_needed` tinyint(1) NOT NULL DEFAULT '0', `password_change_required` tinyint(1) NOT NULL, - `has_old_password` tinyint(1) NOT NULL DEFAULT '0' + `has_old_password` tinyint(1) NOT NULL DEFAULT '0', + `away_message` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `users_modes_info` ( diff --git a/server/Packets/SetAwayMessage.js b/server/Packets/SetAwayMessage.js new file mode 100644 index 0000000..be72127 --- /dev/null +++ b/server/Packets/SetAwayMessage.js @@ -0,0 +1,4 @@ +module.exports = function(CurrentUser, Message) { + if (/[^0-9A-Za-z]/.test(Message.message)) return; + global.DatabaseHelper.query(`UPDATE users_info SET away_message = '${Message.message}' WHERE id = ${CurrentUser.id}`); +} \ No newline at end of file diff --git a/server/serverHandler.js b/server/serverHandler.js index c7ca911..f74ae4f 100644 --- a/server/serverHandler.js +++ b/server/serverHandler.js @@ -120,6 +120,7 @@ const ChangeAction = require("./Packets/ChangeAction.js"), Spectator = require("./Spectator.js"), SendPrivateMessage = require("./Packets/SendPrivateMessage.js"), MultiplayerManager = require("./MultiplayerManager.js"), + SetAwayMessage = require("./Packets/SetAwayMessage.js"), ChannelJoin = require("./Packets/ChannelJoin.js"), ChannelPart = require("./Packets/ChannelPart.js"), AddFriend = require("./Packets/AddFriend.js"), @@ -299,6 +300,10 @@ module.exports = async function(req, res) { ChannelPart(PacketUser, CurrentPacket.data); break; + case packetIDs.client_setAwayMessage: + SetAwayMessage(PacketUser, CurrentPacket.data); + break; + case packetIDs.client_friendAdd: AddFriend(PacketUser, CurrentPacket.data); break;