Comparison

plugins/mod_console.lua @ 3540:bc139431830b

Monster whitespace commit (beware the whitespace monster).
author Waqas Hussain <waqas20@gmail.com>
date Sat, 16 Oct 2010 23:00:42 +0500
parent 3452:2d1a5d8893c2
child 3557:58ab7e61d220
comparison
equal deleted inserted replaced
3539:8bbd965267b2 3540:bc139431830b
255 local minutes = t%60; 255 local minutes = t%60;
256 t = (t - minutes)/60; 256 t = (t - minutes)/60;
257 local hours = t%24; 257 local hours = t%24;
258 t = (t - hours)/24; 258 t = (t - hours)/24;
259 local days = t; 259 local days = t;
260 return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)", 260 return true, string.format("This server has been running for %d day%s, %d hour%s and %d minute%s (since %s)",
261 days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "", 261 days, (days ~= 1 and "s") or "", hours, (hours ~= 1 and "s") or "",
262 minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time)); 262 minutes, (minutes ~= 1 and "s") or "", os.date("%c", prosody.start_time));
263 end 263 end
264 264
265 function def_env.server:shutdown(reason) 265 function def_env.server:shutdown(reason)
266 prosody.shutdown(reason); 266 prosody.shutdown(reason);
524 print(" Dialback has been requested, but no result received"); 524 print(" Dialback has been requested, but no result received");
525 end 525 end
526 end 526 end
527 end 527 end
528 end 528 end
529 local subhost_filter = function (h) 529 local subhost_filter = function (h)
530 return (match_jid and h:match(match_jid)); 530 return (match_jid and h:match(match_jid));
531 end 531 end
532 for session in pairs(incoming_s2s) do 532 for session in pairs(incoming_s2s) do
533 if session.to_host == host and ((not match_jid) or host:match(match_jid) 533 if session.to_host == host and ((not match_jid) or host:match(match_jid)
534 or (session.from_host and session.from_host:match(match_jid)) 534 or (session.from_host and session.from_host:match(match_jid))
535 -- Pft! is what I say to list comprehensions 535 -- Pft! is what I say to list comprehensions
536 or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then 536 or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then
537 count_in = count_in + 1; 537 count_in = count_in + 1;
538 print(" "..host.." <- "..(session.from_host or "(unknown)")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or "")); 538 print(" "..host.." <- "..(session.from_host or "(unknown)")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or ""));
571 end 571 end
572 572
573 if hosts[from] and not hosts[to] then 573 if hosts[from] and not hosts[to] then
574 -- Is an outgoing connection 574 -- Is an outgoing connection
575 local session = hosts[from].s2sout[to]; 575 local session = hosts[from].s2sout[to];
576 if not session then 576 if not session then
577 print("No outgoing connection from "..from.." to "..to) 577 print("No outgoing connection from "..from.." to "..to)
578 else 578 else
579 (session.close or s2smanager.destroy_session)(session); 579 (session.close or s2smanager.destroy_session)(session);
580 count = count + 1; 580 count = count + 1;
581 print("Closed outgoing session from "..from.." to "..to); 581 print("Closed outgoing session from "..from.." to "..to);