Mercurial > xmpp-account-manager
comparison nickname.js @ 52:2f45bee88b47
Add pubsub#access_model retrieval for the avatar node.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 23 May 2020 21:24:34 +0200 |
parents | 021185105e2f |
children | 9ada1963558c |
comparison
equal
deleted
inserted
replaced
51:c27a4598ec44 | 52:2f45bee88b47 |
---|---|
9 const iq = $iq({type: 'get'}) | 9 const iq = $iq({type: 'get'}) |
10 .c('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub'}) | 10 .c('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub'}) |
11 .c('items', {node: 'http://jabber.org/protocol/nick'}); | 11 .c('items', {node: 'http://jabber.org/protocol/nick'}); |
12 connection.sendIQ(iq, onNickname, onNicknameRetrievalError); | 12 connection.sendIQ(iq, onNickname, onNicknameRetrievalError); |
13 displaySpinner(spinner_img); | 13 displaySpinner(spinner_img); |
14 getNicknameAccessModel(); | 14 getAccessModel(); |
15 displaySpinner(access_spinner_img); | |
16 | 15 |
17 function getNicknameAccessModel() | 16 function getAccessModel() |
18 { | 17 { |
19 retrieveConfiguration(connection).then((access_model) => { | 18 nick_access.disabled = true; |
20 console.log('yay', access_model); | 19 displaySpinner(access_spinner_img); |
20 retrieveConfiguration(connection, 'http://jabber.org/protocol/nick').then((access_model) => { | |
21 if (access_model !== null) { | 21 if (access_model !== null) { |
22 if (access_model === 'open') | 22 if (access_model === 'open') |
23 nick_access.value = 'open'; | 23 nick_access.value = 'open'; |
24 else if (access_model === 'presence') | 24 else if (access_model === 'presence') |
25 nick_access.value = 'presence'; | 25 nick_access.value = 'presence'; |
80 function onNicknameChanged(action, result_iq) | 80 function onNicknameChanged(action, result_iq) |
81 { | 81 { |
82 console.log('Nickname successfully ' + action + '.'); | 82 console.log('Nickname successfully ' + action + '.'); |
83 nick_access.disabled = true; | 83 nick_access.disabled = true; |
84 if (action === 'changed') | 84 if (action === 'changed') |
85 getNicknameAccessModel(); | 85 getAccessModel(); |
86 spinnerOk(spinner_img); | 86 spinnerOk(spinner_img); |
87 } | 87 } |
88 | 88 |
89 function onNicknameChangeError(iq) | 89 function onNicknameChangeError(iq) |
90 { | 90 { |