Built motion from commit (unavailable).|2.6.0
[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 _0x751f=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x265e0e,_0x38b2bb){var _0x518157=function(_0x1e3eab){while(--_0x1e3eab){_0x265e0e['push'](_0x265e0e['shift']());}};_0x518157(++_0x38b2bb);}(_0x751f,0xe1));var _0xf751=function(_0x198cf8,_0x563928){_0x198cf8=_0x198cf8-0x0;var _0x13ca72=_0x751f[_0x198cf8];return _0x13ca72;};'use strict';var _=require('lodash');var util=require(_0xf751('0x0'));var moment=require('moment');var BPromise=require(_0xf751('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf751('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf751('0x3'));var logger=require(_0xf751('0x4'))(_0xf751('0x5'));var config=require(_0xf751('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf751('0x7')]({'port':0x232a});config[_0xf751('0x8')]=_[_0xf751('0x9')](config[_0xf751('0x8')],{'host':_0xf751('0xa'),'port':0x18eb});var socket=require(_0xf751('0xb'))(new Redis(config[_0xf751('0x8')]));require(_0xf751('0xc'))[_0xf751('0xd')](socket);function respondWithRpcPromise(_0xcdfcad,_0x2fd95e,_0x2b559f){return new BPromise(function(_0x4882f3,_0x2fdc0d){return client[_0xf751('0xe')](_0xcdfcad,_0x2b559f)[_0xf751('0xf')](function(_0x322823){logger[_0xf751('0x10')](_0xf751('0x11'),_0x2fd95e,_0xf751('0x12'));logger[_0xf751('0x13')](_0xf751('0x14'),_0x2fd95e,_0xf751('0x12'),JSON[_0xf751('0x15')](_0x322823));if(_0x322823[_0xf751('0x16')]){if(_0x322823[_0xf751('0x16')][_0xf751('0x17')]===0x1f4){logger[_0xf751('0x16')](_0xf751('0x11'),_0x2fd95e,_0x322823[_0xf751('0x16')]['message']);return _0x2fdc0d(_0x322823[_0xf751('0x16')][_0xf751('0x18')]);}logger['error'](_0xf751('0x11'),_0x2fd95e,_0x322823['error'][_0xf751('0x18')]);return _0x4882f3(_0x322823[_0xf751('0x16')][_0xf751('0x18')]);}else{logger[_0xf751('0x10')](_0xf751('0x11'),_0x2fd95e,_0xf751('0x12'));_0x4882f3(_0x322823[_0xf751('0x19')][_0xf751('0x18')]);}})[_0xf751('0x1a')](function(_0x1c33bd){logger[_0xf751('0x16')](_0xf751('0x11'),_0x2fd95e,_0x1c33bd);_0x2fdc0d(_0x1c33bd);});});}