Hi I was looking for a script that shows some of the chat history when a person logs back into the hub, ive been looking through this site and cant seem to find anything . does it exist?
just enable webserver ..-.....-... inbuildt function
will I have to open a port for this???
thanks
..
maxhistory = 40
function Main()
chathistory = dofile("chathistory.dat") or {}
end
function NewUserConnected(user)
local n = getn(chathistory)
local str = ">> last "..n.." chat messages.."
for i = 1, n do str = str.."\n"..chathistory[i] end
user:SendData(str)
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if strsub(data, 1, 1) ~= "<" then return end
tinsert(chathistory, date("[%H:%M] ")..strsub(data, 1, -2))
if getn(chathistory) > maxhistory then tremove(chathistory, 1) end
savehistory()
end
function savehistory()
local f = openfile("chathistory.dat", "w+")
assert(f, "chathistory.dat")
write(f, "return {\n")
for i = 1, getn(chathistory) do
write(f, "\t"..format("%q", chathistory[i])..",\n")
end write(f, "}") closefile(f)
end
I guess, I want it so when someone logs in they know what has been hapening so i think the last 40 messages would be all they would need.
Im not sure of the script you just put up.
the second post says its already on there but it doesnt seem to work
ok now it gets saved.. and loaded whenever you restart scripts
yeah commands.. good point :)
but yours will ignore mesages with +!? anywhere in it, you only need to check the first character.. try replace DataArrival() with this one
function DataArrival(user, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, pre = strfind(data, "^%b<> (.)")
if pre == "!" or pre == "+" or pre == "?" then return end
tinsert(chathistory, date("[%H:%M] ")..strsub(data, 1, -2))
if getn(chathistory) > maxhistory then tremove(chathistory, 1) end
savehistory()
end
also, if you want the PMs to popup you'll need to frmHub:RegBot(botname) in Main() or use an already registered botname
Hi,
If you want to the private popup come up you have to register the Bot.
Best regards, nErBoS
standard settings on dc++ wont allow the pm to pop up in pm, because standard dont allow pop up pm's from offline users, if the bot is in the userlist, then it will work fine, it will also work with nmdc, but for dc++ uwill usually need the bot registered.....
function Main()
chathistory = dofile("chathistory.dat") or {}
frmHub:RegBot(botname)
end
i've tried the chat history, but the PM's don't pop up in a new window. they come like this in main:
[09:13] Private message from ?bot?: You have not reached the minimum share ammount of 1 GB.
what do i need to change in this code i got so that they come in pm?:
--code:---------------------------------------------------------------
--Chat History On Entry 1.01
--By Mutor The Ugly 4/14/04
--
--Based entirely on a script by Tezlo 1/17/04
-----------------------------------------------------------
--Changes
--
--Send chat history to PM on entry
--Omits chat with command prefixes.
-----------------------------------------------------------
maxhistory = 20 -- maximum lines of chat to cache
botname = "?bot?"
function Main()
frmHub:RegBot(botname)
chathistory = dofile("chathistory.dat") or {}
end
function NewUserConnected(user)
local n = getn(chathistory)
local str = "<----------------------------------------------------------------------[ Last ( "..n.." ) chat messages ]----------->\r\n"
for i = 1, n do str = str.."\r\n"..chathistory end
user:SendPM(botname,str.."\r\n")
user:SendPM(botname,"<--------------------------------------------------------------------------[ End of chat history ]--------------->")
end
OpConnected = NewUserConnected
function DataArrival(user, data)
if strsub(data, 1, 1) ~= "<" then return end
local s, e, pre = strfind(data, "^%b<> (.)")
if pre == "!" or pre == "+" or pre == "?" then return end
tinsert(chathistory, date("[%H:%M] ")..strsub(data, 1, -2))
if getn(chathistory) > maxhistory then tremove(chathistory, 1) end
savehistory()
end
function savehistory()
local f = openfile("chathistory.dat", "w+")
assert(f, "chathistory.dat")
write(f, "return {\n")
for i = 1, getn(chathistory) do
write(f, "\t"..format("%q", chathistory)..",\n")
end write(f, "}") closefile(f)
end
--end code:---------------------------------------------------------
Hi,
This bot already come up with pm, probably you forgot to restart script, try that.
Best regards, nErBoS
it doesn't work with me. well, i've updated the script with the one u posted. but, i still get the chat history in main, and not in a new window (PM):
[11:08:29] Private message from ?bot?: <----------------------------------------------------------------------[ Last ( 6 ) chat messages ]----------->
- [21:50] hum...
- [21:50] com o carlos abre
- [21:50] xii
- [21:50] afinal
- [21:50] mng
- [21:51] aki nao
[11:08:29] Private message from ?bot?: <--------------------------------------------------------------------------[ End of chat history ]--------------->
[11:08:29] // Type !help in main for your available commands!
probby got pop up pms from bots in client disabled
just here to say this script works perfectly for me.
Is there a way to add like rules and stuff to the popup?
a txt fil ewould be good so I dont screw another script up
great work guys
isn't there any other way for the PM to popup in a new window, without enabling the pop up pms from bots in client, just by editing the script?