Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 6839:298182fd2387
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 19 Sep 2015 17:51:20 +0200 |
| parent | 6791:e813e8cf6046 |
| parent | 6838:229e95aecf41 |
| child | 6928:02717098cbba |
comparison
equal
deleted
inserted
replaced
| 6836:9f45f0fe5aef | 6839:298182fd2387 |
|---|---|
| 828 or (session.from_host == from and session.to_host == to) then | 828 or (session.from_host == from and session.to_host == to) then |
| 829 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); | 829 print(("Closing connection from %s to %s [%s]"):format(session.from_host, session.to_host, id)); |
| 830 (session.close or s2smanager.destroy_session)(session); | 830 (session.close or s2smanager.destroy_session)(session); |
| 831 count = count + 1 ; | 831 count = count + 1 ; |
| 832 end | 832 end |
| 833 end | 833 end |
| 834 return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); | 834 return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); |
| 835 end | 835 end |
| 836 | 836 |
| 837 function def_env.s2s:closeall(host) | 837 function def_env.s2s:closeall(host) |
| 838 local count = 0; | 838 local count = 0; |
| 839 local s2s_sessions = module:shared"/*/s2s/sessions"; | 839 local s2s_sessions = module:shared"/*/s2s/sessions"; |
| 840 for _,session in pairs(s2s_sessions) do | 840 for _,session in pairs(s2s_sessions) do |
| 841 if not host or session.from_host == host or session.to_host == host then | 841 if not host or session.from_host == host or session.to_host == host then |
| 842 session:close(); | 842 session:close(); |
| 843 count = count + 1; | 843 count = count + 1; |
| 844 end | 844 end |
| 845 end | 845 end |
| 846 if count == 0 then return false, "No sessions to close."; | 846 if count == 0 then return false, "No sessions to close."; |
| 847 else return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); end | 847 else return true, "Closed "..count.." s2s session"..((count == 1 and "") or "s"); end |
| 848 end | 848 end |
| 849 | 849 |
| 850 def_env.host = {}; def_env.hosts = def_env.host; | 850 def_env.host = {}; def_env.hosts = def_env.host; |