Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / services / email / lib / imap.js
index 21e5f2d..929791a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb238=['error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','bind','end','handleEnd'];(function(_0x76c113,_0x5b1804){var _0x42e8a0=function(_0x2db68a){while(--_0x2db68a){_0x76c113['push'](_0x76c113['shift']());}};_0x42e8a0(++_0x5b1804);}(_0xb238,0x171));var _0x8b23=function(_0x4c6a30,_0x26413a){_0x4c6a30=_0x4c6a30-0x0;var _0x3a14e6=_0xb238[_0x4c6a30];return _0x3a14e6;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x8b23('0x0'));var Imap=require(_0x8b23('0x1'));var _=require(_0x8b23('0x2'));var rs=require(_0x8b23('0x3'));var simpleParser=require(_0x8b23('0x4'))[_0x8b23('0x5')];var Iconv=require(_0x8b23('0x6'))[_0x8b23('0x7')];var EventEmitter=require(_0x8b23('0x8'))[_0x8b23('0x9')];var utils=require(_0x8b23('0xa'));var logger=require(_0x8b23('0xb'))(_0x8b23('0xc'));function EmailImap(_0x52da38,_0x58a842){this[_0x8b23('0xd')]=_0x8b23('0xe');this[_0x8b23('0xf')]=this[_0x8b23('0x10')](_0x52da38,_0x58a842);this['imap']=new Imap(this[_0x8b23('0xf')]);this[_0x8b23('0x1')]['once'](_0x8b23('0x11'),this['handleReady'][_0x8b23('0x12')](this));this[_0x8b23('0x1')]['once'](_0x8b23('0x13'),this[_0x8b23('0x14')][_0x8b23('0x12')](this));this[_0x8b23('0x1')]['on'](_0x8b23('0x15'),this[_0x8b23('0x16')][_0x8b23('0x12')](this));this[_0x8b23('0x1')]['connect']();}util[_0x8b23('0x17')](EmailImap,EventEmitter);EmailImap[_0x8b23('0x18')]['getAccount']=function(_0x25cb05,_0x279046){var _0x28e1d9={'connTimeout':_0x25cb05[_0x8b23('0x19')]?_0x25cb05['connTimeout']*0x3e8:0x2710,'authTimeout':_0x25cb05[_0x8b23('0x1a')]?_0x25cb05['authTimeout']*0x3e8:0x1388};if(_[_0x8b23('0x1b')](_0x25cb05[_0x8b23('0x1c')])){if(_0x25cb05[_0x8b23('0x1d')]){_0x28e1d9[_0x8b23('0x1e')]=_0x25cb05['user'];_0x28e1d9['password']=_0x25cb05[_0x8b23('0x1f')];}_0x28e1d9[_0x8b23('0x20')]=_0x25cb05[_0x8b23('0x20')];_0x28e1d9[_0x8b23('0x21')]=_0x25cb05[_0x8b23('0x21')]||0x3e1;if(_0x25cb05['tls']){_0x28e1d9[_0x8b23('0x22')]=!![];}else{_0x28e1d9[_0x8b23('0x22')]=![];_0x28e1d9[_0x8b23('0x23')]=_0x8b23('0x24');}}else{_0x28e1d9[_0x8b23('0x1e')]=_0x25cb05['user'];_0x28e1d9[_0x8b23('0x1f')]=_0x25cb05[_0x8b23('0x1f')];_0x28e1d9['host']=utils[_0x8b23('0x25')](_0x25cb05[_0x8b23('0x1c')]);_0x28e1d9[_0x8b23('0x21')]=0x3e1;_0x28e1d9[_0x8b23('0x22')]=!![];}_0x28e1d9['email']=_0x279046||_0x25cb05[_0x8b23('0x1e')]||_0x8b23('0x26');return _0x28e1d9;};EmailImap['prototype']['handleReady']=function(){this[_0x8b23('0x1')][_0x8b23('0x27')](this[_0x8b23('0xd')],![],this[_0x8b23('0x28')][_0x8b23('0x12')](this));};EmailImap[_0x8b23('0x18')][_0x8b23('0x28')]=function(_0x53a5aa,_0x49e7a1){if(_0x53a5aa){this[_0x8b23('0x16')](_0x53a5aa,!![]);}else{this['emit'](_0x8b23('0x29'),_0x49e7a1);this[_0x8b23('0x2a')]();}};EmailImap[_0x8b23('0x18')]['handleCloseBox']=function(_0xab21ec){if(_0xab21ec){this['handleError'](_0xab21ec,!![]);}else{this[_0x8b23('0x1')]['end']();}};EmailImap[_0x8b23('0x18')][_0x8b23('0x2a')]=function(){this['imap'][_0x8b23('0x2b')]([_0x8b23('0x2c')],this[_0x8b23('0x2d')]['bind'](this));};EmailImap[_0x8b23('0x18')][_0x8b23('0x2d')]=function(_0x8ac137,_0x5b535d){if(_0x8ac137){this[_0x8b23('0x16')](_0x8ac137,!![]);}else{if(_0x5b535d['length']){try{var _0x45bd94=this[_0x8b23('0x1')][_0x8b23('0x2e')](_0x5b535d,{'bodies':'','markSeen':!![]});_0x45bd94['on']('message',this[_0x8b23('0x2f')][_0x8b23('0x12')](this));_0x45bd94[_0x8b23('0x30')](_0x8b23('0x15'),this[_0x8b23('0x31')]['bind'](this));_0x45bd94['once'](_0x8b23('0x13'),this[_0x8b23('0x32')][_0x8b23('0x12')](this));}catch(_0x2a2754){logger[_0x8b23('0x15')](_0x2a2754);}}else{this[_0x8b23('0x1')][_0x8b23('0x33')](!![],this[_0x8b23('0x34')][_0x8b23('0x12')](this));}}};EmailImap[_0x8b23('0x18')]['handleFetchMessage']=function(_0x36bebc,_0xd0af29){_0x36bebc['on'](_0x8b23('0x35'),this[_0x8b23('0x36')][_0x8b23('0x12')](this));_0x36bebc[_0x8b23('0x30')](_0x8b23('0x37'),this[_0x8b23('0x38')]['bind'](this));_0x36bebc[_0x8b23('0x30')](_0x8b23('0x13'),this[_0x8b23('0x39')][_0x8b23('0x12')](this));};EmailImap['prototype'][_0x8b23('0x36')]=function(_0x234d94,_0x229954){simpleParser(_0x234d94,{'Iconv':Iconv},this[_0x8b23('0x3a')][_0x8b23('0x12')](this));};EmailImap['prototype'][_0x8b23('0x38')]=function(_0x1426c3){};EmailImap[_0x8b23('0x18')][_0x8b23('0x39')]=function(){};EmailImap[_0x8b23('0x18')]['handleSimpleParser']=function(_0x2b390a,_0x134076){if(_0x2b390a){logger[_0x8b23('0x15')](_0x2b390a);}else{var _0x5fc3a5=this;utils['parser'](this[_0x8b23('0xf')],_0x134076,function(_0x4b1266){_0x5fc3a5[_0x8b23('0x3b')](_0x8b23('0xc'),_0x4b1266);});}};EmailImap[_0x8b23('0x18')][_0x8b23('0x32')]=function(){this[_0x8b23('0x1')]['closeBox'](!![],this[_0x8b23('0x34')]['bind'](this));};EmailImap[_0x8b23('0x18')][_0x8b23('0x31')]=function(_0x1d8293){this[_0x8b23('0x16')](_0x1d8293);this[_0x8b23('0x1')][_0x8b23('0x33')](!![],this[_0x8b23('0x34')][_0x8b23('0x12')](this));};EmailImap[_0x8b23('0x18')][_0x8b23('0x14')]=function(){this[_0x8b23('0x3b')](_0x8b23('0x13'));};EmailImap[_0x8b23('0x18')][_0x8b23('0x16')]=function(_0x1e9f31,_0x1528a7){logger[_0x8b23('0x15')](_0x8b23('0x16'),this[_0x8b23('0xf')]['email'],JSON[_0x8b23('0x3c')](_0x1e9f31));var _0x3a3f7f='';if(_0x1e9f31){if(_0x1e9f31['textCode']){_0x3a3f7f=_0x1e9f31[_0x8b23('0x3d')];}else{for(var _0x5d22a7 in _0x1e9f31){if(_0x1e9f31[_0x8b23('0x3e')](_0x5d22a7)){_0x3a3f7f+=_[_0x8b23('0x3f')](_0x5d22a7)+':\x20'+_0x1e9f31[_0x5d22a7]+'\x0a';}}}}if(_0x1528a7){this[_0x8b23('0x1')][_0x8b23('0x13')]();}else{this[_0x8b23('0x3b')](_0x8b23('0x15'),_0x3a3f7f);this[_0x8b23('0x3b')]('end');}};module[_0x8b23('0x40')]=EmailImap;
\ No newline at end of file
+var _0xb3c5=['authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','handleReady','bind','end','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xb3c5,0x66));var _0x5b3c=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xb3c5[_0x2d2258];return _0x18e155;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x5b3c('0x0'));var _=require(_0x5b3c('0x1'));var rs=require(_0x5b3c('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x5b3c('0x3'))[_0x5b3c('0x4')];var EventEmitter=require(_0x5b3c('0x5'))[_0x5b3c('0x6')];var utils=require(_0x5b3c('0x7'));var logger=require('../../../config/logger')(_0x5b3c('0x8'));function EmailImap(_0x1ea0c7,_0x348ba8){this[_0x5b3c('0x9')]=_0x5b3c('0xa');this[_0x5b3c('0xb')]=this[_0x5b3c('0xc')](_0x1ea0c7,_0x348ba8);this[_0x5b3c('0x0')]=new Imap(this[_0x5b3c('0xb')]);this[_0x5b3c('0x0')][_0x5b3c('0xd')]('ready',this[_0x5b3c('0xe')][_0x5b3c('0xf')](this));this[_0x5b3c('0x0')][_0x5b3c('0xd')](_0x5b3c('0x10'),this['handleEnd'][_0x5b3c('0xf')](this));this[_0x5b3c('0x0')]['on']('error',this[_0x5b3c('0x11')]['bind'](this));this['imap'][_0x5b3c('0x12')]();}util[_0x5b3c('0x13')](EmailImap,EventEmitter);EmailImap[_0x5b3c('0x14')]['getAccount']=function(_0x1678c1,_0x4dbcba){var _0x54c68a={'connTimeout':_0x1678c1['connTimeout']?_0x1678c1[_0x5b3c('0x15')]*0x3e8:0x2710,'authTimeout':_0x1678c1[_0x5b3c('0x16')]?_0x1678c1[_0x5b3c('0x16')]*0x3e8:0x1388};if(_[_0x5b3c('0x17')](_0x1678c1['service'])){if(_0x1678c1[_0x5b3c('0x18')]){_0x54c68a['user']=_0x1678c1[_0x5b3c('0x19')];_0x54c68a[_0x5b3c('0x1a')]=_0x1678c1['password'];}_0x54c68a[_0x5b3c('0x1b')]=_0x1678c1[_0x5b3c('0x1b')];_0x54c68a[_0x5b3c('0x1c')]=_0x1678c1[_0x5b3c('0x1c')]||0x3e1;if(_0x1678c1[_0x5b3c('0x1d')]){_0x54c68a[_0x5b3c('0x1d')]=!![];}else{_0x54c68a[_0x5b3c('0x1d')]=![];_0x54c68a[_0x5b3c('0x1e')]=_0x5b3c('0x1f');}}else{_0x54c68a[_0x5b3c('0x19')]=_0x1678c1[_0x5b3c('0x19')];_0x54c68a[_0x5b3c('0x1a')]=_0x1678c1['password'];_0x54c68a[_0x5b3c('0x1b')]=utils[_0x5b3c('0x20')](_0x1678c1[_0x5b3c('0x21')]);_0x54c68a[_0x5b3c('0x1c')]=0x3e1;_0x54c68a['tls']=!![];}_0x54c68a['email']=_0x4dbcba||_0x1678c1[_0x5b3c('0x19')]||_0x5b3c('0x22');return _0x54c68a;};EmailImap[_0x5b3c('0x14')][_0x5b3c('0xe')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x23')](this[_0x5b3c('0x9')],![],this[_0x5b3c('0x24')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x24')]=function(_0x54b098,_0x561fb3){if(_0x54b098){this[_0x5b3c('0x11')](_0x54b098,!![]);}else{this['emit'](_0x5b3c('0x25'),_0x561fb3);this['readUnseen']();}};EmailImap['prototype'][_0x5b3c('0x26')]=function(_0x200669){if(_0x200669){this['handleError'](_0x200669,!![]);}else{this[_0x5b3c('0x0')]['end']();}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x27')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x28')]([_0x5b3c('0x29')],this[_0x5b3c('0x2a')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x2a')]=function(_0xca4a19,_0x57e887){if(_0xca4a19){this[_0x5b3c('0x11')](_0xca4a19,!![]);}else{if(_0x57e887[_0x5b3c('0x2b')]){try{var _0x2c698d=this[_0x5b3c('0x0')][_0x5b3c('0x2c')](_0x57e887,{'bodies':'','markSeen':!![]});_0x2c698d['on']('message',this[_0x5b3c('0x2d')][_0x5b3c('0xf')](this));_0x2c698d[_0x5b3c('0xd')](_0x5b3c('0x2e'),this[_0x5b3c('0x2f')][_0x5b3c('0xf')](this));_0x2c698d[_0x5b3c('0xd')](_0x5b3c('0x10'),this[_0x5b3c('0x30')][_0x5b3c('0xf')](this));}catch(_0x13ec65){logger['error'](_0x13ec65);}}else{this[_0x5b3c('0x0')]['closeBox'](!![],this[_0x5b3c('0x26')]['bind'](this));}}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x2d')]=function(_0x5b3214,_0x326a7d){_0x5b3214['on'](_0x5b3c('0x31'),this[_0x5b3c('0x32')]['bind'](this));_0x5b3214[_0x5b3c('0xd')]('attributes',this[_0x5b3c('0x33')][_0x5b3c('0xf')](this));_0x5b3214[_0x5b3c('0xd')](_0x5b3c('0x10'),this[_0x5b3c('0x34')][_0x5b3c('0xf')](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x32')]=function(_0x2a40eb,_0x3954ec){simpleParser(_0x2a40eb,{'Iconv':Iconv},this[_0x5b3c('0x35')]['bind'](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x33')]=function(_0x537016){};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x34')]=function(){};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x35')]=function(_0x1098d3,_0x35e786){if(_0x1098d3){logger[_0x5b3c('0x2e')](_0x1098d3);}else{var _0x56ecc8=this;utils[_0x5b3c('0x36')](this['account'],_0x35e786,function(_0x4f018a){_0x56ecc8[_0x5b3c('0x37')](_0x5b3c('0x8'),_0x4f018a);});}};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x30')]=function(){this[_0x5b3c('0x0')][_0x5b3c('0x38')](!![],this[_0x5b3c('0x26')][_0x5b3c('0xf')](this));};EmailImap[_0x5b3c('0x14')][_0x5b3c('0x2f')]=function(_0x4caa56){this['handleError'](_0x4caa56);this[_0x5b3c('0x0')][_0x5b3c('0x38')](!![],this[_0x5b3c('0x26')][_0x5b3c('0xf')](this));};EmailImap['prototype'][_0x5b3c('0x39')]=function(){this[_0x5b3c('0x37')](_0x5b3c('0x10'));};EmailImap[_0x5b3c('0x14')]['handleError']=function(_0x1c98ea,_0xe3846d){logger['error']('handleError',this[_0x5b3c('0xb')]['email'],JSON[_0x5b3c('0x3a')](_0x1c98ea));var _0x5afc08='';if(_0x1c98ea){if(_0x1c98ea[_0x5b3c('0x3b')]){_0x5afc08=_0x1c98ea[_0x5b3c('0x3b')];}else{for(var _0x22e11a in _0x1c98ea){if(_0x1c98ea[_0x5b3c('0x3c')](_0x22e11a)){_0x5afc08+=_[_0x5b3c('0x3d')](_0x22e11a)+':\x20'+_0x1c98ea[_0x22e11a]+'\x0a';}}}}if(_0xe3846d){this['imap'][_0x5b3c('0x10')]();}else{this['emit']('error',_0x5afc08);this[_0x5b3c('0x37')](_0x5b3c('0x10'));}};module[_0x5b3c('0x3e')]=EmailImap;
\ No newline at end of file