summaryrefslogtreecommitdiffstats
blob: 3cecd9daa0e9e590759b4781c708bfae9dfe59f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function irssi_log_to_file(muc, line)
	filename = muc:gsub("@", "_at_")
	filename = filename:gsub("%.%.", "_")
	filename = filename:gsub("/", "_")
	filename = filename:gsub("\\", "_")
	file = io.open(filename, "a+")
	if file == nil then
		io.close()
	else
		file:write(line)
		file:write("\n")
		file:close()
	end
	
end

function irssi_log_message(body, muc, nick, message)
	time = os.date("%H:%M")
	irssi_log_to_file(muc, time.." <"..nick.."> "..body)
end

swiftob_register_listener(irssi_log_message)