Built motion from commit (unavailable).|2.3.94
[motion2.git] / server / services / email / lib / imap.js
index 98fabb8..41a3965 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf432=['stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','prototype','openBox','handleError','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser'];(function(_0x29f356,_0x1e1ee4){var _0x12cc82=function(_0x33d8b0){while(--_0x33d8b0){_0x29f356['push'](_0x29f356['shift']());}};_0x12cc82(++_0x1e1ee4);}(_0xf432,0x19b));var _0x2f43=function(_0x4f2d17,_0x13156c){_0x4f2d17=_0x4f2d17-0x0;var _0x277b0d=_0xf432[_0x4f2d17];return _0x277b0d;};'use strict';var fs=require('fs');var path=require(_0x2f43('0x0'));var util=require(_0x2f43('0x1'));var Imap=require(_0x2f43('0x2'));var _=require(_0x2f43('0x3'));var rs=require(_0x2f43('0x4'));var simpleParser=require(_0x2f43('0x5'))['simpleParser'];var EventEmitter=require('events')[_0x2f43('0x6')];var utils=require(_0x2f43('0x7'));var logger=require(_0x2f43('0x8'))(_0x2f43('0x9'));function EmailImap(_0x522846,_0x12278c){this[_0x2f43('0xa')]=_0x2f43('0xb');this[_0x2f43('0xc')]=this['getAccount'](_0x522846,_0x12278c);this[_0x2f43('0x2')]=new Imap(this[_0x2f43('0xc')]);this[_0x2f43('0x2')][_0x2f43('0xd')](_0x2f43('0xe'),this[_0x2f43('0xf')][_0x2f43('0x10')](this));this[_0x2f43('0x2')][_0x2f43('0xd')](_0x2f43('0x11'),this[_0x2f43('0x12')]['bind'](this));this[_0x2f43('0x2')]['on'](_0x2f43('0x13'),this['handleError'][_0x2f43('0x10')](this));this['imap'][_0x2f43('0x14')]();}util[_0x2f43('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x2f43('0x16')]=function(_0x262cbf,_0x592e12){var _0x256ee6={'connTimeout':_0x262cbf[_0x2f43('0x17')]?_0x262cbf[_0x2f43('0x17')]*0x3e8:0x2710,'authTimeout':_0x262cbf['authTimeout']?_0x262cbf[_0x2f43('0x18')]*0x3e8:0x1388};if(_[_0x2f43('0x19')](_0x262cbf['service'])){if(_0x262cbf[_0x2f43('0x1a')]){_0x256ee6[_0x2f43('0x1b')]=_0x262cbf[_0x2f43('0x1b')];_0x256ee6[_0x2f43('0x1c')]=_0x262cbf[_0x2f43('0x1c')];}_0x256ee6[_0x2f43('0x1d')]=_0x262cbf[_0x2f43('0x1d')];_0x256ee6[_0x2f43('0x1e')]=_0x262cbf[_0x2f43('0x1e')]||0x3e1;if(_0x262cbf['tls']){_0x256ee6[_0x2f43('0x1f')]=!![];}else{_0x256ee6[_0x2f43('0x1f')]=![];_0x256ee6['autotls']=_0x2f43('0x20');}}else{_0x256ee6[_0x2f43('0x1b')]=_0x262cbf[_0x2f43('0x1b')];_0x256ee6[_0x2f43('0x1c')]=_0x262cbf[_0x2f43('0x1c')];_0x256ee6[_0x2f43('0x1d')]=utils[_0x2f43('0x21')](_0x262cbf['service']);_0x256ee6['port']=0x3e1;_0x256ee6[_0x2f43('0x1f')]=!![];}_0x256ee6[_0x2f43('0x9')]=_0x592e12||_0x262cbf[_0x2f43('0x1b')]||'anonymous@xcally.com';return _0x256ee6;};EmailImap[_0x2f43('0x22')][_0x2f43('0xf')]=function(){this[_0x2f43('0x2')][_0x2f43('0x23')](this[_0x2f43('0xa')],![],this['handleOpenBox'][_0x2f43('0x10')](this));};EmailImap[_0x2f43('0x22')]['handleOpenBox']=function(_0x531597,_0x2c1335){if(_0x531597){this[_0x2f43('0x24')](_0x531597,!![]);}else{this[_0x2f43('0x25')](_0x2f43('0x26'),_0x2c1335);this[_0x2f43('0x27')]();}};EmailImap[_0x2f43('0x22')][_0x2f43('0x28')]=function(_0x3f6840){if(_0x3f6840){this[_0x2f43('0x24')](_0x3f6840,!![]);}else{this['imap'][_0x2f43('0x11')]();}};EmailImap[_0x2f43('0x22')][_0x2f43('0x27')]=function(){this[_0x2f43('0x2')]['search']([_0x2f43('0x29')],this['handleReadUnseen'][_0x2f43('0x10')](this));};EmailImap[_0x2f43('0x22')][_0x2f43('0x2a')]=function(_0x269478,_0x350a72){if(_0x269478){this[_0x2f43('0x24')](_0x269478,!![]);}else{if(_0x350a72['length']){try{var _0x26d1f6=this[_0x2f43('0x2')][_0x2f43('0x2b')](_0x350a72,{'bodies':'','markSeen':!![]});_0x26d1f6['on'](_0x2f43('0x2c'),this[_0x2f43('0x2d')]['bind'](this));_0x26d1f6[_0x2f43('0xd')](_0x2f43('0x13'),this[_0x2f43('0x2e')][_0x2f43('0x10')](this));_0x26d1f6[_0x2f43('0xd')]('end',this[_0x2f43('0x2f')][_0x2f43('0x10')](this));}catch(_0x262989){logger[_0x2f43('0x13')](_0x262989);}}else{this[_0x2f43('0x2')][_0x2f43('0x30')](!![],this['handleCloseBox'][_0x2f43('0x10')](this));}}};EmailImap[_0x2f43('0x22')][_0x2f43('0x2d')]=function(_0x1721e6,_0x15fc02){_0x1721e6['on']('body',this[_0x2f43('0x31')][_0x2f43('0x10')](this));_0x1721e6[_0x2f43('0xd')]('attributes',this[_0x2f43('0x32')][_0x2f43('0x10')](this));_0x1721e6['once'](_0x2f43('0x11'),this['handleMessageEnd'][_0x2f43('0x10')](this));};EmailImap['prototype'][_0x2f43('0x31')]=function(_0x1b91b7,_0x386d2f){simpleParser(_0x1b91b7,this[_0x2f43('0x33')][_0x2f43('0x10')](this));};EmailImap[_0x2f43('0x22')]['handleMessageAttributes']=function(_0x384ccb){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap['prototype'][_0x2f43('0x33')]=function(_0x45699e,_0x17850d){if(_0x45699e){logger[_0x2f43('0x13')](_0x45699e);}else{var _0x3f8f00=this;utils[_0x2f43('0x34')](this[_0x2f43('0xc')],_0x17850d,function(_0x1d5193){_0x3f8f00['emit'](_0x2f43('0x9'),_0x1d5193);});}};EmailImap['prototype'][_0x2f43('0x2f')]=function(){this[_0x2f43('0x2')]['closeBox'](!![],this[_0x2f43('0x28')]['bind'](this));};EmailImap[_0x2f43('0x22')][_0x2f43('0x2e')]=function(_0x390340){this[_0x2f43('0x24')](_0x390340);this['imap'][_0x2f43('0x30')](!![],this[_0x2f43('0x28')][_0x2f43('0x10')](this));};EmailImap[_0x2f43('0x22')][_0x2f43('0x12')]=function(){this[_0x2f43('0x25')](_0x2f43('0x11'));};EmailImap['prototype'][_0x2f43('0x24')]=function(_0x9edde,_0x1a9635){logger[_0x2f43('0x13')](_0x2f43('0x24'),this['account'][_0x2f43('0x9')],JSON[_0x2f43('0x35')](_0x9edde));var _0x47e783='';if(_0x9edde){if(_0x9edde[_0x2f43('0x36')]){_0x47e783=_0x9edde[_0x2f43('0x36')];}else{for(var _0x3242ec in _0x9edde){if(_0x9edde[_0x2f43('0x37')](_0x3242ec)){_0x47e783+=_[_0x2f43('0x38')](_0x3242ec)+':\x20'+_0x9edde[_0x3242ec]+'\x0a';}}}}if(_0x1a9635){this[_0x2f43('0x2')]['end']();}else{this['emit']('error',_0x47e783);this[_0x2f43('0x25')]('end');}};module[_0x2f43('0x39')]=EmailImap;
\ No newline at end of file
+var _0x1667=['email','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','end','readUnseen','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','emit','stringify','hasOwnProperty','exports','path','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','password','host','port','tls','required','getHost'];(function(_0x1dae71,_0x2dec32){var _0x281f2e=function(_0x2c5828){while(--_0x2c5828){_0x1dae71['push'](_0x1dae71['shift']());}};_0x281f2e(++_0x2dec32);}(_0x1667,0xfd));var _0x7166=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x1667[_0x86b219];return _0x1f320c;};'use strict';var fs=require('fs');var path=require(_0x7166('0x0'));var util=require(_0x7166('0x1'));var Imap=require(_0x7166('0x2'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x7166('0x3'))[_0x7166('0x4')];var Iconv=require(_0x7166('0x5'))[_0x7166('0x6')];var EventEmitter=require('events')[_0x7166('0x7')];var utils=require(_0x7166('0x8'));var logger=require(_0x7166('0x9'))('email');function EmailImap(_0x479d81,_0x2ff9e5){this[_0x7166('0xa')]=_0x7166('0xb');this[_0x7166('0xc')]=this[_0x7166('0xd')](_0x479d81,_0x2ff9e5);this[_0x7166('0x2')]=new Imap(this[_0x7166('0xc')]);this[_0x7166('0x2')][_0x7166('0xe')]('ready',this['handleReady'][_0x7166('0xf')](this));this[_0x7166('0x2')][_0x7166('0xe')]('end',this[_0x7166('0x10')][_0x7166('0xf')](this));this['imap']['on'](_0x7166('0x11'),this[_0x7166('0x12')][_0x7166('0xf')](this));this['imap'][_0x7166('0x13')]();}util[_0x7166('0x14')](EmailImap,EventEmitter);EmailImap[_0x7166('0x15')][_0x7166('0xd')]=function(_0x75b1d7,_0x5a1d81){var _0xb25588={'connTimeout':_0x75b1d7[_0x7166('0x16')]?_0x75b1d7[_0x7166('0x16')]*0x3e8:0x2710,'authTimeout':_0x75b1d7[_0x7166('0x17')]?_0x75b1d7[_0x7166('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x75b1d7[_0x7166('0x18')])){if(_0x75b1d7['authentication']){_0xb25588[_0x7166('0x19')]=_0x75b1d7[_0x7166('0x19')];_0xb25588[_0x7166('0x1a')]=_0x75b1d7['password'];}_0xb25588[_0x7166('0x1b')]=_0x75b1d7[_0x7166('0x1b')];_0xb25588['port']=_0x75b1d7[_0x7166('0x1c')]||0x3e1;if(_0x75b1d7[_0x7166('0x1d')]){_0xb25588[_0x7166('0x1d')]=!![];}else{_0xb25588[_0x7166('0x1d')]=![];_0xb25588['autotls']=_0x7166('0x1e');}}else{_0xb25588[_0x7166('0x19')]=_0x75b1d7[_0x7166('0x19')];_0xb25588['password']=_0x75b1d7[_0x7166('0x1a')];_0xb25588[_0x7166('0x1b')]=utils[_0x7166('0x1f')](_0x75b1d7[_0x7166('0x18')]);_0xb25588['port']=0x3e1;_0xb25588[_0x7166('0x1d')]=!![];}_0xb25588[_0x7166('0x20')]=_0x5a1d81||_0x75b1d7[_0x7166('0x19')]||_0x7166('0x21');return _0xb25588;};EmailImap[_0x7166('0x15')]['handleReady']=function(){this[_0x7166('0x2')][_0x7166('0x22')](this[_0x7166('0xa')],![],this[_0x7166('0x23')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x3a914d,_0x83c2c5){if(_0x3a914d){this['handleError'](_0x3a914d,!![]);}else{this['emit'](_0x7166('0x24'),_0x83c2c5);this['readUnseen']();}};EmailImap['prototype'][_0x7166('0x25')]=function(_0x288ed4){if(_0x288ed4){this['handleError'](_0x288ed4,!![]);}else{this['imap'][_0x7166('0x26')]();}};EmailImap[_0x7166('0x15')][_0x7166('0x27')]=function(){this[_0x7166('0x2')]['search']([_0x7166('0x28')],this[_0x7166('0x29')]['bind'](this));};EmailImap[_0x7166('0x15')][_0x7166('0x29')]=function(_0x424eed,_0x18ef18){if(_0x424eed){this['handleError'](_0x424eed,!![]);}else{if(_0x18ef18[_0x7166('0x2a')]){try{var _0x260c78=this[_0x7166('0x2')]['fetch'](_0x18ef18,{'bodies':'','markSeen':!![]});_0x260c78['on'](_0x7166('0x2b'),this[_0x7166('0x2c')]['bind'](this));_0x260c78[_0x7166('0xe')](_0x7166('0x11'),this[_0x7166('0x2d')][_0x7166('0xf')](this));_0x260c78['once'](_0x7166('0x26'),this[_0x7166('0x2e')][_0x7166('0xf')](this));}catch(_0x2c57e5){logger[_0x7166('0x11')](_0x2c57e5);}}else{this[_0x7166('0x2')][_0x7166('0x2f')](!![],this[_0x7166('0x25')][_0x7166('0xf')](this));}}};EmailImap[_0x7166('0x15')][_0x7166('0x2c')]=function(_0xb3e679,_0x2b79e9){_0xb3e679['on'](_0x7166('0x30'),this[_0x7166('0x31')]['bind'](this));_0xb3e679[_0x7166('0xe')]('attributes',this['handleMessageAttributes']['bind'](this));_0xb3e679[_0x7166('0xe')](_0x7166('0x26'),this['handleMessageEnd'][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')]['handleMessageBody']=function(_0x40e19e,_0xf11394){simpleParser(_0x40e19e,{'Iconv':Iconv},this['handleSimpleParser'][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')][_0x7166('0x32')]=function(_0x5e0cdf){};EmailImap[_0x7166('0x15')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x7166('0x33')]=function(_0x4d3569,_0xbbde1c){if(_0x4d3569){logger[_0x7166('0x11')](_0x4d3569);}else{var _0x2a2262=this;utils[_0x7166('0x34')](this[_0x7166('0xc')],_0xbbde1c,function(_0x3ea80f){_0x2a2262[_0x7166('0x35')](_0x7166('0x20'),_0x3ea80f);});}};EmailImap[_0x7166('0x15')][_0x7166('0x2e')]=function(){this['imap']['closeBox'](!![],this[_0x7166('0x25')]['bind'](this));};EmailImap['prototype'][_0x7166('0x2d')]=function(_0xd39b09){this[_0x7166('0x12')](_0xd39b09);this[_0x7166('0x2')]['closeBox'](!![],this[_0x7166('0x25')][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')][_0x7166('0x10')]=function(){this[_0x7166('0x35')]('end');};EmailImap[_0x7166('0x15')][_0x7166('0x12')]=function(_0x4d951b,_0x1b6d18){logger[_0x7166('0x11')](_0x7166('0x12'),this[_0x7166('0xc')][_0x7166('0x20')],JSON[_0x7166('0x36')](_0x4d951b));var _0x3c2251='';if(_0x4d951b){if(_0x4d951b['textCode']){_0x3c2251=_0x4d951b['textCode'];}else{for(var _0x170535 in _0x4d951b){if(_0x4d951b[_0x7166('0x37')](_0x170535)){_0x3c2251+=_['upperFirst'](_0x170535)+':\x20'+_0x4d951b[_0x170535]+'\x0a';}}}}if(_0x1b6d18){this[_0x7166('0x2')]['end']();}else{this[_0x7166('0x35')]('error',_0x3c2251);this[_0x7166('0x35')](_0x7166('0x26'));}};module[_0x7166('0x38')]=EmailImap;
\ No newline at end of file