Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 7090:7aa37d70944b
mod_admin_telnet: Fix sorting of JIDs in c2s:show() family of functions (thanks lookshe and Zash)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 22 Jan 2016 13:20:00 +0000 |
| parent | 7070:aab022cb8e29 |
| child | 7091:1c3b38f80571 |
| child | 7471:3631d259bb85 |
comparison
equal
deleted
inserted
replaced
| 7087:dd8265ca9327 | 7090:7aa37d70944b |
|---|---|
| 555 local function show_c2s(callback) | 555 local function show_c2s(callback) |
| 556 local c2s = array.collect(values(module:shared"/*/c2s/sessions")); | 556 local c2s = array.collect(values(module:shared"/*/c2s/sessions")); |
| 557 c2s:sort(function(a, b) | 557 c2s:sort(function(a, b) |
| 558 if a.host == b.host then | 558 if a.host == b.host then |
| 559 if a.username == b.username then | 559 if a.username == b.username then |
| 560 return a.resource or "" > b.resource or ""; | 560 return (a.resource or "") > (b.resource or ""); |
| 561 end | 561 end |
| 562 return a.username or "" > b.username or ""; | 562 return (a.username or "") > (b.username or ""); |
| 563 end | 563 end |
| 564 return a.host or "" > b.host or ""; | 564 return (a.host or "") > (b.host or ""); |
| 565 end):map(function (session) | 565 end):map(function (session) |
| 566 callback(get_jid(session), session) | 566 callback(get_jid(session), session) |
| 567 end); | 567 end); |
| 568 end | 568 end |
| 569 | 569 |