Built motion from commit 2e74e5e.|0.0.138
[motion.git] / server / config / imap / imap.js
index 30b6e9c..d897da4 100644 (file)
@@ -1 +1 @@
-var _0x830f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x61\x69\x6C\x2D\x6C\x69\x73\x74\x65\x6E\x65\x72\x32","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x43\x6F\x6E\x74\x61\x63\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x49\x6D\x61\x70\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x69\x6D\x61\x70","\x69\x6E\x69\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x6F\x6E\x53\x61\x76\x65","\x69\x64","\x6D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E\x49\x64","\x6F\x6E\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x6F\x6E\x52\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x73\x74\x6F\x70","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x6D\x61\x69\x6C\x62\x6F\x78","\x66\x69\x6C\x74\x65\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x2F","\x6A\x6F\x69\x6E","\x63\x6F\x6E\x6E\x54\x69\x6D\x65\x6F\x75\x74","\x61\x75\x74\x68\x54\x69\x6D\x65\x6F\x75\x74","\x6B\x65\x65\x70\x61\x6C\x69\x76\x65","\x73\x74\x61\x72\x74","\x73\x65\x72\x76\x65\x72\x3A\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x4D\x41\x49\x4C\x20\x2D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20","\x20\x49\x4D\x41\x50\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x75\x70\x64\x61\x74\x65","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x42\x79\x49\x64","\x6F\x6E","\x73\x65\x72\x76\x65\x72\x3A\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x20\x49\x4D\x41\x50\x20\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x20\x49\x4D\x41\x50\x20\x45\x52\x52\x4F\x52","\x45\x52\x52\x4F\x52","\x73\x6F\x75\x72\x63\x65","\x6D\x61\x69\x6C","\x69\x6E\x52\x65\x70\x6C\x79\x54\x6F","\x6D\x73\x67","\x6D\x65\x73\x73\x61\x67\x65\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x73\x75\x62\x6A\x65\x63\x74","\x66\x72\x6F\x6D","\x61\x64\x64\x72\x65\x73\x73","\x6D\x61\x70","\x74\x6F","\x63\x63","\x62\x63\x63","\x68\x74\x6D\x6C","\x74\x65\x78\x74","\x63\x72\x65\x61\x74\x65","\x67\x65\x74\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x66\x69\x6E\x64\x4F\x6E\x65","\x3B","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x20\x49\x4D\x41\x50\x20\x55\x50\x44\x41\x54\x45\x44","\x20\x49\x4D\x41\x50\x20\x44\x45\x53\x54\x52\x4F\x59","\x65\x78\x70\x6F\x72\x74\x73"];_0x830f[0];var _=require(_0x830f[1]);var path=require(_0x830f[2]);var config=require(_0x830f[3]);var ImapListener=require(_0x830f[4]);var MailServerIn=require(_0x830f[6])[_0x830f[5]];var MailMessage=require(_0x830f[6])[_0x830f[7]];var MailAttachment=require(_0x830f[6])[_0x830f[8]];var MailRoom=require(_0x830f[6])[_0x830f[9]];var Contact=require(_0x830f[6])[_0x830f[10]];var sequelize=require(_0x830f[6])[_0x830f[11]];function Imap(){console[_0x830f[13]](_0x830f[12]);this[_0x830f[14]]=null}Imap[_0x830f[16]][_0x830f[15]]=function(_0xf61cxc){var _0xf61cxd=this;_0xf61cxd[_0x830f[17]](_0xf61cxc);MailServerIn[_0x830f[21]](function(_0xf61cxc){if(_0xf61cxd[_0x830f[14]]&&_0xf61cxc[_0x830f[18]]===_0xf61cxd[_0x830f[14]][_0x830f[19]]){_0xf61cxd[_0x830f[20]](_0xf61cxc)}});MailServerIn[_0x830f[23]](function(_0xf61cxc){if(_0xf61cxd[_0x830f[14]]&&_0xf61cxc[_0x830f[18]]===_0xf61cxd[_0x830f[14]][_0x830f[19]]){_0xf61cxd[_0x830f[22]](_0xf61cxc)}})};Imap[_0x830f[16]][_0x830f[17]]=function(_0xf61cxc){if(this[_0x830f[14]]){this[_0x830f[14]][_0x830f[24]]();this[_0x830f[14]]=null};this[_0x830f[14]]= new ImapListener({username:_0xf61cxc[_0x830f[25]],password:_0xf61cxc[_0x830f[26]],host:_0xf61cxc[_0x830f[27]],port:_0xf61cxc[_0x830f[28]],tls:_0xf61cxc[_0x830f[29]],tlsOptions:{rejectUnauthorized:false},mailbox:_0xf61cxc[_0x830f[30]],searchFilter:[_0xf61cxc[_0x830f[31]]],markSeen:true,fetchUnreadOnStart:true,mailParserOptions:{streamAttachments:false},attachments:true,attachmentOptions:{directory:path[_0x830f[37]](config[_0x830f[32]],_0x830f[33],_0x830f[34],_0x830f[35],_0x830f[36])},connTimeout:_0xf61cxc[_0x830f[38]],authTimeout:_0xf61cxc[_0x830f[39]],keepalive:_0xf61cxc[_0x830f[40]]});this[_0x830f[14]][_0x830f[41]]();this[_0x830f[14]][_0x830f[51]](_0x830f[42],function(){console[_0x830f[13]](_0x830f[43]+_0xf61cxc[_0x830f[25]]+_0x830f[44]);return MailServerIn[_0x830f[50]](_0xf61cxc[_0x830f[18]])[_0x830f[49]](function(_0xf61cxf){return _0xf61cxf[_0x830f[48]]({state:_0x830f[47]})})[_0x830f[46]](function(_0xf61cxe){console[_0x830f[45]](_0xf61cxe)})});this[_0x830f[14]][_0x830f[51]](_0x830f[52],function(){console[_0x830f[13]](_0x830f[43]+_0xf61cxc[_0x830f[53]]+_0x830f[54]);return MailServerIn[_0x830f[50]](_0xf61cxc[_0x830f[18]])[_0x830f[49]](function(_0xf61cxf){if(_0xf61cxf){return _0xf61cxf[_0x830f[48]]({state:_0x830f[55]})}})[_0x830f[46]](function(_0xf61cxe){console[_0x830f[45]](_0xf61cxe)})});this[_0x830f[14]][_0x830f[51]](_0x830f[45],function(_0xf61cxe){console[_0x830f[13]](_0x830f[43]+_0xf61cxc[_0x830f[53]]+_0x830f[56],_0xf61cxe);return MailServerIn[_0x830f[50]](_0xf61cxc[_0x830f[18]])[_0x830f[49]](function(_0xf61cxf){if(_0xf61cxf){return _0xf61cxf[_0x830f[48]]({state:_0x830f[57],source:_0xf61cxe[_0x830f[58]]})}})[_0x830f[46]](function(_0xf61cxe){console[_0x830f[45]](_0xf61cxe)})});this[_0x830f[14]][_0x830f[51]](_0x830f[59],function(_0xf61cx10,_0xf61cx11,_0xf61cx12){var _0xf61cx13;var _0xf61cx14;var _0xf61cx15,_0xf61cx16,_0xf61cx17,_0xf61cx18;return sequelize[_0x830f[77]](function(_0xf61cx19){if(_0xf61cx10[_0x830f[60]]){return MailMessage[_0x830f[75]]({where:{messageId:_0xf61cx10[_0x830f[60]][0]},include:[{all:true}]})[_0x830f[49]](function(_0xf61cx1b){return _0xf61cx1b[_0x830f[74]]()})[_0x830f[49]](function(_0xf61cx1a){_0xf61cx13=_0xf61cx1a;console[_0x830f[13]](_0x830f[61],_0xf61cx10);return MailMessage[_0x830f[73]]({messageId:_0xf61cx10[_0x830f[62]],status:_0x830f[63],subject:_0xf61cx10[_0x830f[64]],from:_[_0x830f[67]](_0xf61cx10[_0x830f[65]],_0x830f[66]),to:_0xf61cx10[_0x830f[68]]?_[_0x830f[67]](_0xf61cx10[_0x830f[68]],_0x830f[66]):[],cc:_0xf61cx10[_0x830f[69]]?_[_0x830f[67]](_0xf61cx10[_0x830f[69]],_0x830f[66]):[],bcc:_0xf61cx10[_0x830f[70]]?_[_0x830f[67]](_0xf61cx10[_0x830f[70]],_0x830f[66]):[],html:_0xf61cx10[_0x830f[71]]||null,text:_0xf61cx10[_0x830f[72]]||null,MailAttachments:_0xf61cx10[_0x830f[35]]||[],MailRoomId:_0xf61cx1a[_0x830f[18]]},{include:[{model:MailAttachment}],transaction:_0xf61cx19})})}else {return MailRoom[_0x830f[73]]({roomId:_0xf61cx10[_0x830f[62]],subject:_0xf61cx10[_0x830f[64]],from:_[_0x830f[67]](_0xf61cx10[_0x830f[65]],_0x830f[66])[_0x830f[37]](_0x830f[76]),MailMessages:[{messageId:_0xf61cx10[_0x830f[62]],subject:_0xf61cx10[_0x830f[64]],from:_[_0x830f[67]](_0xf61cx10[_0x830f[65]],_0x830f[66]),to:_0xf61cx10[_0x830f[68]]?_[_0x830f[67]](_0xf61cx10[_0x830f[68]],_0x830f[66]):[],cc:_0xf61cx10[_0x830f[69]]?_[_0x830f[67]](_0xf61cx10[_0x830f[69]],_0x830f[66]):[],bcc:_0xf61cx10[_0x830f[70]]?_[_0x830f[67]](_0xf61cx10[_0x830f[70]],_0x830f[66]):[],status:_0x830f[63],html:_0xf61cx10[_0x830f[71]]||null,text:_0xf61cx10[_0x830f[72]]||null,MailAttachments:_0xf61cx10[_0x830f[35]]||[]}],MailAccountId:_0xf61cxc[_0x830f[53]]},{transaction:_0xf61cx19,include:[{model:MailMessage,include:[{model:MailAttachment}]}]})}})[_0x830f[46]](function(_0xf61cxe){console[_0x830f[45]](_0xf61cxe)})});this[_0x830f[14]][_0x830f[51]](_0x830f[78],function(_0xf61cx1c){console[_0x830f[13]](_0xf61cx1c[_0x830f[2]])});this[_0x830f[14]][_0x830f[19]]=_0xf61cxc[_0x830f[18]]};Imap[_0x830f[16]][_0x830f[20]]=function(_0xf61cxc){if(!_0xf61cxc[_0x830f[80]](_0x830f[79])&&!_0xf61cxc[_0x830f[80]](_0x830f[58])){console[_0x830f[13]](_0x830f[43]+_0xf61cxc[_0x830f[25]]+_0x830f[81]);this[_0x830f[17]](_0xf61cxc)}};Imap[_0x830f[16]][_0x830f[22]]=function(_0xf61cxc){console[_0x830f[13]](_0x830f[43]+_0xf61cxc[_0x830f[25]]+_0x830f[82]);this[_0x830f[14]][_0x830f[24]]();this[_0x830f[14]]=null};module[_0x830f[83]]=Imap
\ No newline at end of file
+var _0xe876=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x6C\x6F\x64\x61\x73\x68","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x61\x69\x6C\x2D\x6C\x69\x73\x74\x65\x6E\x65\x72\x32","\x77\x72\x69\x74\x65\x46\x69\x6C\x65","\x66\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x4D\x65\x73\x73\x61\x67\x65","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74","\x4D\x61\x69\x6C\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x58\x49\x54\x45\x44\x20\x57\x49\x54\x48\x20\x43\x4F\x44\x45\x20\x25\x73\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x61\x72\x67\x76","\x70\x69\x64","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x53\x54\x41\x52\x54\x49\x4E\x47\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x73\x74\x61\x74\x65","\x43\x4F\x4E\x4E\x45\x43\x54\x49\x4E\x47","\x73\x65\x6E\x64","\x6D\x61\x69\x6C","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x4E\x45\x57\x20\x4D\x53\x47\x20\x46\x52\x4F\x4D\x20\x25\x73\x20","\x3B","\x6A\x6F\x69\x6E","\x66\x72\x6F\x6D","\x61\x64\x64\x72\x65\x73\x73","\x6D\x61\x70","\x74\x79\x70\x65","\x6D\x73\x67","\x6D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x49\x6E\x49\x64","\x6D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x45\x52\x52\x52\x4F\x52\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x75\x73\x65\x72\x6E\x61\x6D\x65","\x45\x52\x52\x4F\x52","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x73\x65\x72\x76\x65\x72\x3A\x64\x69\x73\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x73\x74\x6F\x70","\x44\x49\x53\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x73\x65\x72\x76\x65\x72\x3A\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x49\x4D\x41\x50\x20\x53\x45\x52\x56\x45\x52\x20\x25\x73\x20\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44\x2C\x20\x50\x52\x4F\x43\x45\x53\x53\x20\x49\x44\x3A\x20\x25\x73\x20","\x43\x4F\x4E\x4E\x45\x43\x54\x45\x44","\x70\x61\x73\x73\x77\x6F\x72\x64","\x68\x6F\x73\x74","\x70\x6F\x72\x74","\x73\x73\x6C","\x6D\x61\x69\x6C\x62\x6F\x78","\x66\x69\x6C\x74\x65\x72","\x63\x6F\x6E\x6E\x54\x69\x6D\x65\x6F\x75\x74","\x61\x75\x74\x68\x54\x69\x6D\x65\x6F\x75\x74","\x6B\x65\x65\x70\x61\x6C\x69\x76\x65","\x69\x64","\x4D\x61\x69\x6C\x41\x63\x63\x6F\x75\x6E\x74\x49\x64","\x73\x74\x61\x72\x74","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0xe876[0];var util=require(_0xe876[1]);var path=require(_0xe876[2]);var _=require(_0xe876[3]);var Promise=require(_0xe876[4]);var ImapListener=require(_0xe876[5]);var writeFile=Promise[_0xe876[8]](require(_0xe876[7])[_0xe876[6]]);var config=require(_0xe876[9]);var Server=require(_0xe876[11])[_0xe876[10]];var Room=require(_0xe876[11])[_0xe876[12]];var Message=require(_0xe876[11])[_0xe876[13]];var Account=require(_0xe876[11])[_0xe876[14]];var Attachment=require(_0xe876[11])[_0xe876[15]];var imap;var timeout;process[_0xe876[17]](_0xe876[18],function(_0x7b46x10){console[_0xe876[23]](util[_0xe876[22]](_0xe876[19],process[_0xe876[20]][3],_0x7b46x10,process[_0xe876[21]]))})[_0xe876[17]](_0xe876[16],function(_0x7b46xf){console[_0xe876[16]](_0x7b46xf)});console[_0xe876[23]](util[_0xe876[22]](_0xe876[24],process[_0xe876[20]][3],process[_0xe876[21]]));process[_0xe876[27]]({type:_0xe876[25],state:_0xe876[26]});function onSave(_0x7b46x12){imap=  new ImapListener({username:_0x7b46x12[_0xe876[40]],password:_0x7b46x12[_0xe876[50]],host:_0x7b46x12[_0xe876[51]],port:_0x7b46x12[_0xe876[52]],tls:_0x7b46x12[_0xe876[53]],tlsOptions:{rejectUnauthorized:false},mailbox:_0x7b46x12[_0xe876[54]],searchFilter:[_0x7b46x12[_0xe876[55]]],markSeen:true,fetchUnreadOnStart:true,connTimeout:_0x7b46x12[_0xe876[56]]* 1000,authTimeout:_0x7b46x12[_0xe876[57]]* 1000,keepalive:_0x7b46x12[_0xe876[58]]})[_0xe876[17]](_0xe876[47],function(){console[_0xe876[23]](util[_0xe876[22]](_0xe876[48],_0x7b46x12[_0xe876[40]],process[_0xe876[21]]));process[_0xe876[27]]({type:_0xe876[25],state:_0xe876[49]})})[_0xe876[17]](_0xe876[43],function(_0x7b46xf){console[_0xe876[16]](util[_0xe876[22]](_0xe876[44],_0x7b46x12[_0xe876[40]],process[_0xe876[21]]),_0x7b46xf);imap[_0xe876[45]]();imap= null;process[_0xe876[27]]({type:_0xe876[25],state:_0xe876[46]})})[_0xe876[17]](_0xe876[16],function(_0x7b46xf){console[_0xe876[16]](util[_0xe876[22]](_0xe876[39],_0x7b46x12[_0xe876[40]],process[_0xe876[21]]),_0x7b46xf);process[_0xe876[27]]({type:_0xe876[25],state:_0xe876[41],source:JSON[_0xe876[42]](_0x7b46xf)})})[_0xe876[17]](_0xe876[28],function(_0x7b46x13,_0x7b46x14,_0x7b46x15){console[_0xe876[23]](util[_0xe876[22]](_0xe876[29],process[_0xe876[20]][3],_[_0xe876[34]](_0x7b46x13[_0xe876[32]],_0xe876[33])[_0xe876[31]](_0xe876[30])));_0x7b46x13[_0xe876[35]]= _0xe876[36];_0x7b46x13[_0xe876[37]]= imap[_0xe876[37]];_0x7b46x13[_0xe876[38]]= imap[_0xe876[38]];process[_0xe876[27]](_0x7b46x13)});imap[_0xe876[37]]= _0x7b46x12[_0xe876[59]];imap[_0xe876[38]]= _0x7b46x12[_0xe876[60]];imap[_0xe876[61]]()}Server[_0xe876[64]](process[_0xe876[20]][2])[_0xe876[63]](function(_0x7b46x12){onSave(_0x7b46x12)})[_0xe876[62]](function(_0x7b46xf){console[_0xe876[16]](_0x7b46xf)})
\ No newline at end of file