Commits

Anonymous committed 0ca4deb

Make real names work at the cost of temporarily breaking actual facebook IDs in the email address

Comments (0)

Files changed (1)

packages/facescrape/lib/main.js

 var sha1 = require("sha1");
 
 
-function buildPeopleArray() {
-  //document.querySelector();
+function buildPeopleArray(window) {
+  let authorsLinks =
+    window.document.querySelectorAll(".gigaboxx_thread_header_authors > a");
+
+  let authors = [];
+  console.log("authorLinks.length: " + authorsLinks.length);
+  for (var i = 0; i < authorsLinks.length; ++i) {
+    authors.push(authorsLinks[i].textContent + " <4@facescrape.invalid>");
+    console.log("author link: " + authorsLinks[i].textContent);
+  }
+
+  return authors;
 };
 
-function noticeAndSaveMessages(window){
+function noticeAndSaveMessages(window) {
 
-  
   let hash = window.location.hash;
   console.log("hash = " + hash);
   
     let threadData = window.wrappedJSObject.gbm.getActiveThreadData();
     let references = [];
 
-    let people = buildPeopleArray.call(window.wrappedJSObject);
+    let people = buildPeopleArray(window.wrappedJSObject);
     
     //console.log("all messages:");
     //console.log(JSON.stringify(threadData.messages));
       msgObj.from = msg.author.name;
       msgObj.subject = threadData.subject; 
       msgObj.date = msg.time_rendered;
-      msgObj.to = threadData.recipients.map(
-        function(r) { return r + "@facescrape.invalid"; }
-        ).join(", ");
+//      msgObj.to = threadData.recipients.map(
+      msgObj.to = people.join(", ");
       msgObj.references = references;
         
       msgObj.id = sha1.b64_sha1(msgObj.body + msgObj.date) +