Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / smsInteraction / smsInteraction.events.js
index a20c5d8..c81cd69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7916=['Users','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x5dfb29,_0x2a82de){var _0x331677=function(_0x5d7ac4){while(--_0x5d7ac4){_0x5dfb29['push'](_0x5dfb29['shift']());}};_0x331677(++_0x2a82de);}(_0x7916,0x128));var _0x6791=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0x7916[_0x153738];return _0x3028d9;};'use strict';var EventEmitter=require(_0x6791('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x6791('0x1')];var SmsMessage=require(_0x6791('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6791('0x3')](0x0);var events={'afterCreate':_0x6791('0x4'),'afterUpdate':_0x6791('0x5'),'afterDestroy':_0x6791('0x6')};function emitEvent(_0x5e6303){return function(_0xe98396,_0x5a5726,_0x3ca328){_0xe98396[_0x6791('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8b85ff){_0xe98396['setDataValue'](_0x6791('0x8'),_0x8b85ff['map'](function(_0x4ef65f){return{'id':_0x4ef65f['id']};}));return SmsMessage[_0x6791('0x9')]({'where':{'SmsInteractionId':_0xe98396['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6791('0xa')](function(_0x579950){_0xe98396[_0x6791('0xb')](_0x6791('0xc'),_0x579950[_0x6791('0xd')]);SmsInteractionEvents['emit'](_0x5e6303+':'+_0xe98396['id'],_0xe98396);SmsInteractionEvents[_0x6791('0xe')](_0x5e6303,_0xe98396);_0x3ca328(null);})[_0x6791('0xf')](_0x3ca328(null));};}for(var e in events){if(events[_0x6791('0x10')](e)){var event=events[e];SmsInteraction[_0x6791('0x11')](e,emitEvent(event));}}module[_0x6791('0x12')]=SmsInteractionEvents;
\ No newline at end of file
+var _0x0120=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x0120,0x6f));var _0x0012=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x0120[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0x0012('0x0'));var SmsInteraction=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var SmsMessage=require(_0x0012('0x1'))['db'][_0x0012('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0012('0x4')](0x0);var events={'afterCreate':_0x0012('0x5'),'afterUpdate':_0x0012('0x6'),'afterDestroy':_0x0012('0x7')};function emitEvent(_0x302029){return function(_0x3505ab,_0x3fcfbc,_0x4eaa5b){_0x3505ab['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x95d441){_0x3505ab[_0x0012('0x8')](_0x0012('0x9'),_0x95d441[_0x0012('0xa')](function(_0x33c82f){return{'id':_0x33c82f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3505ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0012('0xb')](function(_0x2d484c){_0x3505ab[_0x0012('0x8')](_0x0012('0xc'),_0x2d484c['length']);SmsInteractionEvents[_0x0012('0xd')](_0x302029+':'+_0x3505ab['id'],_0x3505ab);SmsInteractionEvents['emit'](_0x302029,_0x3505ab);_0x4eaa5b(null);})[_0x0012('0xe')](_0x4eaa5b(null));};}for(var e in events){if(events[_0x0012('0xf')](e)){var event=events[e];SmsInteraction[_0x0012('0x10')](e,emitEvent(event));}}module[_0x0012('0x11')]=SmsInteractionEvents;
\ No newline at end of file