# HG changeset patch # User Thilo Cestonaro # Date 1276766172 -7200 # Node ID af6143756a9e7262ced988ed9a7655d7b3f844cb # Parent 62f47a93b5b7c99dabaf158904daec7bc03c86e2 mod_muc_log_http: started new prosody theme diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/mod_muc_log_http.lua --- a/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua Mon Jun 14 22:13:33 2010 +0800 +++ b/mod_muc_log_http/muc_log_http/mod_muc_log_http.lua Thu Jun 17 11:16:12 2010 +0200 @@ -214,7 +214,7 @@ if i < days + 1 then local tmp = tostring(""..tostring(i)..""); if dayCallback ~= nil and dayCallback.callback ~= nil then - tmp = dayCallback.callback(dayCallback.path, i, month, year, dayCallback.room); + tmp = dayCallback.callback(dayCallback.path, i, month, year, dayCallback.room, dayCallback.webPath); end if tmp == nil then tmp = tostring(""..tostring(i)..""); @@ -279,7 +279,8 @@ return ""; end -local function perDayCallback(path, day, month, year, room) +local function perDayCallback(path, day, month, year, room, webPath) + local webPath = webPath or "" local year = year; if year > 2000 then year = year - 2000; @@ -288,7 +289,7 @@ local attributes, err = lfs.attributes(path.."/"..bareDay.."/"..room..".dat") if attributes ~= nil and attributes.mode == "file" then local s = html.days.bit; - s = s:gsub("###BARE_DAY###", bareDay); + s = s:gsub("###BARE_DAY###", webPath .. bareDay); s = s:gsub("###DAY###", day); return s; end @@ -302,21 +303,61 @@ local node, host, resource = splitJid(bareRoomJid); local path = data_getpath(node, host, datastore); local room = nil; + local nextRoom = ""; + local previousRoom = ""; + local rooms = ""; local attributes = nil; + local since = ""; + local to = ""; + local topic = ""; path = path:gsub("/[^/]*$", ""); attributes = lfs.attributes(path); if muc_hosts ~= nil and muc_hosts[host] and prosody.hosts[host] ~= nil and prosody.hosts[host].muc ~= nil and prosody.hosts[host].muc.rooms[bareRoomJid] ~= nil then + local found = 0; + for jid, room in pairs(prosody.hosts[host].muc.rooms) do + local node = splitJid(jid) + if not room._data.hidden and node then + if found == 0 then + previousRoom = node + elseif found == 1 then + nextRoom = node + found = -1 + end + if jid == bareRoomJid then + found = 1 + end + + rooms = rooms .. html.days.rooms.bit:gsub("###ROOM###", node); + end + end + room = prosody.hosts[host].muc.rooms[bareRoomJid]; if room._data.hidden then room = nil end end if attributes ~= nil and room ~= nil then + local first = 1; local alreadyDoneYears = {}; + local temptime = {day=0, month=0, year=0}; + topic = room._data.subject + if topic:len() > 60 then + topic = topic:sub(1, topic:find(" ", 50)) .. " ..." + end for folder in lfs.dir(path) do local year, month, day = folder:match("^(%d%d)(%d%d)(%d%d)"); if year ~= nil and alreadyDoneYears[year] == nil then + temptime.day = tonumber(day) + temptime.month = tonumber(month) + temptime.year = 2000 + tonumber(year) + if first == 1 then + to = tostring(os_date("%B %Y", os_time(temptime))) + first = 0 + end + + since = tostring(os_date("%B %Y", os_time(temptime))) + module:log("debug", "creating overview for: " .. tostring(since)) days = createYear(year, {callback=perDayCallback, path=path, room=node}) .. days; alreadyDoneYears[year] = true; end @@ -325,6 +366,12 @@ if days ~= "" then tmp = html.days.body:gsub("###DAYS_STUFF###", days); + tmp = tmp:gsub("###PREVIOUS_ROOM###", previousRoom == "" and node or previousRoom); + tmp = tmp:gsub("###NEXT_ROOM###", nextRoom == "" and node or nextRoom); + tmp = tmp:gsub("###ROOMS###", rooms); + tmp = tmp:gsub("###ROOMTOPIC###", topic); + tmp = tmp:gsub("###SINCE###", since); + tmp = tmp:gsub("###TO###", to); return tmp:gsub("###JID###", bareRoomJid); end end @@ -571,6 +618,19 @@ local year, month, day = bare_day:match("^(%d%d)(%d%d)(%d%d)"); local previousDay = findPreviousDay(bareRoomJid, bare_day); local nextDay = findNextDay(bareRoomJid, bare_day); + local temptime = {day=0, month=0, year=0}; + local path = data_getpath(node, host, datastore); + path = path:gsub("/[^/]*$", ""); + local calendar = "" + + if tonumber(year) <= 99 then + year = year + 2000; + end + + temptime.day = tonumber(day) + temptime.month = tonumber(month) + temptime.year = tonumber(year) + calendar = createMonth(temptime.month, temptime.year, {callback=perDayCallback, path=path, room=node, webPath="../"}) or "" if bare_day ~= nil then local data = data_load(node, host, datastore .. "/" .. bare_day); @@ -609,14 +669,15 @@ end if ret ~= "" then if nextDay then - nextDay = html.day.dayLink:gsub("###DAY###", nextDay):gsub("###TEXT###", "next day >>") + nextDay = html.day.dayLink:gsub("###DAY###", nextDay):gsub("###TEXT###", ">") end if previousDay then - previousDay = html.day.dayLink:gsub("###DAY###", previousDay):gsub("###TEXT###", "<< previous day"); + previousDay = html.day.dayLink:gsub("###DAY###", previousDay):gsub("###TEXT###", "<"); end ret = ret:gsub("%%", "%%%%"); tmp = html.day.body:gsub("###DAY_STUFF###", ret):gsub("###JID###", bareRoomJid); - tmp = tmp:gsub("###YEAR###", year):gsub("###MONTH###", month):gsub("###DAY###", day); + tmp = tmp:gsub("###CALENDAR###", calendar); + tmp = tmp:gsub("###DATE###", tostring(os_date("%A, %B %d, %Y", os_time(temptime)))); tmp = tmp:gsub("###TITLE_STUFF###", html.day.title:gsub("###TITLE###", roomSubject)); tmp = tmp:gsub("###STATUS_CHECKED###", config.showStatus and "checked='checked'" or ""); tmp = tmp:gsub("###JOIN_CHECKED###", config.showJoin and "checked='checked'" or ""); diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/components_bit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/components_bit.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###COMPONENT###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/components_body.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/components_body.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,3 @@ +

