Mercurial > prosody-hg
comparison core/hostmanager.lua @ 4730:2587e249927f
hostmanager: Convert host-deactivating event parameters to a table
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 27 Apr 2012 22:31:53 +0100 |
| parents | b9e0bd59d817 |
| children | 84596fc32b31 |
comparison
equal
deleted
inserted
replaced
| 4729:da3c1d980c04 | 4730:2587e249927f |
|---|---|
| 100 | 100 |
| 101 function deactivate(host, reason) | 101 function deactivate(host, reason) |
| 102 local host_session = hosts[host]; | 102 local host_session = hosts[host]; |
| 103 if not host_session then return nil, "The host "..tostring(host).." is not activated"; end | 103 if not host_session then return nil, "The host "..tostring(host).." is not activated"; end |
| 104 log("info", "Deactivating host: %s", host); | 104 log("info", "Deactivating host: %s", host); |
| 105 prosody_events.fire_event("host-deactivating", host, host_session); | 105 prosody_events.fire_event("host-deactivating", { host = host, host_session = host_session, reason = reason }); |
| 106 | 106 |
| 107 if type(reason) ~= "table" then | 107 if type(reason) ~= "table" then |
| 108 reason = { condition = "host-gone", text = tostring(reason or "This server has stopped serving "..host) }; | 108 reason = { condition = "host-gone", text = tostring(reason or "This server has stopped serving "..host) }; |
| 109 end | 109 end |
| 110 | 110 |
