Mercurial > prosody-hg
comparison plugins/mod_pubsub.lua @ 4246:d0767040236f
mod_pubsub: Support for setting a disco name
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Wed, 06 Apr 2011 20:00:44 +0100 |
| parents | f8dc8b9e0bdd |
| children | 76420412520e |
comparison
equal
deleted
inserted
replaced
| 4245:2494d299d8a2 | 4246:d0767040236f |
|---|---|
| 7 local xmlns_pubsub_errors = "http://jabber.org/protocol/pubsub#errors"; | 7 local xmlns_pubsub_errors = "http://jabber.org/protocol/pubsub#errors"; |
| 8 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; | 8 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; |
| 9 | 9 |
| 10 local autocreate_on_publish = module:get_option_boolean("autocreate_on_publish", false); | 10 local autocreate_on_publish = module:get_option_boolean("autocreate_on_publish", false); |
| 11 local autocreate_on_subscribe = module:get_option_boolean("autocreate_on_subscribe", false); | 11 local autocreate_on_subscribe = module:get_option_boolean("autocreate_on_subscribe", false); |
| 12 local pubsub_disco_name = module:get_option("name"); | |
| 13 if type(pubsub_disco_name) ~= "string" then pubsub_disco_name = "Prosody PubSub Service"; end | |
| 12 | 14 |
| 13 local service; | 15 local service; |
| 14 | 16 |
| 15 local handlers = {}; | 17 local handlers = {}; |
| 16 | 18 |
| 215 end | 217 end |
| 216 end | 218 end |
| 217 | 219 |
| 218 local function build_disco_info(service) | 220 local function build_disco_info(service) |
| 219 local disco_info = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }) | 221 local disco_info = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" }) |
| 220 :tag("identity", { category = "pubsub", type = "service" }):up() | 222 :tag("identity", { category = "pubsub", type = "service", name = pubsub_disco_name }):up() |
| 221 :tag("feature", { var = "http://jabber.org/protocol/pubsub" }):up(); | 223 :tag("feature", { var = "http://jabber.org/protocol/pubsub" }):up(); |
| 222 add_disco_features_from_service(disco_info, service); | 224 add_disco_features_from_service(disco_info, service); |
| 223 return disco_info; | 225 return disco_info; |
| 224 end | 226 end |
| 225 | 227 |
