Built motion from commit ddca4d0d.|2.5.47
[motion2.git] / server / api / userNotification / userNotification.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xb58c=['ioredis','../../config/utils','rpc','jayson/promise','defaults','localhost','redis','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x390b2b,_0x4653fa){var _0x4c4020=function(_0x913415){while(--_0x913415){_0x390b2b['push'](_0x390b2b['shift']());}};_0x4c4020(++_0x4653fa);}(_0xb58c,0xaa));var _0xcb58=function(_0x47abe4,_0x2879a0){_0x47abe4=_0x47abe4-0x0;var _0x4e7824=_0xb58c[_0x47abe4];return _0x4e7824;};'use strict';var _=require(_0xcb58('0x0'));var util=require(_0xcb58('0x1'));var moment=require(_0xcb58('0x2'));var BPromise=require(_0xcb58('0x3'));var rs=require(_0xcb58('0x4'));var fs=require('fs');var Redis=require(_0xcb58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb58('0x6'));var logger=require('../../config/logger')(_0xcb58('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb58('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xcb58('0x9')](config['redis'],{'host':_0xcb58('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb58('0xb')]));require(_0xcb58('0xc'))['register'](socket);function respondWithRpcPromise(_0x530e7d,_0x52e8fe,_0xb79647){return new BPromise(function(_0x2f8b09,_0x571814){return client['request'](_0x530e7d,_0xb79647)[_0xcb58('0xd')](function(_0x31a10e){logger[_0xcb58('0xe')](_0xcb58('0xf'),_0x52e8fe,'request\x20sent');logger[_0xcb58('0x10')](_0xcb58('0x11'),_0x52e8fe,_0xcb58('0x12'),JSON[_0xcb58('0x13')](_0x31a10e));if(_0x31a10e[_0xcb58('0x14')]){if(_0x31a10e[_0xcb58('0x14')][_0xcb58('0x15')]===0x1f4){logger[_0xcb58('0x14')]('UserNotification,\x20%s,\x20%s',_0x52e8fe,_0x31a10e[_0xcb58('0x14')][_0xcb58('0x16')]);return _0x571814(_0x31a10e['error']['message']);}logger[_0xcb58('0x14')](_0xcb58('0xf'),_0x52e8fe,_0x31a10e[_0xcb58('0x14')][_0xcb58('0x16')]);return _0x2f8b09(_0x31a10e[_0xcb58('0x14')][_0xcb58('0x16')]);}else{logger[_0xcb58('0xe')](_0xcb58('0xf'),_0x52e8fe,_0xcb58('0x12'));_0x2f8b09(_0x31a10e[_0xcb58('0x17')][_0xcb58('0x16')]);}})[_0xcb58('0x18')](function(_0x21d746){logger[_0xcb58('0x14')](_0xcb58('0xf'),_0x52e8fe,_0x21d746);_0x571814(_0x21d746);});});}