966 lines
22 KiB
XML
966 lines
22 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!DOCTYPE muclient [
|
|
<!ENTITY prefix "#" >
|
|
]>
|
|
|
|
<!-- Plugin "Chat" adapted by Nick from the VBscript version -->
|
|
|
|
<!-- Change the "prefix" entity above to change the chat alias prefix.
|
|
The default is "#", so you would enter "#chat Nick Hi", but you
|
|
could make it "-" for instance. -->
|
|
|
|
<muclient>
|
|
<plugin
|
|
name="Chat"
|
|
author="Nick Gammon"
|
|
id="03ca99c4e98d2a3e6d655c7d"
|
|
language="Lua"
|
|
purpose="Support for chat feature"
|
|
date_written="2005-12-18 07:32:00"
|
|
date_modified="2005-12-21 13:26:00"
|
|
requires="3.72"
|
|
version="1.0"
|
|
>
|
|
<!--
|
|
Version 1 - initial release.
|
|
-->
|
|
|
|
<description trim="y">
|
|
Provides an interface to the chat functions.
|
|
|
|
Commands
|
|
========
|
|
|
|
chat:help <-- show this help screen
|
|
|
|
For commands affecting a chat connection you can either use their name
|
|
(eg. Nick) or their connection number (eg. 5). Both appear when you type
|
|
"&prefix;chats".
|
|
|
|
General
|
|
-------
|
|
|
|
&prefix;chats <-- get connected chat list (note chat ID on left)
|
|
&prefix;chatdetails [who] <-- shows full details for one or all connections
|
|
&prefix;info <-- shows chat status and chat list
|
|
|
|
Accept calls
|
|
------------
|
|
|
|
&prefix;accept <-- accept connections on current port
|
|
&prefix;accept port <-- accept connections on 'port' eg. &prefix;accept 4052
|
|
&prefix;nocalls <-- stop accepting incoming calls
|
|
|
|
Calling someone
|
|
---------------
|
|
|
|
&prefix;call ip port <-- attempts to call user on at IP address and port
|
|
&prefix;call ip <-- attempts to call user on at IP address, port 4050
|
|
&prefix;hangup who <-- hangs up a call
|
|
&prefix;hangupall <-- hangs up all calls
|
|
|
|
|
|
Chatting
|
|
--------
|
|
|
|
&prefix;chat who xxx <-- sends message to person, eg. &prefix;chat Nick Hi there
|
|
&prefix;chatall xxxx <-- sends message to all connections
|
|
&prefix;cg group xxxx <-- sends message to everyone in group 'group'
|
|
&prefix;emote who xx <-- emotes to one person, eg. &prefix;emote Nick laughs
|
|
&prefix;emoteall xxx <-- emotes to all, eg. &prefix;emoteall sighs
|
|
&prefix;eg group xxxx <-- emotes to everyone in group 'group'
|
|
|
|
Other
|
|
-----
|
|
|
|
&prefix;command who xxx <-- send command "xxx" to that person
|
|
&prefix;group who xxx <-- places this person into group "xxx"
|
|
&prefix;name newname <-- change your chat name, eg. &prefix;name Nick
|
|
&prefix;peek who <-- peek this person's connections
|
|
&prefix;paste who <-- paste clipboard to this connection
|
|
&prefix;pasteall <-- paste clipboard to everybody
|
|
&prefix;ping who <-- ping this connection
|
|
&prefix;request who <-- try to connect to this person's connections
|
|
&prefix;sendfile who <-- send a file to this connection
|
|
&prefix;stopfile who <-- stop sending a file to this connection
|
|
&prefix;snoop who <-- start/stop snooping this connection
|
|
|
|
Flags
|
|
-----
|
|
|
|
&prefix;allowcommands who <-- allow them to send me commands
|
|
&prefix;allowfiles who <-- allow them to send me files
|
|
&prefix;allowsnoop who <-- allow them to snoop me
|
|
&prefix;ignore who <-- ignore them
|
|
&prefix;private who <-- mark connection private
|
|
&prefix;served who <-- mark them as incoming
|
|
|
|
&prefix;noallowcommands who <-- turn off above options
|
|
&prefix;noallowfiles who
|
|
&prefix;noallowsnoop who
|
|
&prefix;noignore who
|
|
&prefix;noprivate who
|
|
&prefix;noserved who
|
|
|
|
</description>
|
|
|
|
</plugin>
|
|
|
|
|
|
<!-- Aliases -->
|
|
|
|
<aliases>
|
|
<alias
|
|
match="&prefix;snoop *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatMessage (ChatGetID ("%1"), 30, "")</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;command * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatMessage (ChatGetID ("%1"), 105, "%2")</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;allowsnoop *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_snoop", 1) == 0 then
|
|
Note "Snooping for %1 enabled"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;group * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "group", "%2") == 0 then
|
|
Note "%1 is now in group '%2'"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;noallowsnoop *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_snoop", 0) == 0 then
|
|
Note "Snooping for %1 disabled"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;allowfiles *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_send_files", 1) == 0 then
|
|
Note "File sending for %1 enabled"
|
|
end -- if</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;noallowfiles *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_send_files", 0) == 0 then
|
|
Note "File sending for %1 disabled"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;allowcommands *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_send_commands", 1) == 0 then
|
|
Note "Command sending for %1 enabled"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;noallowcommands *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "can_send_commands", 0) == 0 then
|
|
Note "Command sending for %1 disabled"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;ignore *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "ignore", 1) == 0 then
|
|
Note "Now ignoring %1"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;noignore *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "ignore", 0) == 0 then
|
|
Note "Not ignoring %1"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;private *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "private", 1) == 0 then
|
|
Note "%1 is now marked private"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;noprivate *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "private", 0) == 0 then
|
|
Note "%1 is now NOT private"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;served *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "served", 1) == 0 then
|
|
Note "%1 is now marked as served (incoming)"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;noserved *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>if SetChatOption (ChatGetID ("%1"), "served", 0) == 0 then
|
|
Note "%1 is now NOT marked as served (ie. now outgoing)"
|
|
end -- if</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;paste *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatPasteText (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;pasteall"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatPasteEverybody ()</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;ping *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatPing (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;sendfile *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatSendFile (ChatGetID ("%1"), "")</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;stopfile *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatStopFileTransfer (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;peek *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatPeekConnections (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;request *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatRequestConnections (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;accept *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="90"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatAcceptCalls (%1)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;accept"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="90"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatAcceptCalls (0)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;name *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatNameChange "%1"</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;nocalls"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="90"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatStopAcceptingCalls ()</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;chat * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatPersonal ("%1", "%2", 0)</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;cg * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatGroup ("%1", "%2", 0)</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;eg * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatGroup ("%1", "%2", 1)</send>
|
|
</alias>
|
|
|
|
<alias
|
|
match="&prefix;chatall *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatEverybody ("%1", 0)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;chats"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatList ()</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;emoteall *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatEverybody ("%1", 1)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;hangup *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatDisconnect (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;hangupall"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatDisconnectAll ()</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;info"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatInfo ()</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;emote * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatPersonal ("%1", "%2", 1)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;call *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
>
|
|
<send>ChatCall ("%1", 0)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;call * *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="90"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatCall ("%1", %2)</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;chatdetails *"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="90"
|
|
echo_alias="y"
|
|
>
|
|
<send>ChatDetails (ChatGetID ("%1"))</send>
|
|
</alias>
|
|
<alias
|
|
match="&prefix;chatdetails"
|
|
enabled="y"
|
|
send_to="12"
|
|
sequence="100"
|
|
echo_alias="y"
|
|
>
|
|
<send>ShowChats ()</send>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<!-- Script -->
|
|
|
|
|
|
<script>
|
|
<![CDATA[
|
|
|
|
function YesNo (what)
|
|
|
|
if what then
|
|
return "Yes"
|
|
else
|
|
return "No"
|
|
end -- if
|
|
|
|
end -- function
|
|
|
|
function ConvertDate (what)
|
|
|
|
if what and what > 0 then
|
|
return os.date ("%x %X", what)
|
|
end -- if
|
|
|
|
return "(no date)"
|
|
|
|
end -- function
|
|
|
|
function ChatDetails (id)
|
|
local sType
|
|
|
|
--
|
|
-- no id - give up
|
|
--
|
|
|
|
if id == 0 then
|
|
return
|
|
end -- if no id
|
|
|
|
if GetChatInfo (id, 10) == 0 then
|
|
sType = "MudMaster"
|
|
else
|
|
sType = "zChat"
|
|
end -- if
|
|
|
|
Note ("----------------------------------------")
|
|
Note ("Server : " .. GetChatInfo (id, 1))
|
|
Note ("User : " .. GetChatInfo (id, 2))
|
|
Note ("Group : " .. GetChatInfo (id, 3))
|
|
Note ("Version : " .. GetChatInfo (id, 4))
|
|
Note ("Call IP : " .. GetChatInfo (id, 5))
|
|
Note ("Address : " .. GetChatInfo (id, 6))
|
|
Note ("Port : " .. GetChatInfo (id, 7))
|
|
Note ("Call port : " .. GetChatInfo (id, 8))
|
|
Note ("Status : " .. GetChatInfo (id, 9))
|
|
Note ("Type : " .. sType)
|
|
Note ("ID : " .. GetChatInfo (id, 11) )
|
|
Note ("Incoming : " .. YesNo (GetChatInfo (id, 12)))
|
|
Note ("Can snoop : " .. YesNo (GetChatInfo (id, 13)) )
|
|
Note ("Snooping : " .. YesNo (GetChatInfo (id, 14)) )
|
|
Note ("They snoop : " .. YesNo (GetChatInfo (id, 15)) )
|
|
Note ("Send commands : " .. YesNo (GetChatInfo (id, 16)) )
|
|
Note ("Private : " .. YesNo (GetChatInfo (id, 17)) )
|
|
Note ("Can send files : " .. YesNo (GetChatInfo (id, 18)) )
|
|
Note ("Ignore them : " .. YesNo (GetChatInfo (id, 19)) )
|
|
Note ("Recent ping : " .. ConvertDate (GetChatInfo (id, 20) ))
|
|
Note ("Started at : " .. ConvertDate (GetChatInfo (id, 21) ))
|
|
Note ("Last in : " .. ConvertDate (GetChatInfo (id, 22) ))
|
|
Note ("Last out : " .. ConvertDate (GetChatInfo (id, 23) ))
|
|
Note ("Started file : " .. ConvertDate (GetChatInfo (id, 24) ))
|
|
Note ("Xfer file : " .. YesNo (GetChatInfo (id, 25)) )
|
|
Note ("Xfer is send : " .. YesNo (GetChatInfo (id, 26)) )
|
|
Note ("File name : " .. GetChatInfo (id, 27) )
|
|
Note ("Full file path : " .. GetChatInfo (id, 28) )
|
|
Note ("File size bytes: " .. GetChatInfo (id, 29) )
|
|
Note ("File blocks : " .. GetChatInfo (id, 30) )
|
|
Note ("Blocks xferred : " .. GetChatInfo (id, 31))
|
|
Note ("Block size : " .. GetChatInfo (id, 32))
|
|
Note ("Count of incoming:" ..
|
|
" Personal : " .. GetChatInfo (id, 33) ..
|
|
", All : " .. GetChatInfo (id, 34) ..
|
|
", Group : " .. GetChatInfo (id, 35) ..
|
|
", Messages : " .. GetChatInfo (id, 39) )
|
|
|
|
Note ("Count of outgoing:" ..
|
|
" Personal : " .. GetChatInfo (id, 36) ..
|
|
", All : " .. GetChatInfo (id, 37) ..
|
|
", Group : " .. GetChatInfo (id, 38))
|
|
Note ""
|
|
|
|
end -- function
|
|
|
|
function ShowChats ()
|
|
|
|
local mylist
|
|
|
|
mylist = GetChatList ()
|
|
|
|
if mylist then
|
|
|
|
Note ""
|
|
ColourNote ("white", "blue", "---- Chat List ----")
|
|
Note ""
|
|
|
|
for _, id in pairs (mylist) do
|
|
ChatDetails (id)
|
|
end -- for
|
|
|
|
else
|
|
ColourNote ("white", "red", "No chat sessions")
|
|
end -- if
|
|
|
|
end -- function ShowChats
|
|
|
|
function ChatList ()
|
|
|
|
local mylist, flags, id
|
|
|
|
mylist = GetChatList ()
|
|
|
|
local function addflag (id, which, str)
|
|
|
|
if GetChatInfo (id, which) then
|
|
if flags ~= "" then
|
|
flags = flags .. ", "
|
|
end -- if
|
|
flags = flags .. str
|
|
end -- if
|
|
|
|
end -- function addflag
|
|
|
|
if mylist then
|
|
|
|
Note ""
|
|
ColourNote ("white", "blue", "---- Chats ----")
|
|
Note ""
|
|
|
|
for _, id in ipairs (mylist) do
|
|
|
|
flags = ""
|
|
|
|
-- look for flags
|
|
addflag (id, 17, "private")
|
|
addflag (id, 12, "served")
|
|
addflag (id, 13, "can snoop")
|
|
addflag (id, 14, "snooping")
|
|
addflag (id, 16, "can send commands")
|
|
addflag (id, 18, "can send files")
|
|
addflag (id, 19, "ignore")
|
|
|
|
if flags ~= "" then
|
|
flags = " (" .. flags .. ")"
|
|
end -- if
|
|
|
|
Note (id .. ": " ..
|
|
GetChatInfo (id, 2) .. " (" ..
|
|
GetChatInfo (id, 5) .. ", " ..
|
|
GetChatInfo (id, 8) .. ")" ..
|
|
flags )
|
|
|
|
end -- for
|
|
|
|
else
|
|
ColourNote ("white", "red", "No chat sessions")
|
|
|
|
end -- if
|
|
|
|
Note ""
|
|
|
|
end -- function ChatList
|
|
|
|
function ChatInfo ()
|
|
|
|
Note ""
|
|
ColourNote ("white", "blue", "---- Chat Configuration ----")
|
|
Note ""
|
|
|
|
Note ("Accepting incoming connections: " ..
|
|
YesNo (GetOption ("accept_chat_connections")))
|
|
Note ("Incoming connections port: " ..
|
|
GetOption ("chat_port"))
|
|
Note ("Our chat name: " ..
|
|
GetAlphaOption ("chat_name"))
|
|
|
|
ChatList ()
|
|
|
|
end -- function ChatInfo
|
|
|
|
--
|
|
-- Chat callbacks
|
|
-- --------------
|
|
--
|
|
|
|
-- OnPluginChatAccept
|
|
-- ------------------
|
|
--
|
|
-- MUSHclient has received a connection from IP,name
|
|
-- Return TRUE to accept it, FALSE to reject it
|
|
--
|
|
function OnPluginChatAccept (sText)
|
|
local theList
|
|
local username, ip, domain
|
|
|
|
theList = utils.split (sText, ",")
|
|
ip = theList [1]
|
|
username = theList [2]
|
|
|
|
--
|
|
-- Example of looking up their domain name:
|
|
--
|
|
|
|
-- domain = GetHostName (ip)
|
|
|
|
|
|
--
|
|
-- Example user notifications:
|
|
--
|
|
-- Note "** Received chat call from " .. username .. " at address " .. ip
|
|
--
|
|
-- Note "** Received chat call from " .. username .. " at domain " .. domain
|
|
|
|
|
|
--
|
|
-- Example of rejecting someone (uncomment and change address):
|
|
--
|
|
-- if ip == "111.222.10.3" then
|
|
-- return false
|
|
-- end -- if
|
|
--
|
|
|
|
return true -- accept it
|
|
|
|
end -- function
|
|
|
|
-- OnPluginChatMessage
|
|
-- ------------------
|
|
--
|
|
-- MUSHclient has received chat message: id, type, text
|
|
-- Return TRUE to use the default processing, FALSE to ignore it
|
|
--
|
|
--
|
|
-- The "id" argument supplies the chat id of the connection which sent the
|
|
-- message.
|
|
--
|
|
-- The message code indicating the chat message, where these are likely
|
|
-- to be received:
|
|
--
|
|
|
|
-- 1 Name_change
|
|
-- 2 Request_connections
|
|
-- 3 Connection_list
|
|
-- 4 Text_everybody
|
|
-- 5 Text_personal
|
|
-- 6 Text_group
|
|
-- 7 Message
|
|
-- 8 Do_not_disturb
|
|
-- 9 Send_action
|
|
-- 10 Send_alias
|
|
-- 11 Send_macro
|
|
-- 12 Send_variable
|
|
-- 13 Send_event
|
|
-- 14 Send_gag
|
|
-- 15 Send_highlight
|
|
-- 16 Send_list
|
|
-- 17 Send_array
|
|
-- 18 Send_baritem
|
|
-- 19 Version
|
|
-- 20 File_start
|
|
-- 21 File_deny
|
|
-- 22 File_block_request
|
|
-- 23 File_block
|
|
-- 24 File_end
|
|
-- 25 File_cancel
|
|
-- 26 Ping_request
|
|
-- 27 Ping_response
|
|
-- 28 Peek_connections
|
|
-- 29 Peek_list
|
|
-- 30 Snoop
|
|
-- 31 Snoop_data
|
|
-- 105 Send_command
|
|
|
|
function OnPluginChatMessage (id, message, sText)
|
|
|
|
--
|
|
-- Example of rejecting a message:
|
|
--
|
|
-- if message == 26 then
|
|
-- return false -- ignore pings
|
|
-- end -- if
|
|
--
|
|
|
|
return true -- process it
|
|
|
|
end -- function
|
|
|
|
|
|
-- OnPluginChatDisplay
|
|
-- ------------------
|
|
--
|
|
-- MUSHclient is about to display message: type, text
|
|
-- Return TRUE to use the default display, FALSE to not display
|
|
--
|
|
-- Note - the message type number, which groups types
|
|
-- of messages, as follows:
|
|
--
|
|
|
|
-- 0 Connection attempt
|
|
-- 1 Session start, end
|
|
-- 2 Name Change
|
|
-- 3 Message
|
|
-- 4 Incoming Personal
|
|
-- 5 Incoming Everybody
|
|
-- 6 Incoming Group
|
|
-- 7 Outgoing Personal
|
|
-- 8 Outgoing Everybody
|
|
-- 9 Outgoing Group
|
|
-- 10 Peek List
|
|
-- 11 Connection List
|
|
-- 12 Ping
|
|
-- 13 Information
|
|
-- 14 File
|
|
-- 15 Snoop Data
|
|
-- 16 Command
|
|
|
|
function OnPluginChatDisplay (message, sText)
|
|
|
|
--
|
|
-- Example of rejecting a message:
|
|
--
|
|
-- if message == 10 then
|
|
-- return false -- ignore peek lists
|
|
-- end -- if
|
|
--
|
|
|
|
--
|
|
-- Example of timestamping messages
|
|
--
|
|
-- If an incoming message type is not 1000 we prepend the date and re-display it
|
|
-- If it is 1000 (our user-assigned type) we simply let MUSHclient display it.
|
|
--
|
|
|
|
-- if message ~= 1000 then
|
|
-- ChatNote (1000, os.date ("%X %x") .. ": " .. sText)
|
|
-- return false
|
|
-- end -- if
|
|
|
|
--
|
|
-- Example of doing something different with it.
|
|
--
|
|
-- We will take normal incoming and outgoing chats and emotes, and
|
|
-- display them in a notepad window, and omit them from the main window
|
|
--
|
|
|
|
-- if message >= 4 and message <= 9 then
|
|
-- AppendToNotepad ("Chats",
|
|
-- os.date ("%X %x") .. ": " .. -- optional date/timestamp
|
|
-- Replace (StripANSI (sText), "\n", "\r\n"), "\r\n")
|
|
-- return false
|
|
-- end -- if
|
|
|
|
-- If you want to timestamp AND display in the notepad, simply put the date at
|
|
-- the start of the AppendToNotepad line by uncommenting the line above with os.date in it.
|
|
|
|
|
|
return true -- display it
|
|
|
|
end -- function
|
|
|
|
|
|
-- OnPluginChatNewUser
|
|
-- -------------------
|
|
--
|
|
-- A new plugin user has been accepted on: id, name
|
|
--
|
|
--
|
|
-- This script callback has been provided so you can take action if
|
|
-- you want (such as allowing file transfers).
|
|
--
|
|
|
|
function OnPluginChatNewUser (id, name)
|
|
|
|
--
|
|
-- Example of notifying yourself of a new chat user.
|
|
--
|
|
-- Note ("New chat user: " .. name)
|
|
--
|
|
|
|
--
|
|
-- Example of taking special action
|
|
--
|
|
-- If Bruce connects let him send files, and mark as private
|
|
--
|
|
|
|
-- if string.lower (name) == "bruce" then
|
|
-- SetChatOption (id, "can_send_files", 1)
|
|
-- SetChatOption (id, "private", 1)
|
|
-- end -- if
|
|
|
|
end -- function
|
|
|
|
|
|
-- OnPluginChatUserDisconnect
|
|
-- --------------------------
|
|
--
|
|
-- This chat user has disconnected for one reason or another.
|
|
--
|
|
-- This callback lets you take action (eg. notify others) however
|
|
-- you cannot send messages to this connection or change any options
|
|
-- once they have disconnected. The chat id is supplied so you can
|
|
-- match the id to the one that connected.
|
|
--
|
|
-- For each call to OnPluginChatNewUser there should eventually be a
|
|
-- corresponding call to OnPluginChatUserDisconnect.
|
|
--
|
|
function OnPluginChatUserDisconnect (id, name)
|
|
|
|
-- Example of notifying yourself someone has left ...
|
|
--
|
|
-- Note ("Chat user: " .. name .. " has left the chat system.")
|
|
--
|
|
|
|
end -- function
|
|
|
|
|
|
-- use local date format
|
|
|
|
os.setlocale ("", "time")
|
|
|
|
]]>
|
|
</script>
|
|
|
|
|
|
<!-- Plugin help -->
|
|
|
|
<aliases>
|
|
<alias
|
|
script="OnHelp"
|
|
match="Chat:help"
|
|
enabled="y"
|
|
ignore_case = "y"
|
|
>
|
|
</alias>
|
|
</aliases>
|
|
|
|
<script>
|
|
<![CDATA[
|
|
function OnHelp (sName, sLine, wildcards)
|
|
Note (GetPluginInfo (GetPluginID (), 3))
|
|
end -- function
|
|
]]>
|
|
</script>
|
|
|
|
</muclient>
|