comparison nickname.js @ 54:9ada1963558c

Disable the avatar access_model in more cases.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 23 May 2020 21:37:09 +0200
parents 2f45bee88b47
children 6d861d881b96
comparison
equal deleted inserted replaced
53:9b612be4dd0b 54:9ada1963558c
51 51
52 function onNicknameRetrievalError(iq) 52 function onNicknameRetrievalError(iq)
53 { 53 {
54 console.log('Failed to retrieve nickname: ' + parseErrorIq(iq)); 54 console.log('Failed to retrieve nickname: ' + parseErrorIq(iq));
55 hideSpinner(spinner_img); 55 hideSpinner(spinner_img);
56 nick_access.disabled = true;
56 } 57 }
57 58
58 nick_input.addEventListener('change', function (evt) { 59 nick_input.addEventListener('change', function (evt) {
59 const new_nickname = evt.target.value; 60 const new_nickname = evt.target.value;
60 let iq; 61 let iq;
73 .c('delete', {node: 'http://jabber.org/protocol/nick'}); 74 .c('delete', {node: 'http://jabber.org/protocol/nick'});
74 changed_callback = onNicknameChanged.bind(null, 'deleted'); 75 changed_callback = onNicknameChanged.bind(null, 'deleted');
75 } 76 }
76 connection.sendIQ(iq, changed_callback, onNicknameChangeError); 77 connection.sendIQ(iq, changed_callback, onNicknameChangeError);
77 displaySpinner(spinner_img); 78 displaySpinner(spinner_img);
79 nick_access.disabled = true;
78 }); 80 });
79 81
80 function onNicknameChanged(action, result_iq) 82 function onNicknameChanged(action, result_iq)
81 { 83 {
82 console.log('Nickname successfully ' + action + '.'); 84 console.log('Nickname successfully ' + action + '.');
88 90
89 function onNicknameChangeError(iq) 91 function onNicknameChangeError(iq)
90 { 92 {
91 console.log('onNicknameChangeError', iq); 93 console.log('onNicknameChangeError', iq);
92 spinnerError(spinner_img); 94 spinnerError(spinner_img);
95 nick_access.disabled = true;
93 } 96 }
94 97
95 nick_access.addEventListener('change', function (evt) { 98 nick_access.addEventListener('change', function (evt) {
96 const iq = configurePEPField('http://jabber.org/protocol/nick', 'pubsub#access_model', evt.target.value); 99 const iq = configurePEPField('http://jabber.org/protocol/nick', 'pubsub#access_model', evt.target.value);
97 connection.sendIQ(iq, onNicknameConfigured, onNicknameConfigureError); 100 connection.sendIQ(iq, onNicknameConfigured, onNicknameConfigureError);