Commit 1af05964c1694547bd2e5203937b2b9469adcaac

Authored by OpenWapp Developer
1 parent 6e69521598

Build

Showing 2 changed files with 33 additions and 14 deletions

dist/coseme.js View file @ 1af0596
... ... @@ -4114,7 +4114,7 @@
4114 4114 };
4115 4115  
4116 4116 Tree.prototype.getAllChildren = function(tag) {
4117   - var all = typeof tag !== 'undefined';
  4117 + var all = typeof tag === 'undefined';
4118 4118 var filteredChildren = this.children.filter(function(child) {
4119 4119 return all || child.tag === tag;
4120 4120 });
... ... @@ -5813,7 +5813,6 @@
5813 5813 var params = Object.create(null);
5814 5814 params['cc'] = countryCode;
5815 5815 params['in'] = phone;
5816   - params['to'] = countryCode + phone;
5817 5816 params['lc'] = 'US';
5818 5817 params['lg'] = 'en';
5819 5818 params['mcc'] = '000';
... ... @@ -6724,7 +6723,11 @@
6724 6723  
6725 6724 var processNode = {
6726 6725 result: function(iqType, idx, node) {
6727   - if (idx in _requests) {
  6726 + var props = node.getChild('props');
  6727 + if (props) {
  6728 + getProperties(props.getAllChildren());
  6729 + }
  6730 + else if (idx in _requests) {
6728 6731 _requests[idx](node);
6729 6732 delete _requests[idx];
6730 6733 }
... ... @@ -6774,6 +6777,21 @@
6774 6777 }
6775 6778 };
6776 6779  
  6780 + function getProperties(propertyNodes) {
  6781 + var properties = {};
  6782 + var stringProperties = {};
  6783 + propertyNodes.forEach(function (node) {
  6784 + var name = node.getAttributeValue('name');
  6785 + if (name) {
  6786 + properties[name] = node.getAttributeValue('value');
  6787 + if (!stringProperties[name]) {
  6788 + properties[name] = parseInt(properties[name], 10);
  6789 + }
  6790 + }
  6791 + });
  6792 + _signalInterface.send('got_properties', [properties]);
  6793 + }
  6794 +
6777 6795 function onError(evt) {
6778 6796 var reason = evt.data;
6779 6797 logger.error('Socket error due to:', evt, '!');
... ... @@ -7657,6 +7675,7 @@
7657 7675  
7658 7676 ping: [],
7659 7677 pong: [],
  7678 + got_properties: [],
7660 7679 disconnected: [],
7661 7680  
7662 7681 media_uploadRequestSuccess: [],
... ... @@ -8317,9 +8336,9 @@
8317 8336 innerNodeChildren.push(newProtocolTreeNode('user', {jid: aJid}));
8318 8337 });
8319 8338  
8320   - var queryNode = newProtocolTreeNode('list', {xmlns: 'w:profile:picture'},
8321   - innerNodeChildren);
8322   - var iqNode = newProtocolTreeNode('iq', {id: idx, type: 'get'}, [queryNode]);
  8339 + var queryNode = newProtocolTreeNode('list', {}, innerNodeChildren);
  8340 + var iqNode = newProtocolTreeNode('iq', {id: idx, type: 'get',
  8341 + xmlns: 'w:profile:picture'}, [queryNode]);
8323 8342  
8324 8343 self._writeNode(iqNode);
8325 8344 },
dist/coseme.min.js View file @ 1af0596

No preview for this file type