Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. var resultPromises = transaction.rcpt_to.map(function(item) {
  2.  
  3. var recipients=[];
  4. var rcpt=item.toString().slice(1,-1);
  5. connection.loginfo(plugin, 'Message going to: ' + rcpt);
  6. var mysql = require("promise-mysql");
  7. var sqlcon;
  8.  
  9. return mysql.createConnection({
  10. host: "192.168.1.95",
  11. user: "gfilter",
  12. password: "gfilter2008",
  13. database: "gfilter"
  14. }).then(function(conn){
  15. sqlcon=conn;
  16. connection.loginfo(plugin, 'Message going to: ' + rcpt + ' Size is: ' + transaction.data_bytes + ' ' + plugin);
  17. return sqlcon.query('CALL gscan_getrealuser(?)',[rcpt]);
  18. }).then(function(rows){
  19. for (var i = 0; i < rows[0].length; i++) {
  20. recipients[recipients.length]=rows[0][i].email;
  21. };
  22. return recipients;
  23. }).then(function() {
  24. sqlcon.end();
  25. }).then(function() {
  26. for (var i = 0, len = recipients.length; i < len; i++) {
  27. connection.loginfo(plugin,'Archiving: '+ recipients[i]);
  28. archive_message(connection,transaction,recipients[i],plugin);
  29. }
  30. });
  31.  
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement