Permalink
Browse files

Added contrib dir witch'll be the collection of user scripts

  • Loading branch information...
1 parent 5bbe10d commit 69722c673fd03e44bc4d89262d08223bb0e721d9 marcin committed Jan 2, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 contrib/logging.lua
View
@@ -0,0 +1,20 @@
+--for logging
+logdir = "/absolute/path/to/gtkabber-logs/"
+
+function message_cb (from, to, msg)
+ --logging
+ who = nil
+ if string.find(from, jid) then
+ who = to
+ else
+ who = from
+ end
+ who = string.sub(who, 0, string.find(who, "/") - 1)
+ fh, asd = io.open(logdir .. who, "a")
+ if fh == nil then
+ gtkabber.print("Unable to open logfile: " .. asd .. "\n")
+ else
+ fh:write(os.date("%d/%m/%Y %H:%M:%S ") .. from .. ": " .. msg .. "\n")
+ fh:close()
+ end
+end

0 comments on commit 69722c6

Please sign in to comment.