From 27690ada5806463fb54cc29df9eab4a570217a1e Mon Sep 17 00:00:00 2001 From: David Cormier Date: Mon, 17 Feb 2014 21:46:00 -0500 Subject: [PATCH] Work around a WeeChat protocol inconvenience Until WeeChat sends a confirmation for init we have to assume that the commands will be received synchronously even though they are sent asynchronously --- js/glowingbear.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index 426dd17..7de20f9 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -272,16 +272,23 @@ function($rootScope, // Helper methods for initialization commands var _initializeConnection = function(passwd) { - return ngWebsockets.sendAll([ + + // This is not the proper way to do this. + // WeeChat does not send a confirmation for the init. + // Until it does, We need to "assume" that formatInit + // will be received before formatInfo + ngWebsockets.send( weeChat.Protocol.formatInit({ password: passwd, compression: noCompression ? 'off' : 'zlib' - }), + }) + ); + return ngWebsockets.send( weeChat.Protocol.formatInfo({ name: 'version' }) - ]) + ); }; var _requestHotlist = function() {