Available Multi-User Chats:


+###COMPONENTS_STUFF### +


\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_bann.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_bann.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TIME_STUFF### *** ###VICTIM### got banned###REASON_STUFF###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_body.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_body.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,9 @@ +

Logs for ###JID### on 20###YEAR###/###MONTH###/###DAY###

+

###TITLE_STUFF###

+Join room via speeqe.com
+###PREVIOUS_LINK### ###NEXT_LINK###
+show/hide joins and leaves       +show/hide status changes +
+###DAY_STUFF### +

diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_dayLink.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_dayLink.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TEXT### \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_kick.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_kick.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TIME_STUFF### *** ###VICTIM### got kicked###REASON_STUFF###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_message.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_message.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TIME_STUFF###<###NICK###> ###MSG###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_messageMe.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_messageMe.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TIME_STUFF###*###NICK### ###MSG###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_presence_join.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_presence_join.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +
###TIME_STUFF### *** ###NICK### has joined the room
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_presence_leave.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_presence_leave.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +
###TIME_STUFF### *** ###NICK### has left the room
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_presence_statusChange.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_presence_statusChange.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +
###TIME_STUFF### *** ###NICK### shows as "###SHOW###"###STATUS_STUFF###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_presence_statusText.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_presence_statusText.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ + and his status message is "###STATUS###" \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_reason.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_reason.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +, the reason was "###REASON###" \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_time.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_time.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +[###TIME###] \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_title.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_title.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +Subject: ###TITLE### \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/day_titleChange.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/day_titleChange.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###TIME_STUFF### *** ###NICK### changed the title to "###TITLE###"
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/days_bit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/days_bit.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###DAY###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/days_body.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/days_body.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,42 @@ + +
+ + ###ROOM###@###COMPONENT###
+ (join via client / speeqe) + +
+ +
+ + + + + + + + + + + + + +
+
+ + < + ^ + > +
+
List of rooms for this component
+
+ + http://spectrum.im | Welcome to the Spectrum support channel! | We are looking for package maintainers. | Logs: http://logs.spectrum.im/spectrum/ +

+ +
+ +
+ +
###DAYS_STUFF###
+ + diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/doc.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/doc.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,47 @@ + + + + + ###TITLE### + + + + + +
+###BODY_STUFF### +
+ + + diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/month_day.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/month_day.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ + ###DAY### \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/month_emptyDay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/month_emptyDay.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +   \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/month_footer.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/month_footer.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/month_header.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/month_header.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,5 @@ + + + + +###WEEKDAYS### diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/month_weekDay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/month_weekDay.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/rooms_bit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/rooms_bit.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +###ROOM###
\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/rooms_body.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/rooms_body.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,3 @@ +

Available rooms on ###COMPONENT###:


+###ROOMS_STUFF### +


\ No newline at end of file diff -r 62f47a93b5b7 -r af6143756a9e mod_muc_log_http/muc_log_http/themes/prosody/year_title.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_muc_log_http/muc_log_http/themes/prosody/year_title.html Thu Jun 17 11:16:12 2010 +0200 @@ -0,0 +1,1 @@ +
###YEAR###
\ No newline at end of file

###TITLE###

###DAY###