xpcom_chimera/comproxy/PinoPacket.cpp
PinoPacket::PinoPacket(char type, PinoComment cmmt) 
{
	list<PinoField> fields;
	string			body;

	if (type != PostCommentReq)
	{
		cout << "PinoPacket: invalid parameter." << endl; /* FIXME: Error! */
	}

	fields = getFieldList(&cmmt);
	if (fields.empty())
	{
		cout << "PinoPacket: invalid parameter." << endl; /* FIXME: Error! */
	}
	m_type = PostCommentReq;
	m_body = buildPacketUnitBody(fields);
	m_len = getPacketUnitBodyLen(m_body);

	/* FIXME:: Allocate memory for ptk_stream, otherwise use C++ string */

	m_stream[0] = VERSION;
	m_stream[1] = PostCommentReq;
	*((unsigned char *) m_stream)	= m_len;
	
	/* TODO: copy m_body to m_stream */
}
/*
 * _ONLY_ For PostCommentReq, given by a comment, we setup a PinoPacket 
 *
 */
_ONLY_ For PostCommentReq, given by a comment, we setup a PinoPacket
_ONLY_ For PostCommentReq given by a comment we setup a PinoPacket
PinoPacket::PinoPacket(char type, PinoComment cmmt) 
{
	list<PinoField> fields;
	string			body;
	if (type != PostCommentReq)
	{
		cout << "PinoPacket: invalid parameter." << endl; 
	}
	fields = getFieldList(&cmmt);
	if (fields.empty())
	{
		cout << "PinoPacket: invalid parameter." << endl; 
	}
	m_type = PostCommentReq;
	m_body = buildPacketUnitBody(fields);
	m_len = getPacketUnitBodyLen(m_body);
	m_stream[0] = VERSION;
	m_stream[1] = PostCommentReq;
	*((unsigned char *) m_stream)	= m_len;
}
PinoPacket :: PinoPacket ( char type , PinoComment cmmt ) { list < PinoField > fields ; string body ; if ( type != PostCommentReq ) { cout << " " << endl ; } fields = getFieldList ( & cmmt ) ; if ( fields . empty ( ) ) { cout << " " << endl ; } m_type = PostCommentReq ; m_body = buildPacketUnitBody ( fields ) ; m_len = getPacketUnitBodyLen ( m_body ) ; m_stream [ 0 ] = VERSION ; m_stream [ 1 ] = PostCommentReq ; * ( ( unsigned char * ) m_stream ) = m_len ; }
_ONLY_ For PostCommentReq, given by a comment, we setup a PinoPacket
_ONLY_ For PostCommentReq given by a comment we setup a PinoPacket
/* FIXME: Error! */ /* FIXME: Error! */ /* FIXME:: Allocate memory for ptk_stream, otherwise use C++ string */ /* TODO: copy m_body to m_stream */