Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 8981:b6cb0a8f75b1
mod_pubsub: Advertise title and description in disco#info
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 06 Jul 2018 18:03:32 +0200 |
parent | 8980:4d2738b99b07 |
child | 9005:7203a1b65d1b |
comparison
equal
deleted
inserted
replaced
8980:4d2738b99b07 | 8981:b6cb0a8f75b1 |
---|---|
87 value = "http://jabber.org/protocol/pubsub#subscribe_options"; | 87 value = "http://jabber.org/protocol/pubsub#subscribe_options"; |
88 } | 88 } |
89 -- No options yet. File a feature request ;) | 89 -- No options yet. File a feature request ;) |
90 }; | 90 }; |
91 | 91 |
92 local node_metadata_form = dataform { | |
93 { | |
94 type = "hidden"; | |
95 name = "FORM_TYPE"; | |
96 value = "http://jabber.org/protocol/pubsub#meta-data"; | |
97 }; | |
98 { | |
99 type = "text-single"; | |
100 name = "pubsub#title"; | |
101 }; | |
102 { | |
103 type = "text-single"; | |
104 name = "pubsub#description"; | |
105 }; | |
106 }; | |
107 | |
92 local service_method_feature_map = { | 108 local service_method_feature_map = { |
93 add_subscription = { "subscribe" }; | 109 add_subscription = { "subscribe" }; |
94 create = { "create-nodes", "instant-nodes", "item-ids", "create-and-configure" }; | 110 create = { "create-nodes", "instant-nodes", "item-ids", "create-and-configure" }; |
95 delete = { "delete-nodes" }; | 111 delete = { "delete-nodes" }; |
96 get_items = { "retrieve-items" }; | 112 get_items = { "retrieve-items" }; |
145 if not ok or not node_obj then | 161 if not ok or not node_obj then |
146 return; | 162 return; |
147 end | 163 end |
148 event.exists = true; | 164 event.exists = true; |
149 reply:tag("identity", { category = "pubsub", type = "leaf" }):up(); | 165 reply:tag("identity", { category = "pubsub", type = "leaf" }):up(); |
166 if node_obj.config then | |
167 reply:add_child(node_metadata_form:form({ | |
168 ["pubsub#title"] = node_obj.config.title; | |
169 ["pubsub#description"] = node_obj.config.description; | |
170 }, "result")); | |
171 end | |
150 end | 172 end |
151 | 173 |
152 function _M.handle_disco_items_node(event, service) | 174 function _M.handle_disco_items_node(event, service) |
153 local stanza, reply, node = event.stanza, event.reply, event.node; | 175 local stanza, reply, node = event.stanza, event.reply, event.node; |
154 local ok, ret = service:get_items(node, stanza.attr.from); | 176 local ok, ret = service:get_items(node, stanza.attr.from); |