Built motion from commit ded33658aad58fc8de845a8299a9db59a88cc353. Version 3.0.0...
[motion-next.git] / server / services / email / lib / imap.js
index 1222898..6bc3386 100644 (file)
@@ -1 +1 @@
-const a1152_0x2d20=['user','prototype','message','password','search','mailbox','handleEnd','length','handleMessageBody','bind','stringify','imap','handleOpenBox','handleMessageEnd','end','./utils','email','util','tls','handleMessageAttributes','service','once','host','openBox','ready','upperFirst','account','closeBox','inherits','fetch','connect','../../../config/logger','events','getHost','handleReadUnseen','handleError','anonymous@xcally.com','handleCloseBox','authentication','isNil','connTimeout','undefined','error','box','emit','UNSEEN','lodash','handleReady','parser','body','port','simpleParser','iconv','INBOX','getAccount','handleFetchMessage','handleFetchError','readUnseen','required','authTimeout','attributes','exports'];(function(_0x279c8c,_0x2d2058){const _0x2b3881=function(_0x5a24fc){while(--_0x5a24fc){_0x279c8c['push'](_0x279c8c['shift']());}};_0x2b3881(++_0x2d2058);}(a1152_0x2d20,0x1a7));const a1152_0x2b38=function(_0x279c8c,_0x2d2058){_0x279c8c=_0x279c8c-0x0;let _0x2b3881=a1152_0x2d20[_0x279c8c];return _0x2b3881;};const _0x2f7538=a1152_0x2b38;'use strict';const util=require(_0x2f7538('0x1c')),Imap=require(_0x2f7538('0x16')),_=require(_0x2f7538('0x39')),simpleParser=require('mailparser')[_0x2f7538('0x0')],Iconv=require(_0x2f7538('0x1'))['Iconv'],EventEmitter=require(_0x2f7538('0x2b'))['EventEmitter'],utils=require(_0x2f7538('0x1a')),logger=require(_0x2f7538('0x2a'))('email');function EmailImap(_0x5a24fc,_0x12ddc1){const _0x2a449d=_0x2f7538;this['mailbox']=_0x2a449d('0x2'),this['account']=this['getAccount'](_0x5a24fc,_0x12ddc1),this[_0x2a449d('0x16')]=new Imap(this[_0x2a449d('0x25')]),this[_0x2a449d('0x16')]['once'](_0x2a449d('0x23'),this[_0x2a449d('0x3a')][_0x2a449d('0x14')](this)),this[_0x2a449d('0x16')][_0x2a449d('0x20')](_0x2a449d('0x19'),this[_0x2a449d('0x11')]['bind'](this)),this[_0x2a449d('0x16')]['on'](_0x2a449d('0x35'),this[_0x2a449d('0x2e')][_0x2a449d('0x14')](this)),this[_0x2a449d('0x16')][_0x2a449d('0x29')]();}util[_0x2f7538('0x27')](EmailImap,EventEmitter),EmailImap['prototype'][_0x2f7538('0x3')]=function(_0x4629b6,_0x2a06cb){const _0x5ce1e9=_0x2f7538,_0xe3133c={'connTimeout':_0x4629b6[_0x5ce1e9('0x33')]?_0x4629b6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4629b6[_0x5ce1e9('0x8')]?_0x4629b6[_0x5ce1e9('0x8')]*0x3e8:0x1388};return _[_0x5ce1e9('0x32')](_0x4629b6[_0x5ce1e9('0x1f')])?(_0x4629b6[_0x5ce1e9('0x31')]&&(_0xe3133c[_0x5ce1e9('0xb')]=_0x4629b6[_0x5ce1e9('0xb')],_0xe3133c['password']=_0x4629b6[_0x5ce1e9('0xe')]),_0xe3133c['host']=_0x4629b6[_0x5ce1e9('0x21')],_0xe3133c[_0x5ce1e9('0x3d')]=_0x4629b6[_0x5ce1e9('0x3d')]||0x3e1,_0x4629b6[_0x5ce1e9('0x1d')]?_0xe3133c[_0x5ce1e9('0x1d')]=!![]:(_0xe3133c['tls']=![],_0xe3133c['autotls']=_0x5ce1e9('0x7'))):(_0xe3133c[_0x5ce1e9('0xb')]=_0x4629b6[_0x5ce1e9('0xb')],_0xe3133c[_0x5ce1e9('0xe')]=_0x4629b6[_0x5ce1e9('0xe')],_0xe3133c[_0x5ce1e9('0x21')]=utils[_0x5ce1e9('0x2c')](_0x4629b6[_0x5ce1e9('0x1f')]),_0xe3133c[_0x5ce1e9('0x3d')]=0x3e1,_0xe3133c[_0x5ce1e9('0x1d')]=!![]),_0xe3133c[_0x5ce1e9('0x1b')]=_0x2a06cb||_0x4629b6[_0x5ce1e9('0xb')]||_0x5ce1e9('0x2f'),_0xe3133c;},EmailImap[_0x2f7538('0xc')]['handleReady']=function(){const _0x436d3f=_0x2f7538;this[_0x436d3f('0x16')][_0x436d3f('0x22')](this[_0x436d3f('0x10')],![],this[_0x436d3f('0x17')][_0x436d3f('0x14')](this));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x17')]=function(_0x24dbab,_0x593fee){const _0x2a5b71=_0x2f7538;_0x24dbab?this[_0x2a5b71('0x2e')](_0x24dbab,!![]):(this[_0x2a5b71('0x37')](_0x2a5b71('0x36'),_0x593fee),this[_0x2a5b71('0x6')]());},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x30')]=function(_0x1c13f5){const _0x2f8ebe=_0x2f7538;_0x1c13f5?this[_0x2f8ebe('0x2e')](_0x1c13f5,!![]):this[_0x2f8ebe('0x16')][_0x2f8ebe('0x19')]();},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x6')]=function(){const _0x44a57b=_0x2f7538;this[_0x44a57b('0x16')][_0x44a57b('0xf')]([_0x44a57b('0x38')],this[_0x44a57b('0x2d')]['bind'](this));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x2d')]=function(_0x44f007,_0x16004b){const _0x4f351e=_0x2f7538;if(_0x44f007)this[_0x4f351e('0x2e')](_0x44f007,!![]);else{if(_0x16004b[_0x4f351e('0x12')])try{const _0x64bb82=this[_0x4f351e('0x16')][_0x4f351e('0x28')](_0x16004b,{'bodies':'','markSeen':!![]});_0x64bb82['on'](_0x4f351e('0xd'),this['handleFetchMessage']['bind'](this)),_0x64bb82[_0x4f351e('0x20')]('error',this[_0x4f351e('0x5')][_0x4f351e('0x14')](this)),_0x64bb82[_0x4f351e('0x20')](_0x4f351e('0x19'),this['handleFetchEnd'][_0x4f351e('0x14')](this));}catch(_0x3dffff){logger['error'](_0x3dffff);}else this['imap'][_0x4f351e('0x26')](!![],this[_0x4f351e('0x30')]['bind'](this));}},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x4')]=function(_0x20ef28){const _0x5e73c1=_0x2f7538;_0x20ef28['on'](_0x5e73c1('0x3c'),this['handleMessageBody'][_0x5e73c1('0x14')](this)),_0x20ef28[_0x5e73c1('0x20')](_0x5e73c1('0x9'),this[_0x5e73c1('0x1e')]['bind'](this)),_0x20ef28[_0x5e73c1('0x20')](_0x5e73c1('0x19'),this['handleMessageEnd'][_0x5e73c1('0x14')](this));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x13')]=function(_0x2faddd){const _0x162cd8=_0x2f7538;simpleParser(_0x2faddd,{'Iconv':Iconv},this['handleSimpleParser'][_0x162cd8('0x14')](this));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x1e')]=function(){},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x18')]=function(){},EmailImap[_0x2f7538('0xc')]['handleSimpleParser']=function(_0x8dc5f,_0x594fc2){const _0x5237d0=_0x2f7538;if(_0x8dc5f)logger[_0x5237d0('0x35')](_0x8dc5f);else{const _0x229aa6=this;utils[_0x5237d0('0x3b')](this[_0x5237d0('0x25')],_0x594fc2,function(_0x404344){const _0x517834=_0x5237d0;_0x229aa6[_0x517834('0x37')]('email',_0x404344);});}},EmailImap['prototype']['handleFetchEnd']=function(){const _0x1568d6=_0x2f7538;this[_0x1568d6('0x16')][_0x1568d6('0x26')](!![],this[_0x1568d6('0x30')]['bind'](this));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x5')]=function(_0x15b097){const _0x563580=_0x2f7538;this[_0x563580('0x2e')](_0x15b097),this['imap'][_0x563580('0x26')](!![],this['handleCloseBox'][_0x563580('0x14')](this));},EmailImap[_0x2f7538('0xc')]['handleEnd']=function(){const _0x1d3908=_0x2f7538;this[_0x1d3908('0x37')](_0x1d3908('0x19'));},EmailImap[_0x2f7538('0xc')][_0x2f7538('0x2e')]=function(_0x1c5808,_0x2d8647){const _0x5693cd=_0x2f7538;logger['error'](_0x5693cd('0x2e'),this[_0x5693cd('0x25')][_0x5693cd('0x1b')],JSON[_0x5693cd('0x15')](_0x1c5808));let _0xafab73='';if(_0x1c5808){if(_0x1c5808['textCode'])_0xafab73=_0x1c5808['textCode'];else for(const _0x5598e0 in _0x1c5808){typeof _0x1c5808[_0x5598e0]!==_0x5693cd('0x34')&&(_0xafab73+=_[_0x5693cd('0x24')](_0x5598e0)+':\x20'+_0x1c5808[_0x5598e0]+'\x0a');}}_0x2d8647?this[_0x5693cd('0x16')]['end']():(this[_0x5693cd('0x37')](_0x5693cd('0x35'),_0xafab73),this[_0x5693cd('0x37')](_0x5693cd('0x19')));},module[_0x2f7538('0xa')]=EmailImap;
\ No newline at end of file
+const a1152_0x500f=['getAccount','account','../../../config/logger','mailbox','UNSEEN','length','handleSimpleParser','end','emit','inherits','handleMessageBody','attributes','host','required','handleReadUnseen','password','handleEnd','port','readUnseen','imap','autotls','handleMessageEnd','bind','EventEmitter','ready','stringify','openBox','handleFetchMessage','tls','handleFetchError','textCode','service','body','prototype','handleOpenBox','mailparser','message','handleMessageAttributes','iconv','once','connTimeout','closeBox','email','error','handleError','fetch','authTimeout','handleCloseBox','user','handleReady','lodash','handleFetchEnd'];(function(_0x14e1d6,_0x500fe3){const _0x4c42a3=function(_0x552bbb){while(--_0x552bbb){_0x14e1d6['push'](_0x14e1d6['shift']());}};_0x4c42a3(++_0x500fe3);}(a1152_0x500f,0x1e0));const a1152_0x4c42=function(_0x14e1d6,_0x500fe3){_0x14e1d6=_0x14e1d6-0x0;let _0x4c42a3=a1152_0x500f[_0x14e1d6];return _0x4c42a3;};const _0x671215=a1152_0x4c42;'use strict';const util=require('util'),Imap=require(_0x671215('0x7')),_=require(_0x671215('0x26')),simpleParser=require(_0x671215('0x17'))['simpleParser'],Iconv=require(_0x671215('0x1a'))['Iconv'],EventEmitter=require('events')[_0x671215('0xb')],utils=require('./utils'),logger=require(_0x671215('0x2a'))(_0x671215('0x1e'));function EmailImap(_0x552bbb,_0x21d8e6){const _0x26da48=_0x671215;this[_0x26da48('0x2b')]='INBOX',this[_0x26da48('0x29')]=this['getAccount'](_0x552bbb,_0x21d8e6),this[_0x26da48('0x7')]=new Imap(this['account']),this[_0x26da48('0x7')]['once'](_0x26da48('0xc'),this[_0x26da48('0x25')][_0x26da48('0xa')](this)),this[_0x26da48('0x7')][_0x26da48('0x1b')](_0x26da48('0x2f'),this[_0x26da48('0x4')][_0x26da48('0xa')](this)),this[_0x26da48('0x7')]['on'](_0x26da48('0x1f'),this['handleError'][_0x26da48('0xa')](this)),this[_0x26da48('0x7')]['connect']();}util[_0x671215('0x31')](EmailImap,EventEmitter),EmailImap[_0x671215('0x15')][_0x671215('0x28')]=function(_0x378053,_0x58fdf5){const _0x5113ee=_0x671215,_0x46cd4e={'connTimeout':_0x378053[_0x5113ee('0x1c')]?_0x378053[_0x5113ee('0x1c')]*0x3e8:0x2710,'authTimeout':_0x378053[_0x5113ee('0x22')]?_0x378053['authTimeout']*0x3e8:0x1388};return _['isNil'](_0x378053['service'])?(_0x378053['authentication']&&(_0x46cd4e['user']=_0x378053[_0x5113ee('0x24')],_0x46cd4e[_0x5113ee('0x3')]=_0x378053[_0x5113ee('0x3')]),_0x46cd4e[_0x5113ee('0x0')]=_0x378053['host'],_0x46cd4e[_0x5113ee('0x5')]=_0x378053[_0x5113ee('0x5')]||0x3e1,_0x378053[_0x5113ee('0x10')]?_0x46cd4e['tls']=!![]:(_0x46cd4e[_0x5113ee('0x10')]=![],_0x46cd4e[_0x5113ee('0x8')]=_0x5113ee('0x1'))):(_0x46cd4e[_0x5113ee('0x24')]=_0x378053[_0x5113ee('0x24')],_0x46cd4e['password']=_0x378053[_0x5113ee('0x3')],_0x46cd4e[_0x5113ee('0x0')]=utils['getHost'](_0x378053[_0x5113ee('0x13')]),_0x46cd4e[_0x5113ee('0x5')]=0x3e1,_0x46cd4e[_0x5113ee('0x10')]=!![]),_0x46cd4e[_0x5113ee('0x1e')]=_0x58fdf5||_0x378053['user']||'anonymous@xcally.com',_0x46cd4e;},EmailImap[_0x671215('0x15')][_0x671215('0x25')]=function(){const _0x2387e5=_0x671215;this[_0x2387e5('0x7')][_0x2387e5('0xe')](this[_0x2387e5('0x2b')],![],this[_0x2387e5('0x16')][_0x2387e5('0xa')](this));},EmailImap['prototype'][_0x671215('0x16')]=function(_0x5a3011,_0x213c1f){const _0x3c98f5=_0x671215;_0x5a3011?this[_0x3c98f5('0x20')](_0x5a3011,!![]):(this[_0x3c98f5('0x30')]('box',_0x213c1f),this[_0x3c98f5('0x6')]());},EmailImap[_0x671215('0x15')][_0x671215('0x23')]=function(_0x2e22b5){const _0x1d4aee=_0x671215;_0x2e22b5?this['handleError'](_0x2e22b5,!![]):this[_0x1d4aee('0x7')][_0x1d4aee('0x2f')]();},EmailImap[_0x671215('0x15')]['readUnseen']=function(){const _0x1434a8=_0x671215;this['imap']['search']([_0x1434a8('0x2c')],this[_0x1434a8('0x2')][_0x1434a8('0xa')](this));},EmailImap['prototype'][_0x671215('0x2')]=function(_0x50c896,_0x25393f){const _0x1abbe3=_0x671215;if(_0x50c896)this[_0x1abbe3('0x20')](_0x50c896,!![]);else{if(_0x25393f[_0x1abbe3('0x2d')])try{const _0x41d555=this[_0x1abbe3('0x7')][_0x1abbe3('0x21')](_0x25393f,{'bodies':'','markSeen':!![]});_0x41d555['on'](_0x1abbe3('0x18'),this['handleFetchMessage'][_0x1abbe3('0xa')](this)),_0x41d555['once']('error',this[_0x1abbe3('0x11')]['bind'](this)),_0x41d555[_0x1abbe3('0x1b')]('end',this[_0x1abbe3('0x27')][_0x1abbe3('0xa')](this));}catch(_0x419676){logger[_0x1abbe3('0x1f')](_0x419676);}else this[_0x1abbe3('0x7')][_0x1abbe3('0x1d')](!![],this[_0x1abbe3('0x23')][_0x1abbe3('0xa')](this));}},EmailImap[_0x671215('0x15')][_0x671215('0xf')]=function(_0x85fcdd){const _0x41d55b=_0x671215;_0x85fcdd['on'](_0x41d55b('0x14'),this[_0x41d55b('0x32')][_0x41d55b('0xa')](this)),_0x85fcdd[_0x41d55b('0x1b')](_0x41d55b('0x33'),this['handleMessageAttributes'][_0x41d55b('0xa')](this)),_0x85fcdd['once'](_0x41d55b('0x2f'),this[_0x41d55b('0x9')][_0x41d55b('0xa')](this));},EmailImap[_0x671215('0x15')][_0x671215('0x32')]=function(_0x3697f9){const _0x3ac40b=_0x671215;simpleParser(_0x3697f9,{'Iconv':Iconv},this[_0x3ac40b('0x2e')]['bind'](this));},EmailImap[_0x671215('0x15')][_0x671215('0x19')]=function(){},EmailImap['prototype'][_0x671215('0x9')]=function(){},EmailImap[_0x671215('0x15')][_0x671215('0x2e')]=function(_0x512c92,_0x32309d){const _0x4025c2=_0x671215;if(_0x512c92)logger[_0x4025c2('0x1f')](_0x512c92);else{const _0x4c22e4=this;utils['parser'](this[_0x4025c2('0x29')],_0x32309d,function(_0x37170e){const _0x136e2c=_0x4025c2;_0x4c22e4[_0x136e2c('0x30')](_0x136e2c('0x1e'),_0x37170e);});}},EmailImap[_0x671215('0x15')][_0x671215('0x27')]=function(){const _0xc125b1=_0x671215;this[_0xc125b1('0x7')][_0xc125b1('0x1d')](!![],this[_0xc125b1('0x23')][_0xc125b1('0xa')](this));},EmailImap[_0x671215('0x15')][_0x671215('0x11')]=function(_0x5020d2){const _0x2a4c5b=_0x671215;this[_0x2a4c5b('0x20')](_0x5020d2),this['imap'][_0x2a4c5b('0x1d')](!![],this[_0x2a4c5b('0x23')][_0x2a4c5b('0xa')](this));},EmailImap[_0x671215('0x15')][_0x671215('0x4')]=function(){const _0x20758d=_0x671215;this[_0x20758d('0x30')]('end');},EmailImap[_0x671215('0x15')][_0x671215('0x20')]=function(_0x2bb74e,_0xcc1257){const _0x1153d8=_0x671215;logger['error']('handleError',this[_0x1153d8('0x29')][_0x1153d8('0x1e')],JSON[_0x1153d8('0xd')](_0x2bb74e));let _0x433d4d='';if(_0x2bb74e){if(_0x2bb74e['textCode'])_0x433d4d=_0x2bb74e[_0x1153d8('0x12')];else for(const _0x26d25f in _0x2bb74e){typeof _0x2bb74e[_0x26d25f]!=='undefined'&&(_0x433d4d+=_['upperFirst'](_0x26d25f)+':\x20'+_0x2bb74e[_0x26d25f]+'\x0a');}}_0xcc1257?this[_0x1153d8('0x7')][_0x1153d8('0x2f')]():(this[_0x1153d8('0x30')](_0x1153d8('0x1f'),_0x433d4d),this[_0x1153d8('0x30')](_0x1153d8('0x2f')));},module['exports']=EmailImap;
\ No newline at end of file