Built motion from commit (unavailable).|2.0.84
[motion2.git] / server / services / email / lib / imap.js
index 8445c12..36a7dc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa629=['autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','message','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','mailparser','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls'];(function(_0x100471,_0x224c66){var _0x3ac4cb=function(_0x14e31e){while(--_0x14e31e){_0x100471['push'](_0x100471['shift']());}};_0x3ac4cb(++_0x224c66);}(_0xa629,0x158));var _0x9a62=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa629[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0x9a62('0x0'));var util=require(_0x9a62('0x1'));var Imap=require('imap');var _=require(_0x9a62('0x2'));var rs=require(_0x9a62('0x3'));var simpleParser=require(_0x9a62('0x4'))['simpleParser'];var EventEmitter=require(_0x9a62('0x5'))[_0x9a62('0x6')];var utils=require(_0x9a62('0x7'));var logger=require(_0x9a62('0x8'))(_0x9a62('0x9'));function EmailImap(_0x65ba1a,_0x153b66){this[_0x9a62('0xa')]=_0x9a62('0xb');this[_0x9a62('0xc')]=this[_0x9a62('0xd')](_0x65ba1a,_0x153b66);this[_0x9a62('0xe')]=new Imap(this['account']);this[_0x9a62('0xe')][_0x9a62('0xf')](_0x9a62('0x10'),this['handleReady'][_0x9a62('0x11')](this));this[_0x9a62('0xe')]['once'](_0x9a62('0x12'),this[_0x9a62('0x13')][_0x9a62('0x11')](this));this[_0x9a62('0xe')]['on'](_0x9a62('0x14'),this[_0x9a62('0x15')]['bind'](this));this[_0x9a62('0xe')][_0x9a62('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x9a62('0x17')][_0x9a62('0xd')]=function(_0x5c2c18,_0x595794){var _0x26f096={'connTimeout':_0x5c2c18['connTimeout']?_0x5c2c18[_0x9a62('0x18')]*0x3e8:0x2710,'authTimeout':_0x5c2c18['authTimeout']?_0x5c2c18[_0x9a62('0x19')]*0x3e8:0x1388};if(_[_0x9a62('0x1a')](_0x5c2c18[_0x9a62('0x1b')])){if(_0x5c2c18[_0x9a62('0x1c')]){_0x26f096[_0x9a62('0x1d')]=_0x5c2c18[_0x9a62('0x1d')];_0x26f096['password']=_0x5c2c18[_0x9a62('0x1e')];}_0x26f096[_0x9a62('0x1f')]=_0x5c2c18[_0x9a62('0x1f')];_0x26f096[_0x9a62('0x20')]=_0x5c2c18[_0x9a62('0x20')]||0x3e1;if(_0x5c2c18[_0x9a62('0x21')]){_0x26f096[_0x9a62('0x21')]=!![];}else{_0x26f096[_0x9a62('0x21')]=![];_0x26f096[_0x9a62('0x22')]=_0x9a62('0x23');}}else{_0x26f096['user']=_0x5c2c18[_0x9a62('0x1d')];_0x26f096[_0x9a62('0x1e')]=_0x5c2c18[_0x9a62('0x1e')];_0x26f096[_0x9a62('0x1f')]=utils[_0x9a62('0x24')](_0x5c2c18[_0x9a62('0x1b')]);_0x26f096[_0x9a62('0x20')]=0x3e1;_0x26f096['tls']=!![];}_0x26f096[_0x9a62('0x9')]=_0x595794||_0x5c2c18[_0x9a62('0x1d')]||_0x9a62('0x25');return _0x26f096;};EmailImap[_0x9a62('0x17')]['handleReady']=function(){this[_0x9a62('0xe')][_0x9a62('0x26')](this[_0x9a62('0xa')],![],this[_0x9a62('0x27')][_0x9a62('0x11')](this));};EmailImap[_0x9a62('0x17')][_0x9a62('0x27')]=function(_0x1d0b2d,_0x690d7c){if(_0x1d0b2d){this['handleError'](_0x1d0b2d,!![]);}else{this[_0x9a62('0x28')](_0x9a62('0x29'),_0x690d7c);this[_0x9a62('0x2a')]();}};EmailImap[_0x9a62('0x17')][_0x9a62('0x2b')]=function(_0x555217){if(_0x555217){this[_0x9a62('0x15')](_0x555217,!![]);}else{this['imap'][_0x9a62('0x12')]();}};EmailImap['prototype'][_0x9a62('0x2a')]=function(){this[_0x9a62('0xe')][_0x9a62('0x2c')](['UNSEEN'],this[_0x9a62('0x2d')]['bind'](this));};EmailImap[_0x9a62('0x17')][_0x9a62('0x2d')]=function(_0x2c118b,_0x24b738){if(_0x2c118b){this[_0x9a62('0x15')](_0x2c118b,!![]);}else{if(_0x24b738[_0x9a62('0x2e')]){try{var _0xc7db42=this['imap']['fetch'](_0x24b738,{'bodies':'','markSeen':!![]});_0xc7db42['on'](_0x9a62('0x2f'),this['handleFetchMessage'][_0x9a62('0x11')](this));_0xc7db42[_0x9a62('0xf')]('error',this[_0x9a62('0x30')]['bind'](this));_0xc7db42['once'](_0x9a62('0x12'),this[_0x9a62('0x31')][_0x9a62('0x11')](this));}catch(_0x4c2e11){logger[_0x9a62('0x14')](_0x4c2e11);}}else{this[_0x9a62('0xe')][_0x9a62('0x32')](!![],this['handleCloseBox'][_0x9a62('0x11')](this));}}};EmailImap[_0x9a62('0x17')]['handleFetchMessage']=function(_0x23baf2,_0x4fc273){_0x23baf2['on'](_0x9a62('0x33'),this[_0x9a62('0x34')][_0x9a62('0x11')](this));_0x23baf2[_0x9a62('0xf')](_0x9a62('0x35'),this[_0x9a62('0x36')]['bind'](this));_0x23baf2[_0x9a62('0xf')](_0x9a62('0x12'),this[_0x9a62('0x37')][_0x9a62('0x11')](this));};EmailImap['prototype'][_0x9a62('0x34')]=function(_0x553cc1,_0x1c405d){simpleParser(_0x553cc1,this['handleSimpleParser'][_0x9a62('0x11')](this));};EmailImap[_0x9a62('0x17')][_0x9a62('0x36')]=function(_0x98d6aa){};EmailImap[_0x9a62('0x17')][_0x9a62('0x37')]=function(){};EmailImap['prototype'][_0x9a62('0x38')]=function(_0x51c038,_0x48963b){if(_0x51c038){logger[_0x9a62('0x14')](_0x51c038);}else{var _0xb5634a=this;utils[_0x9a62('0x39')](this[_0x9a62('0xc')],_0x48963b,function(_0x331d98){_0xb5634a[_0x9a62('0x28')]('email',_0x331d98);});}};EmailImap[_0x9a62('0x17')]['handleFetchEnd']=function(){this[_0x9a62('0xe')][_0x9a62('0x32')](!![],this[_0x9a62('0x2b')][_0x9a62('0x11')](this));};EmailImap[_0x9a62('0x17')][_0x9a62('0x30')]=function(_0x3619ad){this[_0x9a62('0x15')](_0x3619ad);this[_0x9a62('0xe')]['closeBox'](!![],this[_0x9a62('0x2b')][_0x9a62('0x11')](this));};EmailImap[_0x9a62('0x17')]['handleEnd']=function(){this[_0x9a62('0x28')](_0x9a62('0x12'));};EmailImap['prototype'][_0x9a62('0x15')]=function(_0x1f2ec6,_0x3ef69c){logger[_0x9a62('0x14')](_0x9a62('0x15'),this[_0x9a62('0xc')][_0x9a62('0x9')],JSON[_0x9a62('0x3a')](_0x1f2ec6));var _0x2eda8a='';if(_0x1f2ec6){if(_0x1f2ec6[_0x9a62('0x3b')]){_0x2eda8a=_0x1f2ec6[_0x9a62('0x3b')];}else{for(var _0xd29e61 in _0x1f2ec6){if(_0x1f2ec6[_0x9a62('0x3c')](_0xd29e61)){_0x2eda8a+=_[_0x9a62('0x3d')](_0xd29e61)+':\x20'+_0x1f2ec6[_0xd29e61]+'\x0a';}}}}if(_0x3ef69c){this[_0x9a62('0xe')][_0x9a62('0x12')]();}else{this[_0x9a62('0x28')](_0x9a62('0x14'),_0x2eda8a);this[_0x9a62('0x28')](_0x9a62('0x12'));}};module[_0x9a62('0x3e')]=EmailImap;
\ No newline at end of file
+var _0xbf70=['handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','exports','path','util','imap','randomstring','mailparser','events','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body'];(function(_0x159704,_0x36bba4){var _0x68693f=function(_0x3c23bf){while(--_0x3c23bf){_0x159704['push'](_0x159704['shift']());}};_0x68693f(++_0x36bba4);}(_0xbf70,0x102));var _0x0bf7=function(_0x353672,_0x1cf6f4){_0x353672=_0x353672-0x0;var _0x311452=_0xbf70[_0x353672];return _0x311452;};'use strict';var fs=require('fs');var path=require(_0x0bf7('0x0'));var util=require(_0x0bf7('0x1'));var Imap=require(_0x0bf7('0x2'));var _=require('lodash');var rs=require(_0x0bf7('0x3'));var simpleParser=require(_0x0bf7('0x4'))['simpleParser'];var EventEmitter=require(_0x0bf7('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x0bf7('0x6'))(_0x0bf7('0x7'));function EmailImap(_0x1606e2,_0x5319fc){this[_0x0bf7('0x8')]=_0x0bf7('0x9');this['account']=this[_0x0bf7('0xa')](_0x1606e2,_0x5319fc);this[_0x0bf7('0x2')]=new Imap(this[_0x0bf7('0xb')]);this[_0x0bf7('0x2')][_0x0bf7('0xc')](_0x0bf7('0xd'),this[_0x0bf7('0xe')][_0x0bf7('0xf')](this));this[_0x0bf7('0x2')][_0x0bf7('0xc')]('end',this[_0x0bf7('0x10')][_0x0bf7('0xf')](this));this[_0x0bf7('0x2')]['on'](_0x0bf7('0x11'),this[_0x0bf7('0x12')][_0x0bf7('0xf')](this));this[_0x0bf7('0x2')][_0x0bf7('0x13')]();}util[_0x0bf7('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x37ccc2,_0x2d4cdc){var _0x43b854={'connTimeout':_0x37ccc2[_0x0bf7('0x15')]?_0x37ccc2[_0x0bf7('0x15')]*0x3e8:0x2710,'authTimeout':_0x37ccc2['authTimeout']?_0x37ccc2['authTimeout']*0x3e8:0x1388};if(_[_0x0bf7('0x16')](_0x37ccc2[_0x0bf7('0x17')])){if(_0x37ccc2[_0x0bf7('0x18')]){_0x43b854[_0x0bf7('0x19')]=_0x37ccc2[_0x0bf7('0x19')];_0x43b854[_0x0bf7('0x1a')]=_0x37ccc2['password'];}_0x43b854['host']=_0x37ccc2[_0x0bf7('0x1b')];_0x43b854['port']=_0x37ccc2[_0x0bf7('0x1c')]||0x3e1;if(_0x37ccc2[_0x0bf7('0x1d')]){_0x43b854['tls']=!![];}else{_0x43b854[_0x0bf7('0x1d')]=![];_0x43b854[_0x0bf7('0x1e')]=_0x0bf7('0x1f');}}else{_0x43b854[_0x0bf7('0x19')]=_0x37ccc2[_0x0bf7('0x19')];_0x43b854['password']=_0x37ccc2['password'];_0x43b854['host']=utils[_0x0bf7('0x20')](_0x37ccc2[_0x0bf7('0x17')]);_0x43b854[_0x0bf7('0x1c')]=0x3e1;_0x43b854[_0x0bf7('0x1d')]=!![];}_0x43b854[_0x0bf7('0x7')]=_0x2d4cdc||_0x37ccc2[_0x0bf7('0x19')]||_0x0bf7('0x21');return _0x43b854;};EmailImap[_0x0bf7('0x22')][_0x0bf7('0xe')]=function(){this[_0x0bf7('0x2')][_0x0bf7('0x23')](this[_0x0bf7('0x8')],![],this[_0x0bf7('0x24')][_0x0bf7('0xf')](this));};EmailImap[_0x0bf7('0x22')]['handleOpenBox']=function(_0x495be9,_0x1a7f60){if(_0x495be9){this['handleError'](_0x495be9,!![]);}else{this[_0x0bf7('0x25')](_0x0bf7('0x26'),_0x1a7f60);this['readUnseen']();}};EmailImap[_0x0bf7('0x22')][_0x0bf7('0x27')]=function(_0x2796d3){if(_0x2796d3){this[_0x0bf7('0x12')](_0x2796d3,!![]);}else{this[_0x0bf7('0x2')][_0x0bf7('0x28')]();}};EmailImap[_0x0bf7('0x22')]['readUnseen']=function(){this[_0x0bf7('0x2')][_0x0bf7('0x29')]([_0x0bf7('0x2a')],this[_0x0bf7('0x2b')][_0x0bf7('0xf')](this));};EmailImap[_0x0bf7('0x22')][_0x0bf7('0x2b')]=function(_0x5e6fb9,_0x2b5f11){if(_0x5e6fb9){this[_0x0bf7('0x12')](_0x5e6fb9,!![]);}else{if(_0x2b5f11[_0x0bf7('0x2c')]){try{var _0x5bfddc=this[_0x0bf7('0x2')][_0x0bf7('0x2d')](_0x2b5f11,{'bodies':'','markSeen':!![]});_0x5bfddc['on'](_0x0bf7('0x2e'),this[_0x0bf7('0x2f')][_0x0bf7('0xf')](this));_0x5bfddc[_0x0bf7('0xc')](_0x0bf7('0x11'),this[_0x0bf7('0x30')][_0x0bf7('0xf')](this));_0x5bfddc['once']('end',this[_0x0bf7('0x31')]['bind'](this));}catch(_0x207317){logger[_0x0bf7('0x11')](_0x207317);}}else{this['imap'][_0x0bf7('0x32')](!![],this[_0x0bf7('0x27')][_0x0bf7('0xf')](this));}}};EmailImap['prototype'][_0x0bf7('0x2f')]=function(_0x202a70,_0x5aae8b){_0x202a70['on'](_0x0bf7('0x33'),this[_0x0bf7('0x34')][_0x0bf7('0xf')](this));_0x202a70['once'](_0x0bf7('0x35'),this['handleMessageAttributes'][_0x0bf7('0xf')](this));_0x202a70[_0x0bf7('0xc')](_0x0bf7('0x28'),this[_0x0bf7('0x36')][_0x0bf7('0xf')](this));};EmailImap[_0x0bf7('0x22')][_0x0bf7('0x34')]=function(_0x5b6cf0,_0x14fd70){simpleParser(_0x5b6cf0,this[_0x0bf7('0x37')]['bind'](this));};EmailImap['prototype'][_0x0bf7('0x38')]=function(_0x20fea6){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap['prototype'][_0x0bf7('0x37')]=function(_0x4e6713,_0x13e1c5){if(_0x4e6713){logger['error'](_0x4e6713);}else{var _0x32276c=this;utils[_0x0bf7('0x39')](this[_0x0bf7('0xb')],_0x13e1c5,function(_0x4cde86){_0x32276c[_0x0bf7('0x25')](_0x0bf7('0x7'),_0x4cde86);});}};EmailImap['prototype'][_0x0bf7('0x31')]=function(){this[_0x0bf7('0x2')][_0x0bf7('0x32')](!![],this[_0x0bf7('0x27')][_0x0bf7('0xf')](this));};EmailImap[_0x0bf7('0x22')][_0x0bf7('0x30')]=function(_0x2836ed){this['handleError'](_0x2836ed);this[_0x0bf7('0x2')][_0x0bf7('0x32')](!![],this[_0x0bf7('0x27')]['bind'](this));};EmailImap[_0x0bf7('0x22')]['handleEnd']=function(){this[_0x0bf7('0x25')](_0x0bf7('0x28'));};EmailImap[_0x0bf7('0x22')][_0x0bf7('0x12')]=function(_0x1bf4af,_0x50d924){logger[_0x0bf7('0x11')](_0x0bf7('0x12'),this['account'][_0x0bf7('0x7')],JSON[_0x0bf7('0x3a')](_0x1bf4af));var _0x1fb01c='';if(_0x1bf4af){if(_0x1bf4af[_0x0bf7('0x3b')]){_0x1fb01c=_0x1bf4af[_0x0bf7('0x3b')];}else{for(var _0x5c3d54 in _0x1bf4af){if(_0x1bf4af[_0x0bf7('0x3c')](_0x5c3d54)){_0x1fb01c+=_['upperFirst'](_0x5c3d54)+':\x20'+_0x1bf4af[_0x5c3d54]+'\x0a';}}}}if(_0x50d924){this[_0x0bf7('0x2')][_0x0bf7('0x28')]();}else{this['emit'](_0x0bf7('0x11'),_0x1fb01c);this['emit'](_0x0bf7('0x28'));}};module[_0x0bf7('0x3d')]=EmailImap;
\ No newline at end of file