From 1fbac6583cd18defcbb58ad5415fce7bcf9fb1cd Mon Sep 17 00:00:00 2001 From: Nick Gammon Date: Thu, 16 Sep 2010 10:55:32 +1000 Subject: [PATCH] Made chat.xml the Lua version, removed VBscript version --- install/mushclient.nsi | 2 - plugins/chat.xml | 832 +++++++++++++++++------------------ plugins/lua_chat.xml | 965 ----------------------------------------- 3 files changed, 419 insertions(+), 1380 deletions(-) delete mode 100644 plugins/lua_chat.xml diff --git a/install/mushclient.nsi b/install/mushclient.nsi index ae4fa1ac..a211ee98 100644 --- a/install/mushclient.nsi +++ b/install/mushclient.nsi @@ -454,7 +454,6 @@ Section "Plugins" File "..\plugins\Timer.xml" File "..\plugins\ShowActivity.xml" File "..\plugins\Installer_sumcheck.xml" - File "..\plugins\lua_chat.xml" File "..\plugins\Current_Output_Window.xml" File "..\plugins\InfoBox_Demo.xml" File "..\plugins\ATCP_NJG.xml" @@ -680,7 +679,6 @@ Section Uninstall Delete "$INSTDIR\worlds\plugins\Timer.xml" Delete "$INSTDIR\worlds\plugins\ShowActivity.xml" Delete "$INSTDIR\worlds\plugins\Installer_sumcheck.xml" - Delete "$INSTDIR\worlds\plugins\lua_chat.xml" Delete "$INSTDIR\worlds\plugins\Current_Output_Window.xml" Delete "$INSTDIR\worlds\plugins\InfoBox_Demo.xml" Delete "$INSTDIR\worlds\plugins\ATCP_NJG.xml" diff --git a/plugins/chat.xml b/plugins/chat.xml index 805e998c..9d5d0754 100644 --- a/plugins/chat.xml +++ b/plugins/chat.xml @@ -1,12 +1,9 @@ - + ]> - - - - + @@ -124,7 +117,7 @@ Flags sequence="100" echo_alias="y" > - ChatMessage ChatGetID ("%1"), 30, "" + ChatMessage (ChatGetID ("%1"), 30, "") - ChatMessage ChatGetID ("%1"), 105, "%2" + ChatMessage (ChatGetID ("%1"), 105, "%2") - if SetChatOption (ChatGetID ("%1"), "can_snoop", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_snoop", 1) == 0 then Note "Snooping for %1 enabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "group", "%2") = 0 then + if SetChatOption (ChatGetID ("%1"), "group", "%2") == 0 then Note "%1 is now in group '%2'" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "can_snoop", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_snoop", 0) == 0 then Note "Snooping for %1 disabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "can_send_files", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_send_files", 1) == 0 then Note "File sending for %1 enabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "can_send_files", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_send_files", 0) == 0 then Note "File sending for %1 disabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "can_send_commands", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_send_commands", 1) == 0 then Note "Command sending for %1 enabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "can_send_commands", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "can_send_commands", 0) == 0 then Note "Command sending for %1 disabled" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "ignore", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "ignore", 1) == 0 then Note "Now ignoring %1" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "ignore", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "ignore", 0) == 0 then Note "Not ignoring %1" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "private", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "private", 1) == 0 then Note "%1 is now marked private" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "private", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "private", 0) == 0 then Note "%1 is now NOT private" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "served", 1) = 0 then + if SetChatOption (ChatGetID ("%1"), "served", 1) == 0 then Note "%1 is now marked as served (incoming)" -end if +end -- if sequence="100" echo_alias="y" > - if SetChatOption (ChatGetID ("%1"), "served", 0) = 0 then + if SetChatOption (ChatGetID ("%1"), "served", 0) == 0 then Note "%1 is now NOT marked as served (ie. now outgoing)" -end if +end -- if sequence="100" echo_alias="y" > - ChatPasteText ChatGetID ("%1") + ChatPasteText (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ChatPasteEverybody + ChatPasteEverybody () sequence="100" echo_alias="y" > - ChatPing ChatGetID ("%1") + ChatPing (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ChatSendFile ChatGetID ("%1"), "" + ChatSendFile (ChatGetID ("%1"), "") sequence="100" echo_alias="y" > - ChatStopFileTransfer ChatGetID ("%1") + ChatStopFileTransfer (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ChatPeekConnections ChatGetID ("%1") + ChatPeekConnections (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ChatRequestConnections ChatGetID ("%1") + ChatRequestConnections (ChatGetID ("%1")) sequence="90" echo_alias="y" > - ChatAcceptCalls %1 + ChatAcceptCalls (%1) sequence="90" echo_alias="y" > - ChatAcceptCalls 0 + ChatAcceptCalls (0) sequence="90" echo_alias="y" > - ChatStopAcceptingCalls + ChatStopAcceptingCalls () send_to="12" sequence="100" > - ChatPersonal "%1", "%2", 0 + ChatPersonal ("%1", "%2", 0) send_to="12" sequence="100" > - ChatGroup "%1", "%2", 0 + ChatGroup ("%1", "%2", 0) send_to="12" sequence="100" > - ChatGroup "%1", "%2", 1 + ChatGroup ("%1", "%2", 1) send_to="12" sequence="100" > - ChatEverybody "%1", 0 + ChatEverybody ("%1", 0) send_to="12" sequence="100" > - ChatList + ChatList () send_to="12" sequence="100" > - ChatEverybody "%1", 1 + ChatEverybody ("%1", 1) send_to="12" sequence="100" > - ChatDisconnect ChatGetID ("%1") + ChatDisconnect (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ChatDisconnectAll + ChatDisconnectAll () sequence="100" echo_alias="y" > - call ChatInfo + ChatInfo () send_to="12" sequence="100" > - ChatPersonal "%1", "%2", 1 + ChatPersonal ("%1", "%2", 1) send_to="12" sequence="100" > - ChatCall "%1", 0 + ChatCall ("%1", 0) sequence="90" echo_alias="y" > - ChatCall "%1", %2 + ChatCall ("%1", %2) sequence="90" echo_alias="y" > - ChatDetails ChatGetID ("%1") + ChatDetails (ChatGetID ("%1")) sequence="100" echo_alias="y" > - ShowChats + ShowChats () @@ -528,409 +521,422 @@ end if function YesNo (what) if what then - YesNo = "Yes" + return "Yes" else - YesNo = "No" - end if + return "No" + end -- if + +end -- function + +function ConvertDate (what) + + if what and what > 0 then + return os.date ("%x %X", what) + end -- if -end function + return "(no date)" -sub chatdetails (id) -dim sType +end -- function -' -' no id - give up -' +function ChatDetails (id) +local sType - if id = 0 then exit sub +-- +-- no id - give up +-- - if GetChatInfo (id, 10) = 0 then + if id == 0 then + return + end -- if no id + + if GetChatInfo (id, 10) == 0 then sType = "MudMaster" else sType = "zChat" - end if + 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 : " & GetChatInfo (id, 20) - Note "Started at : " & GetChatInfo (id, 21) - Note "Last in : " & GetChatInfo (id, 22) - Note "Last out : " & GetChatInfo (id, 23) - Note "Started file : " & 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 ("----------------------------------------") + 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 sub +end -- function -sub showchats +function ShowChats () -dim mylist +local mylist -mylist = GetChatList +mylist = GetChatList () -if not IsEmpty (mylist) then +if mylist then Note "" - ColourNote "white", "blue", "---- Chat List ----" + ColourNote ("white", "blue", "---- Chat List ----") Note "" - For Each id In myList - chatdetails (id) - Next + for _, id in pairs (mylist) do + ChatDetails (id) + end -- for else - ColourNote "white", "red", "No chat sessions" -End If + ColourNote ("white", "red", "No chat sessions") +end -- if + +end -- function ShowChats + +function ChatList () -End Sub +local mylist, flags, id -sub chatlist +mylist = GetChatList () -dim mylist, flags +local function addflag (id, which, str) -mylist = GetChatList + if GetChatInfo (id, which) then + if flags ~= "" then + flags = flags .. ", " + end -- if + flags = flags .. str + end -- if -if not IsEmpty (mylist) then +end -- function addflag + +if mylist then Note "" - ColourNote "white", "blue", "---- Chats ----" + ColourNote ("white", "blue", "---- Chats ----") Note "" - For Each id In myList + for _, id in ipairs (mylist) do flags = "" - ' look for flags - if GetChatInfo (id, 17) then - if flags <> "" then flags = flags & ", " - flags = flags & "private" - end if - - if GetChatInfo (id, 12) then - if flags <> "" then flags = flags & ", " - flags = flags & "served" - end if - - if GetChatInfo (id, 13) then - if flags <> "" then flags = flags & ", " - flags = flags & "can snoop" - end if - - if GetChatInfo (id, 14) then - if flags <> "" then flags = flags & ", " - flags = flags & "snooping" - end if - - if GetChatInfo (id, 16) then - if flags <> "" then flags = flags & ", " - flags = flags & "can send commands" - end if - - if GetChatInfo (id, 18) then - if flags <> "" then flags = flags & ", " - flags = flags & "can send files" - end if - - if GetChatInfo (id, 19) then - if flags <> "" then flags = flags & ", " - flags = flags & "ignore" - end if - - if flags <> "" then - flags = " (" & flags & ")" - end if - - Note id & ": " & _ - GetChatInfo (id, 2) & " (" & _ - GetChatInfo (id, 5) & ", " & _ - GetChatInfo (id, 8) & ")" & _ - flags - - Next + -- 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 + ColourNote ("white", "red", "No chat sessions") + +end -- if Note "" -end sub +end -- function ChatList -sub ChatInfo +function ChatInfo () Note "" - ColourNote "white", "blue", "---- Chat Configuration ----" + ColourNote ("white", "blue", "---- Chat Configuration ----") Note "" - Note "Accepting incoming connections: " & _ - CBool (GetOption ("accept_chat_connections")) - Note "Incoming connections port: " & _ - GetOption ("chat_port") - Note "Our chat name: " & _ - GetAlphaOption ("chat_name") + Note ("Accepting incoming connections: " .. + YesNo (GetOption ("accept_chat_connections"))) + Note ("Incoming connections port: " .. + GetOption ("chat_port")) + Note ("Our chat name: " .. + GetAlphaOption ("chat_name")) - call chatlist + ChatList () -end sub +end -- function ChatInfo -' -' Chat callbacks -' -------------- -' +-- +-- Chat callbacks +-- -------------- +-- -' OnPluginChatAccept -' ------------------ -' -' MUSHclient has received a connection from IP,name -' Return TRUE to accept it, FALSE to reject it -' -Function OnPluginChatAccept (sText) -dim theList -dim username, ip, domain +-- 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 = split (sText, ",") - ip = theList (0) - username = theList (1) + theList = utils.split (sText, ",") + ip = theList [1] + username = theList [2] -' -' Example of looking up their domain name: -' +-- +-- Example of looking up their domain name: +-- -' domain = GetHostName (ip) +-- 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 user notifications: +-- +-- Note "** Received chat call from " .. username .. " at address " .. ip +-- +-- Note "** Received chat call from " .. username .. " at domain " .. domain - OnPluginChatAccept = vbTrue ' accept it +-- +-- Example of rejecting someone (uncomment and change address): +-- +-- if ip == "111.222.10.3" then +-- return false +-- end -- if +-- -' -' Example of rejecting someone (uncomment and change address): -' -' if ip = "111.222.10.3" then OnPluginChatAccept = vbFalse -' + return true -- accept it -End Function +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) - - OnPluginChatMessage = vbTrue ' process it - -' -' Example of rejecting a message: -' -' if message = 26 then OnPluginChatMessage = vbFalse ' ignore pings -' - -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) - - OnPluginChatDisplay = vbTrue ' display it - -' -' Example of rejecting a message: -' -' if message = 10 then OnPluginChatDisplay = vbFalse ' ignore peek lists -' - -' -' 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", Replace (StripANSI (sText), chr (10), vbCrLf) -' OnPluginChatDisplay = vbFalse -' 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, FormatDateTime (Now, vbShortTime) & ": " & sText -' OnPluginChatDisplay = vbFalse -' End If +-- 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 -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). -' - -sub 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 LCase (name) = "bruce" then -' SetChatOption id, "can_send_files", 1 -' SetChatOption id, "private", 1 -' end if - -end sub - - -' 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. -' -sub OnPluginChatUserDisconnect (id, name) - -' Example of notifying yourself someone has left ... -' -' Note "Chat user: " & name & " has left the chat system." -' - -end sub +-- 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") ]]> @@ -950,9 +956,9 @@ end sub diff --git a/plugins/lua_chat.xml b/plugins/lua_chat.xml deleted file mode 100644 index 9d5d0754..00000000 --- a/plugins/lua_chat.xml +++ /dev/null @@ -1,965 +0,0 @@ - - -]> - - - - - - - - - - -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 - - - - - - - - - - - ChatMessage (ChatGetID ("%1"), 30, "") - - - - ChatMessage (ChatGetID ("%1"), 105, "%2") - - - - if SetChatOption (ChatGetID ("%1"), "can_snoop", 1) == 0 then - Note "Snooping for %1 enabled" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "group", "%2") == 0 then - Note "%1 is now in group '%2'" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "can_snoop", 0) == 0 then - Note "Snooping for %1 disabled" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "can_send_files", 1) == 0 then - Note "File sending for %1 enabled" -end -- if - - - if SetChatOption (ChatGetID ("%1"), "can_send_files", 0) == 0 then - Note "File sending for %1 disabled" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "can_send_commands", 1) == 0 then - Note "Command sending for %1 enabled" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "can_send_commands", 0) == 0 then - Note "Command sending for %1 disabled" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "ignore", 1) == 0 then - Note "Now ignoring %1" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "ignore", 0) == 0 then - Note "Not ignoring %1" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "private", 1) == 0 then - Note "%1 is now marked private" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "private", 0) == 0 then - Note "%1 is now NOT private" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "served", 1) == 0 then - Note "%1 is now marked as served (incoming)" -end -- if - - - - if SetChatOption (ChatGetID ("%1"), "served", 0) == 0 then - Note "%1 is now NOT marked as served (ie. now outgoing)" -end -- if - - - - ChatPasteText (ChatGetID ("%1")) - - - - ChatPasteEverybody () - - - - ChatPing (ChatGetID ("%1")) - - - - ChatSendFile (ChatGetID ("%1"), "") - - - - ChatStopFileTransfer (ChatGetID ("%1")) - - - - ChatPeekConnections (ChatGetID ("%1")) - - - ChatRequestConnections (ChatGetID ("%1")) - - - ChatAcceptCalls (%1) - - - ChatAcceptCalls (0) - - - ChatNameChange "%1" - - - ChatStopAcceptingCalls () - - - - ChatPersonal ("%1", "%2", 0) - - - - ChatGroup ("%1", "%2", 0) - - - - ChatGroup ("%1", "%2", 1) - - - - ChatEverybody ("%1", 0) - - - ChatList () - - - ChatEverybody ("%1", 1) - - - ChatDisconnect (ChatGetID ("%1")) - - - ChatDisconnectAll () - - - ChatInfo () - - - ChatPersonal ("%1", "%2", 1) - - - ChatCall ("%1", 0) - - - ChatCall ("%1", %2) - - - ChatDetails (ChatGetID ("%1")) - - - ShowChats () - - - - - - - - - - - - - - - - - - -