Comparison

mod_http_muc_log/mod_http_muc_log.lua @ 3597:da7ec4ed6ddf

mod_http_muc_log: Hide join/part controls if they are not stored by mod_muc_mam
author Kim Alvefur <zash@zash.se>
date Thu, 16 May 2019 07:46:05 +0200
parent 3596:6e529f53b3c3
child 3690:8c0a6d4541d5
comparison
equal deleted inserted replaced
3596:6e529f53b3c3 3597:da7ec4ed6ddf
130 return iter(); 130 return iter();
131 end 131 end
132 132
133 local lazy = module:get_option_boolean(module.name .. "_lazy_calendar", true); 133 local lazy = module:get_option_boolean(module.name .. "_lazy_calendar", true);
134 134
135 local presence_logged = module:get_option_boolean("muc_log_presences", false);
136
135 local function hide_presence(request) 137 local function hide_presence(request)
138 if not presence_logged then
139 return false;
140 end
136 if request.url.query then 141 if request.url.query then
137 local data = httplib.formdecode(request.url.query); 142 local data = httplib.formdecode(request.url.query);
138 if data then 143 if data then
139 return data.p == "h" 144 return data.p == "h"
140 end 145 end
236 response.headers.content_type = "text/html; charset=utf-8"; 241 response.headers.content_type = "text/html; charset=utf-8";
237 return render(template, { 242 return render(template, {
238 title = get_room(room):get_name(); 243 title = get_room(room):get_name();
239 jid = get_room(room).jid; 244 jid = get_room(room).jid;
240 hide_presence = hide_presence(request); 245 hide_presence = hide_presence(request);
246 presence_available = presence_logged;
241 years = years; 247 years = years;
242 links = { 248 links = {
243 { href = "../", rel = "up", text = "Room list" }, 249 { href = "../", rel = "up", text = "Room list" },
244 { href = "latest", text = "Latest" }, 250 { href = "latest", text = "Latest" },
245 }; 251 };
356 response.headers.content_type = "text/html; charset=utf-8"; 362 response.headers.content_type = "text/html; charset=utf-8";
357 return render(template, { 363 return render(template, {
358 title = ("%s - %s"):format(get_room(room):get_name(), date); 364 title = ("%s - %s"):format(get_room(room):get_name(), date);
359 jid = get_room(room).jid; 365 jid = get_room(room).jid;
360 hide_presence = hide_presence(request); 366 hide_presence = hide_presence(request);
367 presence_available = presence_logged;
361 lines = logs; 368 lines = logs;
362 links = { 369 links = {
363 { href = "./", rel = "up", text = "Calendar" }, 370 { href = "./", rel = "up", text = "Calendar" },
364 { href = prev_when, rel = "prev", text = prev_when}, 371 { href = prev_when, rel = "prev", text = prev_when},
365 { href = next_when, rel = "next", text = next_when}, 372 { href = next_when, rel = "next", text = next_when},
388 response.headers.content_type = "text/html; charset=utf-8"; 395 response.headers.content_type = "text/html; charset=utf-8";
389 return render(template, { 396 return render(template, {
390 title = module:get_option_string("name", "Prosody Chatrooms"); 397 title = module:get_option_string("name", "Prosody Chatrooms");
391 jid = module.host; 398 jid = module.host;
392 hide_presence = hide_presence(request); 399 hide_presence = hide_presence(request);
400 presence_available = presence_logged;
393 rooms = room_list; 401 rooms = room_list;
394 }); 402 });
395 end 403 end
396 404
397 module:provides("http", { 405 module:provides("http", {