2b74e39b3cf4dbfd1932b473ceebc800c9446789
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0x063a=['code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4c8542,_0x5a0c53){var _0x5b95c7=function(_0xac1ef4){while(--_0xac1ef4){_0x4c8542['push'](_0x4c8542['shift']());}};_0x5b95c7(++_0x5a0c53);}(_0x063a,0x1e0));var _0xa063=function(_0x46a804,_0x4ef9d4){_0x46a804=_0x46a804-0x0;var _0x3fee7d=_0x063a[_0x46a804];return _0x3fee7d;};'use strict';var _=require(_0xa063('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa063('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa063('0x2'));var db=require(_0xa063('0x3'))['db'];var utils=require(_0xa063('0x4'));var logger=require(_0xa063('0x5'))(_0xa063('0x6'));var config=require('../../config/environment');var jayson=require(_0xa063('0x7'));var client=jayson[_0xa063('0x8')][_0xa063('0x9')]({'port':0x232a});config['redis']=_[_0xa063('0xa')](config[_0xa063('0xb')],{'host':_0xa063('0xc'),'port':0x18eb});var socket=require(_0xa063('0xd'))(new Redis(config[_0xa063('0xb')]));require(_0xa063('0xe'))[_0xa063('0xf')](socket);function respondWithRpcPromise(_0x15890b,_0x441320,_0x59b5e9){return new BPromise(function(_0x219450,_0x5c98aa){return client[_0xa063('0x10')](_0x15890b,_0x59b5e9)[_0xa063('0x11')](function(_0x272867){logger[_0xa063('0x12')](_0xa063('0x13'),_0x441320,_0xa063('0x14'));logger[_0xa063('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x441320,_0xa063('0x14'),JSON[_0xa063('0x16')](_0x272867));if(_0x272867[_0xa063('0x17')]){if(_0x272867['error'][_0xa063('0x18')]===0x1f4){logger[_0xa063('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x441320,_0x272867[_0xa063('0x17')][_0xa063('0x19')]);return _0x5c98aa(_0x272867['error'][_0xa063('0x19')]);}logger['error'](_0xa063('0x13'),_0x441320,_0x272867[_0xa063('0x17')][_0xa063('0x19')]);return _0x219450(_0x272867[_0xa063('0x17')][_0xa063('0x19')]);}else{logger[_0xa063('0x12')](_0xa063('0x13'),_0x441320,'request\x20sent');_0x219450(_0x272867[_0xa063('0x1a')][_0xa063('0x19')]);}})[_0xa063('0x1b')](function(_0x47e516){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x441320,_0x47e516);_0x5c98aa(_0x47e516);});});}