Browse Source

merged with master

gh-pages
Igor Zhukov 11 years ago
parent
commit
e0b3615fd1
  1. 8
      app.manifest
  2. 2
      css/app.css
  3. BIN
      img/icons/CloseHover_1x.png
  4. BIN
      img/icons/CloseHover_2x.png
  5. BIN
      img/icons/Close_1x.png
  6. BIN
      img/icons/Close_2x.png
  7. BIN
      img/icons/PhotoControls.png
  8. BIN
      img/icons/PhotoControls_1x.png
  9. 30
      js/app.js
  10. 2
      js/app.js.map
  11. 52
      js/lib/mtproto.js

8
app.manifest

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Tue Apr 08 2014 13:29:27 GMT+0200 (CEST)
# Time: Wed Apr 09 2014 23:06:59 GMT+0200 (CEST)
CACHE:
@ -26,14 +26,12 @@ img/icons/Checks1_1x.png
img/icons/Checks1_2x.png
img/icons/Checks2_1x.png
img/icons/Checks2_2x.png
img/icons/CloseHover_1x.png
img/icons/CloseHover_2x.png
img/icons/Close_1x.png
img/icons/Close_2x.png
img/icons/IconsetSmiles.png
img/icons/IconsetSmiles_1x.png
img/icons/IconsetW.png
img/icons/IconsetW_1x.png
img/icons/PhotoControls.png
img/icons/PhotoControls_1x.png
img/placeholders/DialogListAvatarSystem@2x.png
img/placeholders/GroupAvatar1@2x.png
img/placeholders/GroupAvatar2@2x.png

2
css/app.css

File diff suppressed because one or more lines are too long

BIN
img/icons/CloseHover_1x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

BIN
img/icons/CloseHover_2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/icons/Close_1x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

BIN
img/icons/Close_2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/icons/PhotoControls.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
img/icons/PhotoControls_1x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

30
js/app.js

File diff suppressed because one or more lines are too long

2
js/app.js.map

File diff suppressed because one or more lines are too long

52
js/lib/mtproto.js

@ -638,6 +638,8 @@ TLSerialization.prototype.storeMethod = function (methodName, params) {
angular.forEach(methodData.params, function (param) {
self.storeObject(params[param.name], param.type, methodName + '[' + param.name + ']');
});
return methodData.type;
};
TLSerialization.prototype.storeObject = function (obj, type, field) {
@ -707,6 +709,8 @@ TLSerialization.prototype.storeObject = function (obj, type, field) {
angular.forEach(constructorData.params, function (param) {
self.storeObject(obj[param.name], param.type, field + '[' + predicate + '][' + param.name + ']');
});
return constructorData.type;
};
@ -715,6 +719,7 @@ function TLDeserialization (buffer, options) {
options = options || {};
this.offset = 0; // in bytes
this.override = options.override || {};
this.buffer = buffer;
this.intView = new Uint32Array(this.buffer);
@ -961,12 +966,16 @@ TLDeserialization.prototype.fetchObject = function (type, field) {
predicate = constructorData.predicate;
var result = {'_': predicate};
var result = {'_': predicate},
self = this;
var self = this;
angular.forEach(constructorData.params, function (param) {
result[param.name] = self.fetchObject(param.type, field + '[' + predicate + '][' + param.name + ']');
});
if (this.override[predicate]) {
this.override[predicate].apply(this, [result, field + '[' + predicate + ']']);
} else {
angular.forEach(constructorData.params, function (param) {
result[param.name] = self.fetchObject(param.type, field + '[' + predicate + '][' + param.name + ']');
});
}
if (fallback) {
this.mtproto = true;
@ -1773,7 +1782,7 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato
serializer.storeLong(options.afterMessageID, 'msg_id');
}
serializer.storeMethod(method, params);
options.resultType = serializer.storeMethod(method, params);
var messageID = MtpMessageIdGenerator.generateID(),
seqNo = this.generateSeqNo(),
@ -2215,7 +2224,36 @@ factory('MtpNetworkerFactory', function (MtpDcConfigurator, MtpMessageIdGenerato
}
var buffer = bytesToArrayBuffer(messageBody);
var deserializer = new TLDeserialization(buffer, {mtproto: true});
var deserializerOptions = {
mtproto: true,
override: {
message: function (result, field) {
result.msg_id = this.fetchLong(field + '[msg_id]');
result.seqno = this.fetchInt(field + '[seqno]');
result.bytes = this.fetchInt(field + '[bytes]');
var offset = this.getOffset();
try {
result.body = this.fetchObject('Object', field + '[body]');
} catch (e) {
result.body = {_: 'parse_error', error: e};
}
this.offset = offset + result.bytes;
// console.log(dT(), 'override message', result);
},
rpc_result: function (result, field) {
result.req_msg_id = this.fetchLong(field + '[req_msg_id]');
var sentMessage = self.sentMessages[result.req_msg_id],
type = sentMessage && sentMessage.resultType || 'Object';
result.result = this.fetchObject(type, field + '[result]');
// console.log(dT(), 'override rpc_result', type, result);
}
}
};
var deserializer = new TLDeserialization(buffer, deserializerOptions);
var response = deserializer.fetchObject('', 'INPUT');

Loading…
Cancel
Save