Built motion from commit 97153652.|2.6.26
[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 _0xc59f=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5ad7d0,_0x5a0449){var _0x1df266=function(_0x2e5ddc){while(--_0x2e5ddc){_0x5ad7d0['push'](_0x5ad7d0['shift']());}};_0x1df266(++_0x5a0449);}(_0xc59f,0x69));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc59('0x0'));var util=require('util');var moment=require(_0xfc59('0x1'));var BPromise=require(_0xfc59('0x2'));var rs=require(_0xfc59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc59('0x4'));var logger=require(_0xfc59('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfc59('0x6'));var client=jayson[_0xfc59('0x7')][_0xfc59('0x8')]({'port':0x232a});config[_0xfc59('0x9')]=_[_0xfc59('0xa')](config['redis'],{'host':_0xfc59('0xb'),'port':0x18eb});var socket=require(_0xfc59('0xc'))(new Redis(config[_0xfc59('0x9')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4c6adc,_0x5c483e,_0x2bef1d){return new BPromise(function(_0x4c089f,_0x51470f){return client[_0xfc59('0xd')](_0x4c6adc,_0x2bef1d)[_0xfc59('0xe')](function(_0x21f3cd){logger[_0xfc59('0xf')](_0xfc59('0x10'),_0x5c483e,'request\x20sent');logger[_0xfc59('0x11')](_0xfc59('0x12'),_0x5c483e,_0xfc59('0x13'),JSON[_0xfc59('0x14')](_0x21f3cd));if(_0x21f3cd[_0xfc59('0x15')]){if(_0x21f3cd[_0xfc59('0x15')][_0xfc59('0x16')]===0x1f4){logger[_0xfc59('0x15')](_0xfc59('0x10'),_0x5c483e,_0x21f3cd[_0xfc59('0x15')][_0xfc59('0x17')]);return _0x51470f(_0x21f3cd[_0xfc59('0x15')]['message']);}logger[_0xfc59('0x15')](_0xfc59('0x10'),_0x5c483e,_0x21f3cd['error']['message']);return _0x4c089f(_0x21f3cd[_0xfc59('0x15')][_0xfc59('0x17')]);}else{logger[_0xfc59('0xf')](_0xfc59('0x10'),_0x5c483e,_0xfc59('0x13'));_0x4c089f(_0x21f3cd['result']['message']);}})[_0xfc59('0x18')](function(_0x4b5efd){logger[_0xfc59('0x15')](_0xfc59('0x10'),_0x5c483e,_0x4b5efd);_0x51470f(_0x4b5efd);});});}