Built motion from commit (unavailable).|2.5.27
[motion2.git] / server / services / email / lib / imap.js
index aa4ca98..a455a15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08cc=['handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','closeBox','handleMessageBody','attributes'];(function(_0x2238be,_0x2a33a9){var _0x245b96=function(_0x51e3ec){while(--_0x51e3ec){_0x2238be['push'](_0x2238be['shift']());}};_0x245b96(++_0x2a33a9);}(_0x08cc,0xb9));var _0xc08c=function(_0x152826,_0x5d01db){_0x152826=_0x152826-0x0;var _0x51cc1c=_0x08cc[_0x152826];return _0x51cc1c;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xc08c('0x0'));var Imap=require(_0xc08c('0x1'));var _=require(_0xc08c('0x2'));var rs=require('randomstring');var simpleParser=require(_0xc08c('0x3'))['simpleParser'];var Iconv=require(_0xc08c('0x4'))['Iconv'];var EventEmitter=require(_0xc08c('0x5'))[_0xc08c('0x6')];var utils=require(_0xc08c('0x7'));var logger=require(_0xc08c('0x8'))(_0xc08c('0x9'));function EmailImap(_0x4fba18,_0x593c91){this[_0xc08c('0xa')]=_0xc08c('0xb');this[_0xc08c('0xc')]=this[_0xc08c('0xd')](_0x4fba18,_0x593c91);this[_0xc08c('0x1')]=new Imap(this['account']);this[_0xc08c('0x1')]['once'](_0xc08c('0xe'),this[_0xc08c('0xf')][_0xc08c('0x10')](this));this[_0xc08c('0x1')][_0xc08c('0x11')](_0xc08c('0x12'),this[_0xc08c('0x13')]['bind'](this));this[_0xc08c('0x1')]['on'](_0xc08c('0x14'),this[_0xc08c('0x15')][_0xc08c('0x10')](this));this[_0xc08c('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc08c('0x16')]['getAccount']=function(_0x47cc21,_0x4dd521){var _0x54c5d5={'connTimeout':_0x47cc21[_0xc08c('0x17')]?_0x47cc21[_0xc08c('0x17')]*0x3e8:0x2710,'authTimeout':_0x47cc21['authTimeout']?_0x47cc21[_0xc08c('0x18')]*0x3e8:0x1388};if(_[_0xc08c('0x19')](_0x47cc21[_0xc08c('0x1a')])){if(_0x47cc21[_0xc08c('0x1b')]){_0x54c5d5['user']=_0x47cc21[_0xc08c('0x1c')];_0x54c5d5[_0xc08c('0x1d')]=_0x47cc21[_0xc08c('0x1d')];}_0x54c5d5[_0xc08c('0x1e')]=_0x47cc21[_0xc08c('0x1e')];_0x54c5d5[_0xc08c('0x1f')]=_0x47cc21[_0xc08c('0x1f')]||0x3e1;if(_0x47cc21[_0xc08c('0x20')]){_0x54c5d5[_0xc08c('0x20')]=!![];}else{_0x54c5d5[_0xc08c('0x20')]=![];_0x54c5d5[_0xc08c('0x21')]='required';}}else{_0x54c5d5[_0xc08c('0x1c')]=_0x47cc21[_0xc08c('0x1c')];_0x54c5d5[_0xc08c('0x1d')]=_0x47cc21[_0xc08c('0x1d')];_0x54c5d5[_0xc08c('0x1e')]=utils[_0xc08c('0x22')](_0x47cc21[_0xc08c('0x1a')]);_0x54c5d5[_0xc08c('0x1f')]=0x3e1;_0x54c5d5[_0xc08c('0x20')]=!![];}_0x54c5d5[_0xc08c('0x9')]=_0x4dd521||_0x47cc21['user']||'anonymous@xcally.com';return _0x54c5d5;};EmailImap[_0xc08c('0x16')][_0xc08c('0xf')]=function(){this['imap'][_0xc08c('0x23')](this[_0xc08c('0xa')],![],this[_0xc08c('0x24')]['bind'](this));};EmailImap[_0xc08c('0x16')][_0xc08c('0x24')]=function(_0x1052c9,_0x1568eb){if(_0x1052c9){this[_0xc08c('0x15')](_0x1052c9,!![]);}else{this[_0xc08c('0x25')](_0xc08c('0x26'),_0x1568eb);this[_0xc08c('0x27')]();}};EmailImap[_0xc08c('0x16')][_0xc08c('0x28')]=function(_0x3e42d8){if(_0x3e42d8){this['handleError'](_0x3e42d8,!![]);}else{this['imap'][_0xc08c('0x12')]();}};EmailImap[_0xc08c('0x16')][_0xc08c('0x27')]=function(){this[_0xc08c('0x1')][_0xc08c('0x29')]([_0xc08c('0x2a')],this[_0xc08c('0x2b')][_0xc08c('0x10')](this));};EmailImap[_0xc08c('0x16')][_0xc08c('0x2b')]=function(_0x18ba64,_0x554cd6){if(_0x18ba64){this[_0xc08c('0x15')](_0x18ba64,!![]);}else{if(_0x554cd6[_0xc08c('0x2c')]){try{var _0x3e28b9=this[_0xc08c('0x1')]['fetch'](_0x554cd6,{'bodies':'','markSeen':!![]});_0x3e28b9['on'](_0xc08c('0x2d'),this[_0xc08c('0x2e')][_0xc08c('0x10')](this));_0x3e28b9[_0xc08c('0x11')](_0xc08c('0x14'),this[_0xc08c('0x2f')]['bind'](this));_0x3e28b9[_0xc08c('0x11')](_0xc08c('0x12'),this['handleFetchEnd'][_0xc08c('0x10')](this));}catch(_0x5a48f0){logger[_0xc08c('0x14')](_0x5a48f0);}}else{this['imap'][_0xc08c('0x30')](!![],this['handleCloseBox'][_0xc08c('0x10')](this));}}};EmailImap[_0xc08c('0x16')][_0xc08c('0x2e')]=function(_0x4e46a2,_0x4fc422){_0x4e46a2['on']('body',this[_0xc08c('0x31')][_0xc08c('0x10')](this));_0x4e46a2[_0xc08c('0x11')](_0xc08c('0x32'),this[_0xc08c('0x33')][_0xc08c('0x10')](this));_0x4e46a2[_0xc08c('0x11')](_0xc08c('0x12'),this['handleMessageEnd'][_0xc08c('0x10')](this));};EmailImap[_0xc08c('0x16')]['handleMessageBody']=function(_0x57b932,_0x4812e0){simpleParser(_0x57b932,{'Iconv':Iconv},this[_0xc08c('0x34')][_0xc08c('0x10')](this));};EmailImap[_0xc08c('0x16')]['handleMessageAttributes']=function(_0xd5a605){};EmailImap[_0xc08c('0x16')][_0xc08c('0x35')]=function(){};EmailImap[_0xc08c('0x16')][_0xc08c('0x34')]=function(_0x32b3a5,_0x4d4235){if(_0x32b3a5){logger['error'](_0x32b3a5);}else{var _0x386959=this;utils['parser'](this[_0xc08c('0xc')],_0x4d4235,function(_0x31db4b){_0x386959[_0xc08c('0x25')](_0xc08c('0x9'),_0x31db4b);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xc08c('0x1')][_0xc08c('0x30')](!![],this[_0xc08c('0x28')]['bind'](this));};EmailImap[_0xc08c('0x16')]['handleFetchError']=function(_0xc5ce29){this[_0xc08c('0x15')](_0xc5ce29);this[_0xc08c('0x1')][_0xc08c('0x30')](!![],this['handleCloseBox'][_0xc08c('0x10')](this));};EmailImap['prototype'][_0xc08c('0x13')]=function(){this[_0xc08c('0x25')]('end');};EmailImap['prototype'][_0xc08c('0x15')]=function(_0x3d7288,_0x54962a){logger[_0xc08c('0x14')](_0xc08c('0x15'),this[_0xc08c('0xc')][_0xc08c('0x9')],JSON[_0xc08c('0x36')](_0x3d7288));var _0x5dbbcf='';if(_0x3d7288){if(_0x3d7288[_0xc08c('0x37')]){_0x5dbbcf=_0x3d7288[_0xc08c('0x37')];}else{for(var _0x4f3668 in _0x3d7288){if(_0x3d7288[_0xc08c('0x38')](_0x4f3668)){_0x5dbbcf+=_[_0xc08c('0x39')](_0x4f3668)+':\x20'+_0x3d7288[_0x4f3668]+'\x0a';}}}}if(_0x54962a){this['imap'][_0xc08c('0x12')]();}else{this['emit']('error',_0x5dbbcf);this[_0xc08c('0x25')](_0xc08c('0x12'));}};module[_0xc08c('0x3a')]=EmailImap;
\ No newline at end of file
+var _0xfc3c=['parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','mailparser','simpleParser','Iconv','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','password','host','port','tls','autotls','required','anonymous@xcally.com','openBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser'];(function(_0x1cc4e1,_0x1629d4){var _0x192d47=function(_0x40dbe2){while(--_0x40dbe2){_0x1cc4e1['push'](_0x1cc4e1['shift']());}};_0x192d47(++_0x1629d4);}(_0xfc3c,0x1ab));var _0xcfc3=function(_0x506cbe,_0x818678){_0x506cbe=_0x506cbe-0x0;var _0x4fdaa7=_0xfc3c[_0x506cbe];return _0x4fdaa7;};'use strict';var fs=require('fs');var path=require(_0xcfc3('0x0'));var util=require(_0xcfc3('0x1'));var Imap=require(_0xcfc3('0x2'));var _=require('lodash');var rs=require(_0xcfc3('0x3'));var simpleParser=require(_0xcfc3('0x4'))[_0xcfc3('0x5')];var Iconv=require('iconv')[_0xcfc3('0x6')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xcfc3('0x7'));var logger=require(_0xcfc3('0x8'))(_0xcfc3('0x9'));function EmailImap(_0x1eaef2,_0x964ded){this[_0xcfc3('0xa')]=_0xcfc3('0xb');this[_0xcfc3('0xc')]=this[_0xcfc3('0xd')](_0x1eaef2,_0x964ded);this[_0xcfc3('0x2')]=new Imap(this[_0xcfc3('0xc')]);this[_0xcfc3('0x2')][_0xcfc3('0xe')](_0xcfc3('0xf'),this[_0xcfc3('0x10')][_0xcfc3('0x11')](this));this[_0xcfc3('0x2')][_0xcfc3('0xe')](_0xcfc3('0x12'),this[_0xcfc3('0x13')][_0xcfc3('0x11')](this));this[_0xcfc3('0x2')]['on'](_0xcfc3('0x14'),this[_0xcfc3('0x15')][_0xcfc3('0x11')](this));this['imap'][_0xcfc3('0x16')]();}util[_0xcfc3('0x17')](EmailImap,EventEmitter);EmailImap[_0xcfc3('0x18')][_0xcfc3('0xd')]=function(_0x45bbd3,_0x409733){var _0x5c7521={'connTimeout':_0x45bbd3['connTimeout']?_0x45bbd3[_0xcfc3('0x19')]*0x3e8:0x2710,'authTimeout':_0x45bbd3[_0xcfc3('0x1a')]?_0x45bbd3[_0xcfc3('0x1a')]*0x3e8:0x1388};if(_[_0xcfc3('0x1b')](_0x45bbd3[_0xcfc3('0x1c')])){if(_0x45bbd3['authentication']){_0x5c7521['user']=_0x45bbd3['user'];_0x5c7521[_0xcfc3('0x1d')]=_0x45bbd3[_0xcfc3('0x1d')];}_0x5c7521[_0xcfc3('0x1e')]=_0x45bbd3[_0xcfc3('0x1e')];_0x5c7521[_0xcfc3('0x1f')]=_0x45bbd3['port']||0x3e1;if(_0x45bbd3[_0xcfc3('0x20')]){_0x5c7521[_0xcfc3('0x20')]=!![];}else{_0x5c7521[_0xcfc3('0x20')]=![];_0x5c7521[_0xcfc3('0x21')]=_0xcfc3('0x22');}}else{_0x5c7521['user']=_0x45bbd3['user'];_0x5c7521[_0xcfc3('0x1d')]=_0x45bbd3[_0xcfc3('0x1d')];_0x5c7521[_0xcfc3('0x1e')]=utils['getHost'](_0x45bbd3[_0xcfc3('0x1c')]);_0x5c7521[_0xcfc3('0x1f')]=0x3e1;_0x5c7521['tls']=!![];}_0x5c7521[_0xcfc3('0x9')]=_0x409733||_0x45bbd3['user']||_0xcfc3('0x23');return _0x5c7521;};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x10')]=function(){this[_0xcfc3('0x2')][_0xcfc3('0x24')](this[_0xcfc3('0xa')],![],this['handleOpenBox'][_0xcfc3('0x11')](this));};EmailImap[_0xcfc3('0x18')]['handleOpenBox']=function(_0x40a9a,_0x116153){if(_0x40a9a){this['handleError'](_0x40a9a,!![]);}else{this[_0xcfc3('0x25')]('box',_0x116153);this[_0xcfc3('0x26')]();}};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x27')]=function(_0x3ce5dd){if(_0x3ce5dd){this[_0xcfc3('0x15')](_0x3ce5dd,!![]);}else{this[_0xcfc3('0x2')][_0xcfc3('0x12')]();}};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x26')]=function(){this[_0xcfc3('0x2')][_0xcfc3('0x28')](['UNSEEN'],this[_0xcfc3('0x29')]['bind'](this));};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x29')]=function(_0x4cbb6b,_0x24a75b){if(_0x4cbb6b){this[_0xcfc3('0x15')](_0x4cbb6b,!![]);}else{if(_0x24a75b[_0xcfc3('0x2a')]){try{var _0x54097e=this[_0xcfc3('0x2')][_0xcfc3('0x2b')](_0x24a75b,{'bodies':'','markSeen':!![]});_0x54097e['on'](_0xcfc3('0x2c'),this['handleFetchMessage'][_0xcfc3('0x11')](this));_0x54097e[_0xcfc3('0xe')](_0xcfc3('0x14'),this['handleFetchError'][_0xcfc3('0x11')](this));_0x54097e[_0xcfc3('0xe')]('end',this[_0xcfc3('0x2d')]['bind'](this));}catch(_0x9fa9e8){logger[_0xcfc3('0x14')](_0x9fa9e8);}}else{this[_0xcfc3('0x2')][_0xcfc3('0x2e')](!![],this['handleCloseBox'][_0xcfc3('0x11')](this));}}};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x2f')]=function(_0x2333a4,_0x443246){_0x2333a4['on'](_0xcfc3('0x30'),this[_0xcfc3('0x31')]['bind'](this));_0x2333a4[_0xcfc3('0xe')](_0xcfc3('0x32'),this[_0xcfc3('0x33')][_0xcfc3('0x11')](this));_0x2333a4[_0xcfc3('0xe')](_0xcfc3('0x12'),this['handleMessageEnd']['bind'](this));};EmailImap['prototype'][_0xcfc3('0x31')]=function(_0x5e71c4,_0x326591){simpleParser(_0x5e71c4,{'Iconv':Iconv},this[_0xcfc3('0x34')][_0xcfc3('0x11')](this));};EmailImap['prototype'][_0xcfc3('0x33')]=function(_0x5c528c){};EmailImap[_0xcfc3('0x18')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0xcfc3('0x34')]=function(_0xfee731,_0x4056a0){if(_0xfee731){logger['error'](_0xfee731);}else{var _0x1243ec=this;utils[_0xcfc3('0x35')](this[_0xcfc3('0xc')],_0x4056a0,function(_0x181126){_0x1243ec[_0xcfc3('0x25')](_0xcfc3('0x9'),_0x181126);});}};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x2d')]=function(){this[_0xcfc3('0x2')]['closeBox'](!![],this[_0xcfc3('0x27')][_0xcfc3('0x11')](this));};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x36')]=function(_0x2b58d0){this[_0xcfc3('0x15')](_0x2b58d0);this[_0xcfc3('0x2')]['closeBox'](!![],this[_0xcfc3('0x27')][_0xcfc3('0x11')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0xcfc3('0x12'));};EmailImap[_0xcfc3('0x18')][_0xcfc3('0x15')]=function(_0x3bb509,_0xe9f0ec){logger[_0xcfc3('0x14')]('handleError',this[_0xcfc3('0xc')][_0xcfc3('0x9')],JSON[_0xcfc3('0x37')](_0x3bb509));var _0x400ada='';if(_0x3bb509){if(_0x3bb509['textCode']){_0x400ada=_0x3bb509[_0xcfc3('0x38')];}else{for(var _0xec4fac in _0x3bb509){if(_0x3bb509[_0xcfc3('0x39')](_0xec4fac)){_0x400ada+=_[_0xcfc3('0x3a')](_0xec4fac)+':\x20'+_0x3bb509[_0xec4fac]+'\x0a';}}}}if(_0xe9f0ec){this[_0xcfc3('0x2')][_0xcfc3('0x12')]();}else{this[_0xcfc3('0x25')](_0xcfc3('0x14'),_0x400ada);this['emit'](_0xcfc3('0x12'));}};module[_0xcfc3('0x3b')]=EmailImap;
\ No newline at end of file