Mercurial > prosody-modules
comparison mod_webpresence/mod_webpresence.lua @ 1495:9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
| author | Vadim Misbakh-Soloviov <mva@mva.name> |
|---|---|
| date | Mon, 25 Aug 2014 23:58:50 +0700 |
| parents | 432dc4056114 |
| children | 1903add39b7c |
comparison
equal
deleted
inserted
replaced
| 1494:02cd4a081db4 | 1495:9a1b3f0d0939 |
|---|---|
| 45 end | 45 end |
| 46 end | 46 end |
| 47 end | 47 end |
| 48 end | 48 end |
| 49 status = status or "offline"; | 49 status = status or "offline"; |
| 50 if type == "" then type = "image" end; | |
| 51 | 50 |
| 52 statuses[status].image = function() | 51 statuses[status].image = function() |
| 53 return { status_code = 200, headers = { content_type = "image/png" }, | 52 return { status_code = 200, headers = { content_type = "image/png" }, |
| 54 body = require_resource("status_"..status..".png") | 53 body = require_resource("status_"..status..".png") |
| 55 }; | 54 }; |
| 101 :tag("show"):text(status):up() | 100 :tag("show"):text(status):up() |
| 102 :tag("status"):text(message) | 101 :tag("status"):text(message) |
| 103 ) | 102 ) |
| 104 }; | 103 }; |
| 105 end | 104 end |
| 105 | |
| 106 if ((type == "") or (not statuses[status][type])) then | |
| 107 type = "image" | |
| 108 end; | |
| 109 | |
| 106 return statuses[status][type](); | 110 return statuses[status][type](); |
| 107 end | 111 end |
| 108 | 112 |
| 109 module:provides("http", { | 113 module:provides("http", { |
| 110 default_path = "/status"; | 114 default_path = "/status"; |
