2014-10-20 08:21:23 +00:00
|
|
|
;(function() {
|
2015-05-11 21:59:22 +00:00
|
|
|
'use strict';
|
|
|
|
window.textsecure = window.textsecure || {};
|
|
|
|
window.textsecure.protobuf = {};
|
2014-10-20 08:21:23 +00:00
|
|
|
|
|
|
|
function loadProtoBufs(filename) {
|
2017-05-18 01:01:33 +00:00
|
|
|
return dcodeIO.ProtoBuf.loadProtoFile({root: window.PROTO_ROOT, file: filename}, function(error, result) {
|
|
|
|
if (error) {
|
2017-08-08 18:17:03 +00:00
|
|
|
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ') '
|
|
|
|
+ (error && error.stack ? error.stack : error);
|
|
|
|
console.log(text);
|
2017-05-18 01:01:33 +00:00
|
|
|
throw error;
|
|
|
|
}
|
2018-02-15 19:59:46 +00:00
|
|
|
var protos = result.build('signalservice');
|
2017-05-18 01:01:33 +00:00
|
|
|
if (!protos) {
|
|
|
|
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
|
2017-08-08 18:17:03 +00:00
|
|
|
console.log(text);
|
2017-05-18 01:01:33 +00:00
|
|
|
throw new Error(text);
|
|
|
|
}
|
|
|
|
for (var protoName in protos) {
|
|
|
|
textsecure.protobuf[protoName] = protos[protoName];
|
|
|
|
}
|
2015-05-11 21:59:22 +00:00
|
|
|
});
|
2014-10-20 08:21:23 +00:00
|
|
|
};
|
|
|
|
|
2018-02-15 19:59:46 +00:00
|
|
|
loadProtoBufs('SignalService.proto');
|
2015-05-11 21:59:22 +00:00
|
|
|
loadProtoBufs('SubProtocol.proto');
|
|
|
|
loadProtoBufs('DeviceMessages.proto');
|
2014-10-20 08:21:23 +00:00
|
|
|
})();
|