comparison avatar.js @ 3:5aa1bf7154b0

Add a simple PEP node viewer and editor.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 22 Dec 2018 02:23:38 +0100
parents db033e5eabcb
children aedf80eefc19
comparison
equal deleted inserted replaced
2:db033e5eabcb 3:5aa1bf7154b0
169 } 169 }
170 return [bytes, unit]; 170 return [bytes, unit];
171 } 171 }
172 172
173 avatar_access.addEventListener('change', function (evt) { 173 avatar_access.addEventListener('change', function (evt) {
174 const iq = $iq({type: 'set'}) 174 const iq = configurePEPField('urn:xmpp:avatar:metadata', 'pubsub#access_model', evt.target.value);
175 .c('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub#owner'})
176 .c('configure', {node: 'urn:xmpp:avatar:metadata'})
177 .c('x', {xmlns: 'jabber:x:data', type: 'submit'})
178 .c('field', {'var': 'FORM_TYPE', type: 'hidden'})
179 .c('value')
180 .t('http://jabber.org/protocol/pubsub#node_config')
181 .up()
182 .up()
183 .c('field', {'var': 'pubsub#access_model'})
184 .c('value')
185 .t(evt.target.value)
186 .up()
187 .up()
188 connection.sendIQ(iq, onAvatarConfigured, onAvatarConfigureError.bind(null, 'PubSub configuration failed.')); 175 connection.sendIQ(iq, onAvatarConfigured, onAvatarConfigureError.bind(null, 'PubSub configuration failed.'));
189 }); 176 });
190 177
191 function onAvatarConfigured(result_iq) 178 function onAvatarConfigured(result_iq)
192 { 179 {