From ec4fdff8db712855001994174f487802a67f633e Mon Sep 17 00:00:00 2001 From: nishithshah2211 Date: Thu, 24 Sep 2015 10:01:50 +0530 Subject: [PATCH] Restrict temp users from writing to mainchat * Show error when temp users write to mainchat. * Don't maintain history for messages to mainchat by temp users. --- chatlogger.lua | 2 ++ external/restrict/chat.lua | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/chatlogger.lua b/chatlogger.lua index 4b2ebc5..2c81950 100644 --- a/chatlogger.lua +++ b/chatlogger.lua @@ -14,6 +14,7 @@ local tConfig, tChatHistory = { sTimeFormat = "[%I:%M:%S %p] ", sPath = Core.GetPtokaXPath().."scripts/texts/", iMaxLines = 100, + iTempProfile = 6, }, { "Hi!" } local tTickers = { tTopics = {}, @@ -80,6 +81,7 @@ function OnTimer( iTimerID ) end function AddHistory( tUser, sInput, bIsCommand ) + if tUser.iProfile == tConfig.iTempProfile then return false end local sChatLine = os.date( tConfig.sTimeFormat )..sInput if not( bIsCommand and tConfig.sProfiles:find(tUser.iProfile) ) then table.insert( tChatHistory, sChatLine ) diff --git a/external/restrict/chat.lua b/external/restrict/chat.lua index a316a12..6b3a4d5 100644 --- a/external/restrict/chat.lua +++ b/external/restrict/chat.lua @@ -11,7 +11,7 @@ function RestrictChat( sBotName, Error ) local sError = ( "<%s> %s" ):format( sBotName, Error("gen", 2) ) return function( tUser, sMessage, bFlag ) if not bFlag then return bFlag end - if tUser.iProfile == -1 then + if tUser.iProfile == -1 or tUser.iProfile == 6 then Core.SendToUser( tUser, sError ) return true end