Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / services / email / lib / imap.js
index 6bdec3c..9c90769 100644 (file)
@@ -1 +1 @@
-const a1152_0x2ca4=['INBOX','message','simpleParser','handleOpenBox','iconv','inherits','upperFirst','password','connect','body','events','handleFetchError','EventEmitter','length','handleError','closeBox','parser','account','mailparser','handleMessageAttributes','getHost','readUnseen','email','authTimeout','getAccount','isNil','user','handleReadUnseen','handleFetchEnd','anonymous@xcally.com','undefined','required','port','openBox','fetch','stringify','textCode','host','tls','handleMessageBody','handleEnd','ready','exports','error','handleSimpleParser','once','../../../config/logger','lodash','emit','connTimeout','util','search','imap','authentication','mailbox','handleFetchMessage','bind','end','autotls','Iconv','service','handleMessageEnd','handleReady','prototype','handleCloseBox'];(function(_0x30b7f0,_0x2ca43e){const _0x42839e=function(_0x18b8c5){while(--_0x18b8c5){_0x30b7f0['push'](_0x30b7f0['shift']());}};_0x42839e(++_0x2ca43e);}(a1152_0x2ca4,0x1cf));const a1152_0x4283=function(_0x30b7f0,_0x2ca43e){_0x30b7f0=_0x30b7f0-0x0;let _0x42839e=a1152_0x2ca4[_0x30b7f0];return _0x42839e;};const _0x25e3b6=a1152_0x4283;'use strict';const util=require(_0x25e3b6('0x2a')),Imap=require(_0x25e3b6('0x2c')),_=require(_0x25e3b6('0x27')),simpleParser=require(_0x25e3b6('0xa'))[_0x25e3b6('0x3b')],Iconv=require(_0x25e3b6('0x3d'))[_0x25e3b6('0x33')],EventEmitter=require(_0x25e3b6('0x2'))[_0x25e3b6('0x4')],utils=require('./utils'),logger=require(_0x25e3b6('0x26'))(_0x25e3b6('0xe'));function EmailImap(_0x18b8c5,_0x2b78b1){const _0x350f65=_0x25e3b6;this['mailbox']=_0x350f65('0x39'),this[_0x350f65('0x9')]=this['getAccount'](_0x18b8c5,_0x2b78b1),this[_0x350f65('0x2c')]=new Imap(this[_0x350f65('0x9')]),this[_0x350f65('0x2c')]['once'](_0x350f65('0x21'),this['handleReady'][_0x350f65('0x30')](this)),this[_0x350f65('0x2c')][_0x350f65('0x25')](_0x350f65('0x31'),this[_0x350f65('0x20')]['bind'](this)),this[_0x350f65('0x2c')]['on'](_0x350f65('0x23'),this[_0x350f65('0x6')][_0x350f65('0x30')](this)),this[_0x350f65('0x2c')][_0x350f65('0x0')]();}util[_0x25e3b6('0x3e')](EmailImap,EventEmitter),EmailImap['prototype'][_0x25e3b6('0x10')]=function(_0x50d153,_0x1f42cc){const _0x44ddf1=_0x25e3b6,_0x3a225b={'connTimeout':_0x50d153[_0x44ddf1('0x29')]?_0x50d153[_0x44ddf1('0x29')]*0x3e8:0x2710,'authTimeout':_0x50d153[_0x44ddf1('0xf')]?_0x50d153[_0x44ddf1('0xf')]*0x3e8:0x1388};return _[_0x44ddf1('0x11')](_0x50d153[_0x44ddf1('0x34')])?(_0x50d153[_0x44ddf1('0x2d')]&&(_0x3a225b[_0x44ddf1('0x12')]=_0x50d153[_0x44ddf1('0x12')],_0x3a225b['password']=_0x50d153[_0x44ddf1('0x40')]),_0x3a225b['host']=_0x50d153[_0x44ddf1('0x1d')],_0x3a225b[_0x44ddf1('0x18')]=_0x50d153[_0x44ddf1('0x18')]||0x3e1,_0x50d153[_0x44ddf1('0x1e')]?_0x3a225b['tls']=!![]:(_0x3a225b[_0x44ddf1('0x1e')]=![],_0x3a225b[_0x44ddf1('0x32')]=_0x44ddf1('0x17'))):(_0x3a225b['user']=_0x50d153[_0x44ddf1('0x12')],_0x3a225b[_0x44ddf1('0x40')]=_0x50d153['password'],_0x3a225b[_0x44ddf1('0x1d')]=utils[_0x44ddf1('0xc')](_0x50d153['service']),_0x3a225b[_0x44ddf1('0x18')]=0x3e1,_0x3a225b[_0x44ddf1('0x1e')]=!![]),_0x3a225b[_0x44ddf1('0xe')]=_0x1f42cc||_0x50d153[_0x44ddf1('0x12')]||_0x44ddf1('0x15'),_0x3a225b;},EmailImap['prototype'][_0x25e3b6('0x36')]=function(){const _0x5111eb=_0x25e3b6;this['imap'][_0x5111eb('0x19')](this[_0x5111eb('0x2e')],![],this['handleOpenBox'][_0x5111eb('0x30')](this));},EmailImap['prototype'][_0x25e3b6('0x3c')]=function(_0x2a7a57,_0x5ae4b6){const _0x4ed345=_0x25e3b6;_0x2a7a57?this[_0x4ed345('0x6')](_0x2a7a57,!![]):(this[_0x4ed345('0x28')]('box',_0x5ae4b6),this[_0x4ed345('0xd')]());},EmailImap[_0x25e3b6('0x37')]['handleCloseBox']=function(_0x4b9582){const _0x6409bb=_0x25e3b6;_0x4b9582?this[_0x6409bb('0x6')](_0x4b9582,!![]):this[_0x6409bb('0x2c')][_0x6409bb('0x31')]();},EmailImap['prototype'][_0x25e3b6('0xd')]=function(){const _0x32435e=_0x25e3b6;this[_0x32435e('0x2c')][_0x32435e('0x2b')](['UNSEEN'],this[_0x32435e('0x13')][_0x32435e('0x30')](this));},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x13')]=function(_0x3acb4a,_0x2f0122){const _0x597627=_0x25e3b6;if(_0x3acb4a)this[_0x597627('0x6')](_0x3acb4a,!![]);else{if(_0x2f0122[_0x597627('0x5')])try{const _0x556a4b=this['imap'][_0x597627('0x1a')](_0x2f0122,{'bodies':'','markSeen':!![]});_0x556a4b['on'](_0x597627('0x3a'),this[_0x597627('0x2f')][_0x597627('0x30')](this)),_0x556a4b[_0x597627('0x25')](_0x597627('0x23'),this[_0x597627('0x3')]['bind'](this)),_0x556a4b[_0x597627('0x25')](_0x597627('0x31'),this[_0x597627('0x14')][_0x597627('0x30')](this));}catch(_0x530665){logger['error'](_0x530665);}else this[_0x597627('0x2c')][_0x597627('0x7')](!![],this['handleCloseBox']['bind'](this));}},EmailImap['prototype']['handleFetchMessage']=function(_0x135766){const _0x2be3ec=_0x25e3b6;_0x135766['on'](_0x2be3ec('0x1'),this['handleMessageBody'][_0x2be3ec('0x30')](this)),_0x135766[_0x2be3ec('0x25')]('attributes',this['handleMessageAttributes'][_0x2be3ec('0x30')](this)),_0x135766[_0x2be3ec('0x25')](_0x2be3ec('0x31'),this[_0x2be3ec('0x35')][_0x2be3ec('0x30')](this));},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x1f')]=function(_0x3777d2){simpleParser(_0x3777d2,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));},EmailImap['prototype'][_0x25e3b6('0xb')]=function(){},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x35')]=function(){},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x24')]=function(_0x1056b2,_0x4816dd){const _0x2beae9=_0x25e3b6;if(_0x1056b2)logger[_0x2beae9('0x23')](_0x1056b2);else{const _0x4c884b=this;utils[_0x2beae9('0x8')](this[_0x2beae9('0x9')],_0x4816dd,function(_0x3d6eb9){const _0x28e936=_0x2beae9;_0x4c884b[_0x28e936('0x28')](_0x28e936('0xe'),_0x3d6eb9);});}},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x14')]=function(){const _0x5cf342=_0x25e3b6;this[_0x5cf342('0x2c')][_0x5cf342('0x7')](!![],this[_0x5cf342('0x38')][_0x5cf342('0x30')](this));},EmailImap['prototype'][_0x25e3b6('0x3')]=function(_0x512e80){const _0x2a05e2=_0x25e3b6;this[_0x2a05e2('0x6')](_0x512e80),this[_0x2a05e2('0x2c')]['closeBox'](!![],this[_0x2a05e2('0x38')][_0x2a05e2('0x30')](this));},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x20')]=function(){this['emit']('end');},EmailImap[_0x25e3b6('0x37')][_0x25e3b6('0x6')]=function(_0x17b1fc,_0x4b7c5a){const _0x178b20=_0x25e3b6;logger[_0x178b20('0x23')]('handleError',this[_0x178b20('0x9')][_0x178b20('0xe')],JSON[_0x178b20('0x1b')](_0x17b1fc));let _0x7d7fe8='';if(_0x17b1fc){if(_0x17b1fc[_0x178b20('0x1c')])_0x7d7fe8=_0x17b1fc[_0x178b20('0x1c')];else for(const _0x568b13 in _0x17b1fc){typeof _0x17b1fc[_0x568b13]!==_0x178b20('0x16')&&(_0x7d7fe8+=_[_0x178b20('0x3f')](_0x568b13)+':\x20'+_0x17b1fc[_0x568b13]+'\x0a');}}_0x4b7c5a?this[_0x178b20('0x2c')]['end']():(this[_0x178b20('0x28')](_0x178b20('0x23'),_0x7d7fe8),this[_0x178b20('0x28')](_0x178b20('0x31')));},module[_0x25e3b6('0x22')]=EmailImap;
\ No newline at end of file
+const a1152_0x4555=['connect','port','../../../config/logger','Iconv','closeBox','handleMessageAttributes','handleFetchError','mailparser','anonymous@xcally.com','readUnseen','bind','search','prototype','handleSimpleParser','handleMessageBody','lodash','getHost','account','handleFetchMessage','emit','password','autotls','events','handleMessageEnd','body','fetch','error','handleReadUnseen','user','handleError','host','handleOpenBox','length','authTimeout','once','email','tls','attributes','connTimeout','getAccount','upperFirst','undefined','parser','message','end','handleFetchEnd','handleCloseBox','handleReady','required','EventEmitter','imap','mailbox','util','ready','handleEnd','inherits','textCode'];(function(_0x756a74,_0x455543){const _0x4e3d63=function(_0x54d237){while(--_0x54d237){_0x756a74['push'](_0x756a74['shift']());}};_0x4e3d63(++_0x455543);}(a1152_0x4555,0x6f));const a1152_0x4e3d=function(_0x756a74,_0x455543){_0x756a74=_0x756a74-0x0;let _0x4e3d63=a1152_0x4555[_0x756a74];return _0x4e3d63;};const _0x2fa7b0=a1152_0x4e3d;'use strict';const util=require(_0x2fa7b0('0x37')),Imap=require(_0x2fa7b0('0x35')),_=require(_0x2fa7b0('0x12')),simpleParser=require(_0x2fa7b0('0xa'))['simpleParser'],Iconv=require('iconv')[_0x2fa7b0('0x6')],EventEmitter=require(_0x2fa7b0('0x19'))[_0x2fa7b0('0x34')],utils=require('./utils'),logger=require(_0x2fa7b0('0x5'))(_0x2fa7b0('0x26'));function EmailImap(_0x54d237,_0x5c31e9){const _0xb571d2=_0x2fa7b0;this[_0xb571d2('0x36')]='INBOX',this[_0xb571d2('0x14')]=this[_0xb571d2('0x2a')](_0x54d237,_0x5c31e9),this[_0xb571d2('0x35')]=new Imap(this[_0xb571d2('0x14')]),this[_0xb571d2('0x35')][_0xb571d2('0x25')](_0xb571d2('0x38'),this[_0xb571d2('0x32')][_0xb571d2('0xd')](this)),this[_0xb571d2('0x35')][_0xb571d2('0x25')](_0xb571d2('0x2f'),this[_0xb571d2('0x0')]['bind'](this)),this['imap']['on']('error',this['handleError']['bind'](this)),this[_0xb571d2('0x35')][_0xb571d2('0x3')]();}util[_0x2fa7b0('0x1')](EmailImap,EventEmitter),EmailImap['prototype'][_0x2fa7b0('0x2a')]=function(_0x1b27f0,_0x3bb99e){const _0xd487e5=_0x2fa7b0,_0x14c8f4={'connTimeout':_0x1b27f0[_0xd487e5('0x29')]?_0x1b27f0[_0xd487e5('0x29')]*0x3e8:0x2710,'authTimeout':_0x1b27f0['authTimeout']?_0x1b27f0[_0xd487e5('0x24')]*0x3e8:0x1388};return _['isNil'](_0x1b27f0['service'])?(_0x1b27f0['authentication']&&(_0x14c8f4[_0xd487e5('0x1f')]=_0x1b27f0[_0xd487e5('0x1f')],_0x14c8f4[_0xd487e5('0x17')]=_0x1b27f0[_0xd487e5('0x17')]),_0x14c8f4[_0xd487e5('0x21')]=_0x1b27f0['host'],_0x14c8f4['port']=_0x1b27f0[_0xd487e5('0x4')]||0x3e1,_0x1b27f0[_0xd487e5('0x27')]?_0x14c8f4['tls']=!![]:(_0x14c8f4[_0xd487e5('0x27')]=![],_0x14c8f4[_0xd487e5('0x18')]=_0xd487e5('0x33'))):(_0x14c8f4[_0xd487e5('0x1f')]=_0x1b27f0[_0xd487e5('0x1f')],_0x14c8f4['password']=_0x1b27f0[_0xd487e5('0x17')],_0x14c8f4[_0xd487e5('0x21')]=utils[_0xd487e5('0x13')](_0x1b27f0['service']),_0x14c8f4[_0xd487e5('0x4')]=0x3e1,_0x14c8f4[_0xd487e5('0x27')]=!![]),_0x14c8f4[_0xd487e5('0x26')]=_0x3bb99e||_0x1b27f0[_0xd487e5('0x1f')]||_0xd487e5('0xb'),_0x14c8f4;},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x32')]=function(){const _0x59e8dc=_0x2fa7b0;this[_0x59e8dc('0x35')]['openBox'](this[_0x59e8dc('0x36')],![],this[_0x59e8dc('0x22')][_0x59e8dc('0xd')](this));},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x22')]=function(_0xc53232,_0x1ff7a2){const _0x2a9c48=_0x2fa7b0;_0xc53232?this[_0x2a9c48('0x20')](_0xc53232,!![]):(this['emit']('box',_0x1ff7a2),this[_0x2a9c48('0xc')]());},EmailImap[_0x2fa7b0('0xf')]['handleCloseBox']=function(_0x22171d){const _0x1232bc=_0x2fa7b0;_0x22171d?this['handleError'](_0x22171d,!![]):this[_0x1232bc('0x35')][_0x1232bc('0x2f')]();},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0xc')]=function(){const _0x5130d8=_0x2fa7b0;this[_0x5130d8('0x35')][_0x5130d8('0xe')](['UNSEEN'],this[_0x5130d8('0x1e')][_0x5130d8('0xd')](this));},EmailImap['prototype'][_0x2fa7b0('0x1e')]=function(_0x3ad9ba,_0x4e848f){const _0xedfb01=_0x2fa7b0;if(_0x3ad9ba)this[_0xedfb01('0x20')](_0x3ad9ba,!![]);else{if(_0x4e848f[_0xedfb01('0x23')])try{const _0x4fd1d4=this['imap'][_0xedfb01('0x1c')](_0x4e848f,{'bodies':'','markSeen':!![]});_0x4fd1d4['on'](_0xedfb01('0x2e'),this[_0xedfb01('0x15')]['bind'](this)),_0x4fd1d4[_0xedfb01('0x25')](_0xedfb01('0x1d'),this[_0xedfb01('0x9')]['bind'](this)),_0x4fd1d4[_0xedfb01('0x25')]('end',this[_0xedfb01('0x30')]['bind'](this));}catch(_0x462f97){logger[_0xedfb01('0x1d')](_0x462f97);}else this[_0xedfb01('0x35')][_0xedfb01('0x7')](!![],this[_0xedfb01('0x31')]['bind'](this));}},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x15')]=function(_0x30155b){const _0x5547c4=_0x2fa7b0;_0x30155b['on'](_0x5547c4('0x1b'),this[_0x5547c4('0x11')]['bind'](this)),_0x30155b[_0x5547c4('0x25')](_0x5547c4('0x28'),this[_0x5547c4('0x8')][_0x5547c4('0xd')](this)),_0x30155b['once'](_0x5547c4('0x2f'),this[_0x5547c4('0x1a')][_0x5547c4('0xd')](this));},EmailImap['prototype'][_0x2fa7b0('0x11')]=function(_0x4f9113){const _0x186c0b=_0x2fa7b0;simpleParser(_0x4f9113,{'Iconv':Iconv},this[_0x186c0b('0x10')][_0x186c0b('0xd')](this));},EmailImap['prototype'][_0x2fa7b0('0x8')]=function(){},EmailImap[_0x2fa7b0('0xf')]['handleMessageEnd']=function(){},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x10')]=function(_0x5b38bc,_0x282db5){const _0x56387d=_0x2fa7b0;if(_0x5b38bc)logger[_0x56387d('0x1d')](_0x5b38bc);else{const _0x147b01=this;utils[_0x56387d('0x2d')](this[_0x56387d('0x14')],_0x282db5,function(_0x2c0d8c){const _0x59abc5=_0x56387d;_0x147b01[_0x59abc5('0x16')]('email',_0x2c0d8c);});}},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x30')]=function(){const _0x498689=_0x2fa7b0;this['imap'][_0x498689('0x7')](!![],this[_0x498689('0x31')][_0x498689('0xd')](this));},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x9')]=function(_0x1f241f){const _0xd7ca75=_0x2fa7b0;this[_0xd7ca75('0x20')](_0x1f241f),this[_0xd7ca75('0x35')][_0xd7ca75('0x7')](!![],this[_0xd7ca75('0x31')][_0xd7ca75('0xd')](this));},EmailImap[_0x2fa7b0('0xf')][_0x2fa7b0('0x0')]=function(){const _0x404531=_0x2fa7b0;this[_0x404531('0x16')](_0x404531('0x2f'));},EmailImap['prototype']['handleError']=function(_0x16fcc2,_0x51aed4){const _0x2c3ec5=_0x2fa7b0;logger['error'](_0x2c3ec5('0x20'),this[_0x2c3ec5('0x14')][_0x2c3ec5('0x26')],JSON['stringify'](_0x16fcc2));let _0x144c5d='';if(_0x16fcc2){if(_0x16fcc2[_0x2c3ec5('0x2')])_0x144c5d=_0x16fcc2[_0x2c3ec5('0x2')];else for(const _0x2b8dd6 in _0x16fcc2){typeof _0x16fcc2[_0x2b8dd6]!==_0x2c3ec5('0x2c')&&(_0x144c5d+=_[_0x2c3ec5('0x2b')](_0x2b8dd6)+':\x20'+_0x16fcc2[_0x2b8dd6]+'\x0a');}}_0x51aed4?this[_0x2c3ec5('0x35')][_0x2c3ec5('0x2f')]():(this[_0x2c3ec5('0x16')]('error',_0x144c5d),this[_0x2c3ec5('0x16')](_0x2c3ec5('0x2f')));},module['exports']=EmailImap;
\ No newline at end of file