Software / code / prosody
Comparison
plugins/mod_console.lua @ 1623:099364ec1ab2
mod_console: EOT (Ctrl-D) closes the connection.
| author | Paul Aurich <paul@darkrain42.org> |
|---|---|
| date | Fri, 31 Jul 2009 17:19:05 +0100 |
| parent | 1618:ba2a92230b77 |
| child | 1763:9e4ff3b66ed1 |
comparison
equal
deleted
inserted
replaced
| 1622:1ca7a247d04f | 1623:099364ec1ab2 |
|---|---|
| 68 local useglobalenv; | 68 local useglobalenv; |
| 69 | 69 |
| 70 if data:match("^>") then | 70 if data:match("^>") then |
| 71 data = data:gsub("^>", ""); | 71 data = data:gsub("^>", ""); |
| 72 useglobalenv = true; | 72 useglobalenv = true; |
| 73 elseif data == "\004" then | |
| 74 commands["bye"](session, data); | |
| 75 return; | |
| 73 else | 76 else |
| 74 local command = data:lower(); | 77 local command = data:lower(); |
| 75 command = data:match("^%w+") or data:match("%p"); | 78 command = data:match("^%w+") or data:match("%p"); |
| 76 if commands[command] then | 79 if commands[command] then |
| 77 commands[command](session, data); | 80 commands[command](session, data); |