Fixed behaviour on failed connect, minor cleanup.
This commit is contained in:
		
							parent
							
								
									acec2ac7ba
								
							
						
					
					
						commit
						72e9fc9395
					
				
					 1 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -143,9 +143,10 @@ define({
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (host && host.connected) {
 | 
									if (host && host.connected) {
 | 
				
			||||||
					done();
 | 
										done();
 | 
				
			||||||
					return post('error', $.template(templates.messages.already_connected, {
 | 
										post('error', $.template(templates.messages.already_connected, {
 | 
				
			||||||
						host: host.name || 'localhost'
 | 
											host: host.name || 'localhost'
 | 
				
			||||||
					}));
 | 
										}));
 | 
				
			||||||
 | 
										return done();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if ($.isDigits(toHost)) {
 | 
									if ($.isDigits(toHost)) {
 | 
				
			||||||
| 
						 | 
					@ -156,7 +157,8 @@ define({
 | 
				
			||||||
							request = host.path;
 | 
												request = host.path;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						return post('error', 'Undefined host index: ' + toHost);
 | 
											post('error', 'Undefined host index: ' + toHost);
 | 
				
			||||||
 | 
											return done();
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else if (fandango.is(toHost, 'untyped')) {
 | 
									} else if (fandango.is(toHost, 'untyped')) {
 | 
				
			||||||
					settings = toHost.settings;
 | 
										settings = toHost.settings;
 | 
				
			||||||
| 
						 | 
					@ -165,12 +167,14 @@ define({
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (request) {
 | 
									if (request) {
 | 
				
			||||||
					return require([request], function (settings) {
 | 
										require([request], function (settings) {
 | 
				
			||||||
						host.settings = settings;
 | 
											host.settings = settings;
 | 
				
			||||||
						commands.connect(toHost, done);
 | 
											commands.connect(toHost, done);
 | 
				
			||||||
					}, function () {
 | 
										}, function () {
 | 
				
			||||||
						return post('error', 'Could not fetch host settings: ' + request);
 | 
											post('error', 'Could not fetch host settings: ' + request);
 | 
				
			||||||
 | 
											return done();
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
 | 
										return done();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Push 'Connecting...' message
 | 
									// Push 'Connecting...' message
 | 
				
			||||||
| 
						 | 
					@ -193,7 +197,7 @@ define({
 | 
				
			||||||
					})
 | 
										})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					.on('room:joined', function (data) {
 | 
										.on('room:joined', function (data) {
 | 
				
			||||||
						room = data;
 | 
											room = $.escapeHtml(data);
 | 
				
			||||||
						post('info', $.template(templates.messages.joined_room, { roomName: room }));
 | 
											post('info', $.template(templates.messages.joined_room, { roomName: room }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						// Automatically count persons on join
 | 
											// Automatically count persons on join
 | 
				
			||||||
| 
						 | 
					@ -342,7 +346,7 @@ define({
 | 
				
			||||||
				nick = payload;
 | 
									nick = payload;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Inform that the key has been set
 | 
									// Inform that the key has been set
 | 
				
			||||||
				post('info', $.template(templates.messages.nick_set, { nick: nick}));
 | 
									post('info', $.template(templates.messages.nick_set, { nick: $.escapeHtml(nick)}));
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			mute: function () {
 | 
								mute: function () {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue