# HG changeset patch # User Kim Alvefur <zash@zash.se> # Date 1293754257 -3600 # Node ID 6004486e8b6c0cb376032d8033dc69fe35eeb287 # Parent 4d2a5d02fdfabf7b3aac98e0aaa47c278e4fe1b4 plugins.disco,compression: Use xmlns_* variables diff -r 4d2a5d02fdfa -r 6004486e8b6c plugins/compression.lua --- a/plugins/compression.lua Fri Dec 31 00:30:37 2010 +0100 +++ b/plugins/compression.lua Fri Dec 31 01:10:57 2010 +0100 @@ -47,7 +47,7 @@ session:close({ condition = "undefined-condition"; text = compressed; - extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); + extra = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("processing-failed"); }); session:warn("Compressed send failed: %s", tostring(compressed)); return; @@ -66,7 +66,7 @@ session:close({ condition = "undefined-condition"; text = decompressed; - extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); + extra = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("processing-failed"); }); stream:warn("%s", tostring(decompressed)); return; diff -r 4d2a5d02fdfa -r 6004486e8b6c plugins/disco.lua --- a/plugins/disco.lua Fri Dec 31 00:30:37 2010 +0100 +++ b/plugins/disco.lua Fri Dec 31 01:10:57 2010 +0100 @@ -21,9 +21,9 @@ {category = 'client', type='pc', name='Verse'}, } stream.disco.info.features = { - {var = 'http://jabber.org/protocol/caps'}, - {var = 'http://jabber.org/protocol/disco#info'}, - {var = 'http://jabber.org/protocol/disco#items'}, + {var = xmlns_caps}, + {var = xmlns_disco_info}, + {var = xmlns_disco_items}, } stream.disco.items = {} stream.disco.nodes = {} @@ -81,7 +81,7 @@ -- presence stanza local hash = calculate_hash() return st.stanza('c', { - xmlns = 'http://jabber.org/protocol/caps', + xmlns = xmlns_caps, hash = 'sha-1', node = stream.caps.node, ver = hash @@ -255,7 +255,7 @@ end); end - stream:hook("iq/http://jabber.org/protocol/disco#info", function (stanza) + stream:hook("iq/"..xmlns_disco_info, function (stanza) if stanza.attr.type == 'get' then local query = stanza:child_with_name('query') if not query then return; end @@ -280,7 +280,7 @@ id = stanza.attr.id, type = 'error' }) - response:tag('query',{xmlns = 'http://jabber.org/protocol/disco#info'}):reset() + response:tag('query',{xmlns = xmlns_disco_info}):reset() response:tag('error',{type = 'cancel'}):tag( 'item-not-found',{xmlns = 'urn:ietf:params:xml:ns:xmpp-stanzas'} ) @@ -293,7 +293,7 @@ end -- construct the response local result = st.stanza('query',{ - xmlns = 'http://jabber.org/protocol/disco#info', + xmlns = xmlns_disco_info, node = query.attr.node }) for key,identity in pairs(identities) do @@ -312,7 +312,7 @@ end end); - stream:hook("iq/http://jabber.org/protocol/disco#items", function (stanza) + stream:hook("iq/"..xmlns_disco_items, function (stanza) if stanza.attr.type == 'get' then local query = stanza:child_with_name('query') if not query then return; end @@ -330,7 +330,7 @@ id = stanza.attr.id, type = 'error' }) - response:tag('query',{xmlns = 'http://jabber.org/protocol/disco#items'}):reset() + response:tag('query',{xmlns = xmlns_disco_items}):reset() response:tag('error',{type = 'cancel'}):tag( 'item-not-found',{xmlns = 'urn:ietf:params:xml:ns:xmpp-stanzas'} ) @@ -342,7 +342,7 @@ end -- construct the response local result = st.stanza('query',{ - xmlns = 'http://jabber.org/protocol/disco#items', + xmlns = xmlns_disco_items, node = query.attr.node }) for key,item in pairs(items) do