mudgangster

Log | Files | Refs

commit b20bdba94730f7fc92585b6bcde37bb416128fad
parent dd4d191d9224299b41d2b97c20b207c5a144dc39
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat, 15 Mar 2014 17:38:09 +0000

Add /silentpm

Diffstat:
chat.lua | 24++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/chat.lua b/chat.lua @@ -145,17 +145,33 @@ mud.alias( "/call", { [ "^(%S+)[%s:]+(%d+)$" ] = call, }, "<address> [port]" ) -mud.alias( "/pm", { +local function sendPM( client, message ) + local named = "\nHirve chats to you, '" .. message .. "'" + local data = CommandBytes.pm .. named .. "\n\255" + + client.socket:send( data ) +end + +mud.alias( "/silentpm", { [ "^(%S+)%s+(.-)$" ] = function( name, message ) local client = clientFromName( name ) if client then local coloured = message:parseColours() - local named = "\nHirve chats to you, '" .. coloured .. "'" - local data = CommandBytes.pm .. named .. "\n\255" + sendPM( client, coloured ) + end + end, +} ) - client.socket:send( data ) +mud.alias( "/pm", { + [ "^(%S+)%s+(.-)$" ] = function( name, message ) + local client = clientFromName( name ) + + if client then + local coloured = message:parseColours() + + sendPM( client, coloured ) local toPrint = ( "You chat to %s, '" % client.name ) .. coloured .. "'"