15d989466adf20f4aa44dcdc161ac5036fe5a9a2
[motion2.git] / server / api / userMailQueue / userMailQueue.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 _0xf131=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash'];(function(_0xda4429,_0x48e328){var _0x4440cb=function(_0x169eab){while(--_0x169eab){_0xda4429['push'](_0xda4429['shift']());}};_0x4440cb(++_0x48e328);}(_0xf131,0x1a1));var _0x1f13=function(_0x575b0a,_0x39fc88){_0x575b0a=_0x575b0a-0x0;var _0x2dc331=_0xf131[_0x575b0a];return _0x2dc331;};'use strict';var _=require(_0x1f13('0x0'));var util=require(_0x1f13('0x1'));var moment=require(_0x1f13('0x2'));var BPromise=require(_0x1f13('0x3'));var rs=require(_0x1f13('0x4'));var fs=require('fs');var Redis=require(_0x1f13('0x5'));var db=require(_0x1f13('0x6'))['db'];var utils=require(_0x1f13('0x7'));var logger=require('../../config/logger')(_0x1f13('0x8'));var config=require('../../config/environment');var jayson=require(_0x1f13('0x9'));var client=jayson[_0x1f13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d007e,_0x263848,_0x3ee03a){return new BPromise(function(_0x436521,_0x1126a4){return client[_0x1f13('0xb')](_0x3d007e,_0x3ee03a)[_0x1f13('0xc')](function(_0x11619a){logger['info'](_0x1f13('0xd'),_0x263848,_0x1f13('0xe'));logger[_0x1f13('0xf')](_0x1f13('0x10'),_0x263848,_0x1f13('0xe'),JSON['stringify'](_0x11619a));if(_0x11619a[_0x1f13('0x11')]){if(_0x11619a[_0x1f13('0x11')]['code']===0x1f4){logger[_0x1f13('0x11')](_0x1f13('0xd'),_0x263848,_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);return _0x1126a4(_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);}logger['error'](_0x1f13('0xd'),_0x263848,_0x11619a[_0x1f13('0x11')]['message']);return _0x436521(_0x11619a[_0x1f13('0x11')][_0x1f13('0x12')]);}else{logger[_0x1f13('0x13')](_0x1f13('0xd'),_0x263848,_0x1f13('0xe'));_0x436521(_0x11619a[_0x1f13('0x14')][_0x1f13('0x12')]);}})[_0x1f13('0x15')](function(_0x448cae){logger[_0x1f13('0x11')](_0x1f13('0xd'),_0x263848,_0x448cae);_0x1126a4(_0x448cae);});});}