2017-01-30 09:18:12 -05:00
|
|
|
/*
|
|
|
|
* GXS Mailing Service
|
|
|
|
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-03-01 20:37:53 -05:00
|
|
|
#include "gxstrans/p3gxstransitems.h"
|
2017-05-07 18:19:11 -04:00
|
|
|
#include "serialiser/rstypeserializer.h"
|
2017-01-30 09:18:12 -05:00
|
|
|
|
2017-03-01 20:37:53 -05:00
|
|
|
const RsGxsId RsGxsTransMailItem::allRecipientsHint("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
|
2017-01-30 09:18:12 -05:00
|
|
|
|
2017-05-07 18:19:11 -04:00
|
|
|
OutgoingRecord::OutgoingRecord() :
|
|
|
|
RsItem( RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_TRANS,
|
|
|
|
static_cast<uint8_t>(GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM) )
|
|
|
|
{ clear();}
|
2017-02-18 14:32:25 -05:00
|
|
|
|
2017-03-01 20:37:53 -05:00
|
|
|
OutgoingRecord::OutgoingRecord( RsGxsId rec, GxsTransSubServices cs,
|
2017-02-25 18:46:02 -05:00
|
|
|
const uint8_t* data, uint32_t size ) :
|
2017-03-01 20:37:53 -05:00
|
|
|
RsItem( RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_TRANS,
|
|
|
|
static_cast<uint8_t>(GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM) ),
|
|
|
|
status(GxsTransSendStatus::PENDING_PROCESSING), recipient(rec),
|
2017-02-25 18:46:02 -05:00
|
|
|
clientService(cs)
|
|
|
|
{
|
|
|
|
mailData.resize(size);
|
|
|
|
memcpy(&mailData[0], data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-07 18:19:11 -04:00
|
|
|
RS_REGISTER_ITEM_TYPE(RsGxsTransMailItem) // for mailItem
|
|
|
|
RS_REGISTER_ITEM_TYPE(RsNxsTransPresignedReceipt) // for presignedReceipt
|
2017-02-25 18:46:02 -05:00
|
|
|
|
2017-05-07 18:19:11 -04:00
|
|
|
void OutgoingRecord::serial_process(RsGenericSerializer::SerializeJob j,
|
|
|
|
RsGenericSerializer::SerializeContext& ctx)
|
2017-02-25 18:46:02 -05:00
|
|
|
{
|
2017-05-07 18:19:11 -04:00
|
|
|
RS_REGISTER_SERIAL_MEMBER_TYPED(status, uint8_t);
|
|
|
|
RS_REGISTER_SERIAL_MEMBER(recipient);
|
|
|
|
RS_REGISTER_SERIAL_MEMBER(mailItem);
|
|
|
|
RS_REGISTER_SERIAL_MEMBER(mailData);
|
|
|
|
RS_REGISTER_SERIAL_MEMBER_TYPED(clientService, uint16_t);
|
|
|
|
RS_REGISTER_SERIAL_MEMBER(presignedReceipt);
|
2017-02-25 18:46:02 -05:00
|
|
|
}
|