question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle non-standard VCard data from MongooseIM

See original GitHub issue

Our server mongooseim gives the card in a nonstandard way, the fillname is stored in N tags, and the image as a link, we had to fix the onVCardData function from the headless \ converse-vcard.js file.

      const vcard = iq.querySelector('vCard');
      let result = {};
      if (!_.isNull(vcard)) {
					let fn=[];
					let f,g,m='';
					if(vcard.querySelector('N')) {
					if(f=_.get( vcard.querySelector('N').querySelector('FAMILY') , 'textContent'))fn.push(f);
					if(g=_.get( vcard.querySelector('N').querySelector('GIVEN') , 'textContent'))fn.push(g);
					if(m=_.get( vcard.querySelector('N').querySelector('MIDDLE') , 'textContent'))fn.push(m);
					}
 
        result = {
          'stanza': iq,
          'fullname': _.get(vcard.querySelector('FN'), 'textContent')|| fn.join(' '),
		  'family':f,
		  'given':g,
		  'middle':m,
          'nickname': _.get(vcard.querySelector('NICKNAME'), 'textContent'),
          'image': _.get(vcard.querySelector('PHOTO BINVAL'), 'textContent'),
          'image_type': _.get(vcard.querySelector('PHOTO TYPE'), 'textContent'),
		  'image_src': _.get(vcard.querySelector('LABEL'), 'textContent'),
          'url': _.get(vcard.querySelector('URL'), 'textContent'),
          'role': _.get(vcard.querySelector('ROLE'), 'textContent'),
          'email': _.get(vcard.querySelector('EMAIL USERID'), 'textContent'),
          'vcard_updated': new Date().toISOString(),
          'vcard_error': undefined
        };
      }

      if (result.image) {
        const buffer = u.base64ToArrayBuffer(result['image']);
        const ab = await crypto.subtle.digest('SHA-1', buffer);
        result['image_hash'] = u.arrayBufferToHex(ab);
      }
      return result;
    }```
How to transfer onVCardData to a plugin?


<bountysource-plugin>

---
Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/76404897-handle-non-standard-vcard-data-from-mongooseim?utm_campaign=plugin&utm_content=tracker%2F194169&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F194169&utm_medium=issues&utm_source=github).
</bountysource-plugin>

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jcbrandcommented, Jul 5, 2019

crypto.subtle is only available over HTTPS or on localhost.

0reactions
jcbrandcommented, Dec 3, 2019

@Nyco: Please stop marking this issue as a bug. If MongooseIM returns the VCard data in a non-standard way, then this is not a bug in Converse.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`mod_event_pusher_http` doesn't handle muc_light messages
Normal user to user chat works great, but I found my http service doesn't receive messages from muc light room. Shame of me...
Read more >
mod_vcard - MongooseIM
This module provides support for vCards, as specified in XEP-0054: vcard-temp and ... modules.mod_vcard.iqdisc.type ... Strategy to handle incoming stanzas.
Read more >
RFC 6352: CardDAV: vCard Extensions to Web Distributed ...
Non-Standard vCard Properties and Parameters . ... that address book clients do not have to deal with non- address data in an address...
Read more >
MongooseIM mod_vcard is not getting triggered - Stack Overflow
I am trying to set up mod_vcard in my mongoose server for implementing XEP-0055 (Jabber search). I installed and configured the module like ......
Read more >
What is the difference between CSV and vCard contact formats?
Both CSV and vCard formats are used as a common way of ... to import or open the CSV file are designed to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found