Upload files to "app/converse-plugins"
This commit is contained in:
		
							parent
							
								
									e6ab3af9fc
								
							
						
					
					
						commit
						a989a9bc98
					
				
							
								
								
									
										23
									
								
								app/converse-plugins/desktop-credentials.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/converse-plugins/desktop-credentials.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					converse.plugins.add('converse-desktop-credentials', {
 | 
				
			||||||
 | 
					    async initialize () {
 | 
				
			||||||
 | 
					        const { _converse } = this;
 | 
				
			||||||
 | 
					        const { api } = _converse;
 | 
				
			||||||
 | 
					        const credentials = await import('../credentials.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        api.listen.on('afterResourceBinding', () => {
 | 
				
			||||||
 | 
					            if (_converse.connection.pass) {
 | 
				
			||||||
 | 
					                credentials.addCredentials(
 | 
				
			||||||
 | 
					                    _converse.connection.service,
 | 
				
			||||||
 | 
					                    _converse.bare_jid,
 | 
				
			||||||
 | 
					                    _converse.connection.pass
 | 
				
			||||||
 | 
					                ).catch((reason) => {
 | 
				
			||||||
 | 
					                    console.log(reason);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        api.listen.on('logout', () => {
 | 
				
			||||||
 | 
					            credentials.getCredentials().then((result) => credentials.removeCredentials(result.login));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										12
									
								
								app/converse-plugins/desktop-settings.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/converse-plugins/desktop-settings.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					/* global api */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					converse.plugins.add('converse-desktop-settings', {
 | 
				
			||||||
 | 
					    initialize () {
 | 
				
			||||||
 | 
					        const { _converse } = this;
 | 
				
			||||||
 | 
					        api.settings.changed(function (key, newValue) {
 | 
				
			||||||
 | 
					            if (['omemo_default'].indexOf(key) !== -1) {
 | 
				
			||||||
 | 
					                _converse.api.settings.set(key, newValue);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										24
									
								
								app/converse-plugins/desktop-trayicon.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								app/converse-plugins/desktop-trayicon.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					/* global api */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					converse.plugins.add('converse-desktop-trayicon', {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    initialize () {
 | 
				
			||||||
 | 
					        const { _converse } = this;
 | 
				
			||||||
 | 
					        let envelopeIsShowing = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        async function hideEnvelope () {
 | 
				
			||||||
 | 
					            if (envelopeIsShowing) {
 | 
				
			||||||
 | 
					                await api.trayService.hideEnvelope();
 | 
				
			||||||
 | 
					                envelopeIsShowing = false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        window.addEventListener('focus', hideEnvelope);
 | 
				
			||||||
 | 
					        _converse.api.listen.on('chatBoxInitialized', hideEnvelope);
 | 
				
			||||||
 | 
					        _converse.api.listen.on('chatBoxFocused', hideEnvelope);
 | 
				
			||||||
 | 
					        _converse.api.listen.on('messageNotification', async () => {
 | 
				
			||||||
 | 
					            await api.trayService.showEnvelope();
 | 
				
			||||||
 | 
					            envelopeIsShowing = true;
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
		Reference in New Issue
	
	Block a user