diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 663f9ddedf..b0b93afdd0 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38322,27 +38322,22 @@ axolotlInternal.RecipientRecord = function() { })(); ;(function() { + 'use strict'; + window.textsecure = window.textsecure || {}; + window.textsecure.protobuf = {}; function loadProtoBufs(filename) { - return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}).build('textsecure'); + return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}, function(error, result) { + var protos = result.build('textsecure'); + for (var protoName in protos) { + textsecure.protobuf[protoName] = protos[protoName]; + } + }); }; - var pushMessages = loadProtoBufs('IncomingPushMessageSignal.proto'); - var subProtocolMessages = loadProtoBufs('SubProtocol.proto'); - var deviceMessages = loadProtoBufs('DeviceMessages.proto'); - - window.textsecure = window.textsecure || {}; - window.textsecure.protobuf = { - IncomingPushMessageSignal : pushMessages.IncomingPushMessageSignal, - PushMessageContent : pushMessages.PushMessageContent, - ProvisioningUuid : deviceMessages.ProvisioningUuid, - ProvisionEnvelope : deviceMessages.ProvisionEnvelope, - ProvisionMessage : deviceMessages.ProvisionMessage, - DeviceControl : deviceMessages.DeviceControl, - WebSocketResponseMessage : subProtocolMessages.WebSocketResponseMessage, - WebSocketRequestMessage : subProtocolMessages.WebSocketRequestMessage, - WebSocketMessage : subProtocolMessages.WebSocketMessage - }; + loadProtoBufs('IncomingPushMessageSignal.proto'); + loadProtoBufs('SubProtocol.proto'); + loadProtoBufs('DeviceMessages.proto'); })(); /* vim: ts=4:sw=4:expandtab diff --git a/libtextsecure/protobufs.js b/libtextsecure/protobufs.js index ac52443c84..1a4dfffd13 100644 --- a/libtextsecure/protobufs.js +++ b/libtextsecure/protobufs.js @@ -1,23 +1,18 @@ ;(function() { + 'use strict'; + window.textsecure = window.textsecure || {}; + window.textsecure.protobuf = {}; function loadProtoBufs(filename) { - return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}).build('textsecure'); + return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}, function(error, result) { + var protos = result.build('textsecure'); + for (var protoName in protos) { + textsecure.protobuf[protoName] = protos[protoName]; + } + }); }; - var pushMessages = loadProtoBufs('IncomingPushMessageSignal.proto'); - var subProtocolMessages = loadProtoBufs('SubProtocol.proto'); - var deviceMessages = loadProtoBufs('DeviceMessages.proto'); - - window.textsecure = window.textsecure || {}; - window.textsecure.protobuf = { - IncomingPushMessageSignal : pushMessages.IncomingPushMessageSignal, - PushMessageContent : pushMessages.PushMessageContent, - ProvisioningUuid : deviceMessages.ProvisioningUuid, - ProvisionEnvelope : deviceMessages.ProvisionEnvelope, - ProvisionMessage : deviceMessages.ProvisionMessage, - DeviceControl : deviceMessages.DeviceControl, - WebSocketResponseMessage : subProtocolMessages.WebSocketResponseMessage, - WebSocketRequestMessage : subProtocolMessages.WebSocketRequestMessage, - WebSocketMessage : subProtocolMessages.WebSocketMessage - }; + loadProtoBufs('IncomingPushMessageSignal.proto'); + loadProtoBufs('SubProtocol.proto'); + loadProtoBufs('DeviceMessages.proto'); })();