summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiftob/scripts/irssiLogs.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/Swiftob/scripts/irssiLogs.lua b/Swiftob/scripts/irssiLogs.lua
new file mode 100644
index 0000000..3cecd9d
--- /dev/null
+++ b/Swiftob/scripts/irssiLogs.lua
@@ -0,0 +1,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)
+