Built motion from commit 97153652.|2.6.26
[motion2.git] / server / api / userProfile / userProfile.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 _0xcaaf=['redis','defaults','localhost','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x58ecad,_0x3546ea){var _0x52edd6=function(_0x1ed58f){while(--_0x1ed58f){_0x58ecad['push'](_0x58ecad['shift']());}};_0x52edd6(++_0x3546ea);}(_0xcaaf,0x66));var _0xfcaa=function(_0x396973,_0x28c41b){_0x396973=_0x396973-0x0;var _0x528f3a=_0xcaaf[_0x396973];return _0x528f3a;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var moment=require(_0xfcaa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcaa('0x2'));var db=require(_0xfcaa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcaa('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcaa('0x5'));var client=jayson[_0xfcaa('0x6')][_0xfcaa('0x7')]({'port':0x232a});config[_0xfcaa('0x8')]=_[_0xfcaa('0x9')](config[_0xfcaa('0x8')],{'host':_0xfcaa('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfcaa('0x8')]));require('./userProfile.socket')[_0xfcaa('0xb')](socket);function respondWithRpcPromise(_0x4bdec3,_0x101ac0,_0x593c04){return new BPromise(function(_0x586902,_0x345e39){return client['request'](_0x4bdec3,_0x593c04)[_0xfcaa('0xc')](function(_0x2e83f8){logger[_0xfcaa('0xd')](_0xfcaa('0xe'),_0x101ac0,_0xfcaa('0xf'));logger[_0xfcaa('0x10')](_0xfcaa('0x11'),_0x101ac0,_0xfcaa('0xf'),JSON['stringify'](_0x2e83f8));if(_0x2e83f8[_0xfcaa('0x12')]){if(_0x2e83f8[_0xfcaa('0x12')][_0xfcaa('0x13')]===0x1f4){logger[_0xfcaa('0x12')]('UserProfile,\x20%s,\x20%s',_0x101ac0,_0x2e83f8[_0xfcaa('0x12')][_0xfcaa('0x14')]);return _0x345e39(_0x2e83f8[_0xfcaa('0x12')][_0xfcaa('0x14')]);}logger['error'](_0xfcaa('0xe'),_0x101ac0,_0x2e83f8[_0xfcaa('0x12')][_0xfcaa('0x14')]);return _0x586902(_0x2e83f8['error'][_0xfcaa('0x14')]);}else{logger[_0xfcaa('0xd')]('UserProfile,\x20%s,\x20%s',_0x101ac0,_0xfcaa('0xf'));_0x586902(_0x2e83f8['result']['message']);}})[_0xfcaa('0x15')](function(_0x327f31){logger[_0xfcaa('0x12')](_0xfcaa('0xe'),_0x101ac0,_0x327f31);_0x345e39(_0x327f31);});});}