Built motion from commit ddca4d0d.|2.5.47
[motion2.git] / server / api / smsInteraction / smsInteraction.events.js
index 60ccadf..db64293 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cb9=['remove','getUsers','then','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4e38bf,_0xde1d2c){_0x4e38bf=_0x4e38bf-0x0;var _0x32b749=_0x1cb9[_0x4e38bf];return _0x32b749;};'use strict';var EventEmitter=require(_0x91cb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x91cb('0x1')];var SmsMessage=require(_0x91cb('0x2'))['db'][_0x91cb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x91cb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x91cb('0x5'),'afterDestroy':_0x91cb('0x6')};function emitEvent(_0x5652cd){return function(_0x17c21c,_0x3640f9,_0x186dc3){_0x17c21c[_0x91cb('0x7')]({'attributes':['id'],'raw':!![]})[_0x91cb('0x8')](function(_0x8f8a3b){_0x17c21c['setDataValue'](_0x91cb('0x9'),_0x8f8a3b['map'](function(_0x2fdfce){return{'id':_0x2fdfce['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x17c21c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x91cb('0x8')](function(_0x317df0){_0x17c21c[_0x91cb('0xa')](_0x91cb('0xb'),_0x317df0[_0x91cb('0xc')]);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd+':'+_0x17c21c['id'],_0x17c21c);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd,_0x17c21c);_0x186dc3(null);})[_0x91cb('0xe')](_0x186dc3(null));};}for(var e in events){if(events[_0x91cb('0xf')](e)){var event=events[e];SmsInteraction[_0x91cb('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents;
\ No newline at end of file
+var _0x3423=['then','setDataValue','Users','map','findAll','catch','hasOwnProperty','exports','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x6c1bd9,_0x313847){var _0x56b2fa=function(_0x392eb8){while(--_0x392eb8){_0x6c1bd9['push'](_0x6c1bd9['shift']());}};_0x56b2fa(++_0x313847);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3342('0x0')];var SmsMessage=require(_0x3342('0x1'))['db'][_0x3342('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3342('0x3')](0x0);var events={'afterCreate':_0x3342('0x4'),'afterUpdate':_0x3342('0x5'),'afterDestroy':_0x3342('0x6')};function emitEvent(_0x3c5d8d){return function(_0x3075f8,_0x19206f,_0x467453){_0x3075f8[_0x3342('0x7')]({'attributes':['id'],'raw':!![]})[_0x3342('0x8')](function(_0x420d4b){_0x3075f8[_0x3342('0x9')](_0x3342('0xa'),_0x420d4b[_0x3342('0xb')](function(_0xd9d129){return{'id':_0xd9d129['id']};}));return SmsMessage[_0x3342('0xc')]({'where':{'SmsInteractionId':_0x3075f8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x582c37){_0x3075f8[_0x3342('0x9')]('unreadMessages',_0x582c37['length']);SmsInteractionEvents['emit'](_0x3c5d8d+':'+_0x3075f8['id'],_0x3075f8);SmsInteractionEvents['emit'](_0x3c5d8d,_0x3075f8);_0x467453(null);})[_0x3342('0xd')](_0x467453(null));};}for(var e in events){if(events[_0x3342('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x3342('0xf')]=SmsInteractionEvents;
\ No newline at end of file