MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / getUserInfo

Method getUserInfo

src/content-scripts/gmailIntegration.js:50–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48 }
49
50 getUserInfo() {
51 if (this.userInfo) {
52 return this.userInfo;
53 }
54 const titleElem = document.querySelector('title');
55 // Gmail titles place the active account address last, e.g.
56 // "Inbox (5) - alice@example.com - Gmail". Take the last match so
57 // subject-line addresses don't shadow the account address.
58 const email = extractAddressFromText(titleElem.innerText, {position: 'last'});
59 if (!email) {
60 throw new Error('Gmail User Id not found.');
61 }
62 this.userInfo = {};
63 this.userInfo.email = email;
64 this.userInfo.legacyGsuite = Array.from(document.querySelectorAll('.aiG .aiD span')).some(element => /^1(?:5|7)[\sG]/.test(element.textContent));
65 return this.userInfo;
66 }
67
68 getMsgId(msgElem) {
69 const rawID = msgElem.dataset.messageId;

Callers 4

onEditorButtonMethod · 0.95
onSecureButtonMethod · 0.95
onArmoredMethod · 0.80
onDataMethod · 0.80

Calls 1

extractAddressFromTextFunction · 0.90

Tested by

no test coverage detected