Пример #1
0
DWORD CLotusNote::ItemInfoNext(BLOCKID prevItem, char *name, BLOCKID *pblockid, WORD *ptype, BLOCKID *pvalue_blockid, DWORD *pvalue_len)
{
	STATUS sr;
	WORD	nlen;

	if (m_hnote == NULL) return Error_Handle("CLotusNote::ItemInfoNext ... failed");
	if (name == NULL) nlen = 0; else nlen = strlen(name);

	sr = NSFItemInfoNext(m_hnote,prevItem,name,nlen,pblockid,ptype,pvalue_blockid,pvalue_len);
	return CLotusSection::Add_NApi_code_msg(sr,m_err_msg,sizeof(m_err_msg),"CLotusNote::ItemInfoNext %s",name);
}
Пример #2
0
_declspec( dllexport ) STATUS ATOM_NSFItemInfoNext(NOTEHANDLE note_handle, 
												   BLOCKID  nextItem, 
												   const char far *item_name, 
											       WORD  name_len,
											       BLOCKID far *item_blockid, 
											       WORD far *value_datatype, 
											       BLOCKID far *value_blockid, 
											       DWORD far *value_len) {

	return NSFItemInfoNext(note_handle, nextItem, item_name, name_len, item_blockid, value_datatype, value_blockid, value_len);
}
Пример #3
0
/** eus_MimePartItmInfo( ***
Provides certain requested information about a particular MIME-part item in a 
note.

--- parameters & return ----
h_NOTE: handle to the note containing the MIME content
pc_ITMNM: address of the name of the item containing the MIME content
us_LEN_ITMNM_: Optional. Length of the item's name. If null, procedure will 
	assume the name to be null-terminated and will compute the length itself.
bid_ITM_PRV: Optional. Address of the _item_ BlockID of the same-named item 
	that precedes the item being queried. Therefore only useful when working 
	with multiple-instance items. If null, procedure seeks the first item with 
	the given name.
pbid_itm: Optional Output. Address of the variable to receive the item BlockID 
	of the target item. If null, output is suppressed.
pbid_ctnt: Optional Output, Required if the content-descriptor output is 
	requested. Address of the variable to receive the content BlockID of the 
	target item. If the content-descriptor output is requested, the block will 
	be locked on return and the caller is responsible for unlocking it. If 
	null, output is suppressed. If a handled error occurs, block will be 
	unlocked before return.
pt_ctnt: Optional Output. Address of the content-descriptor structure to 
	receive information about the content of the MIME-part. If null, output is 
	suppressed.
pbid_itmFileIncl: Optional Output. Address of BlockID to receive the _item_ 
	block associated with the file-attacment include involved with the 
	MIME-part.
pbid_ctntFileIncl: Optional Output. Address of BlockID to receive the content 
	block associated with the file-attacment include involved with the 
	MIME-part. If null, the output is suppressed.
RETURN:
	eus_ERR_INVLD_ARG if any input is obviously invalid
	eus_ERR_MEM if an attempted memory allocation failed
	eus_SUCCESS if no error occured
	the Notes API error code otherwise

--- revision history -------
3/14/03 PR: created			*/
STATUS eus_MimePartItmInfo( const NOTEHANDLE  h_NOTE, 
							const char  pc_ITMNM[], 
							const WORD  us_LEN_ITMNM_, 
							const BLOCKID  bid_ITM_PRV, 
							BLOCKID *const  pbid_itm, 
							BLOCKID *const  pbid_ctnt, 
							MimePrtItmCtnt *const  pt_ctnt, 
							BLOCKID *const  pbid_itmFileIncl, 
							BLOCKID *const  pbid_ctntFileIncl)	{
	const WORD  us_LEN_ITMNM = us_LEN_ITMNM_ ? us_LEN_ITMNM_ : pc_ITMNM ? 
													strlen( pc_ITMNM) : NULL;

	BLOCKID  bid_ctnt;
	WORD  us_typ, us_lenCtnt;
	DWORD  ul;
	MIME_PART * pt;
	BYTE * puc_ctnt, * puc;
	WORD  us;
	STATUS  us_err;

	if (!( h_NOTE && pc_ITMNM && *pc_ITMNM && (pt_ctnt ? (BOOL) pbid_ctnt : 
																		TRUE)))
		return eus_ERR_INVLD_ARG;

	if (pbid_itm)
		*pbid_itm = ebid_NULLBLOCKID;
	if (pbid_ctnt)
		*pbid_ctnt = ebid_NULLBLOCKID;
	if (pt_ctnt)
		memset( pt_ctnt, NULL, sizeof( MimePrtItmCtnt));
	if (pbid_itmFileIncl)
		*pbid_itmFileIncl = ebid_NULLBLOCKID;
	if (pbid_ctntFileIncl)
		*pbid_ctntFileIncl = ebid_NULLBLOCKID;

	//if the item isn't a valid MIME-part, short-cicuit with failure
	if (!bid_ITM_PRV.pool)	{
		if (us_err = NSFItemInfo( (NOTEHANDLE) h_NOTE, (char *) pc_ITMNM, 
													us_LEN_ITMNM, pbid_itm, 
													&us_typ, &bid_ctnt, &ul))
			return us_err;
	}else if (us_err = NSFItemInfoNext( (NOTEHANDLE) h_NOTE, bid_ITM_PRV, 
											(char *) pc_ITMNM, us_LEN_ITMNM, 
											pbid_itm, &us_typ, &bid_ctnt, &ul))
		return us_err;
	if (!( us_typ == TYPE_MIME_PART && ul >= sizeof( WORD) + 
															sizeof( MIME_PART)))
		return eus_ERR_INVLD_ARG;

	//if request requires no content annotatation or extraction, short-circuit 
	//	with success
	if (!( pt_ctnt || pbid_itmFileIncl || pbid_ctntFileIncl))	{
		if (pbid_ctnt)
			*pbid_ctnt = bid_ctnt;
		return eus_SUCCESS;
	}

	//annotate and extract content as requested
	pt = (MIME_PART *) (OSLockBlock( WORD, bid_ctnt) + 1);
	puc_ctnt = puc = (BYTE *) (pt + 1);
	if (pt_ctnt)	{
		pt_ctnt->puc_ctnt = puc_ctnt;
		pt_ctnt->pt = pt;
	}
	us_lenCtnt = pt->wByteCount;
	if (puc = epc_strInBuf( epc_MIMHDR_CTNT_TYP, puc, us_lenCtnt, 
												eus_LEN_MIMHDR_CTNT_TYP))	{
		puc += eus_LEN_MIMHDR_CTNT_TYP;
		if (pt_ctnt)
			pt_ctnt->puc_typ = puc;
		if (!( puc = epc_strInBuf( epc_MIM_HDRS_DLIM, puc, us_lenCtnt, 
														eus_LEN_MIM_HDRS_DLIM)))
			goto errJump;
		puc += eus_LEN_MIM_HDRS_DLIM;
		if (pt_ctnt)
			pt_ctnt->puc_bdy = puc;
		if (pt->dwFlags & MIME_PART_BODY_IN_DBOBJECT && (pbid_itmFileIncl || 
								pbid_ctntFileIncl) && (us = pt->wByteCount - 
								(puc - puc_ctnt)) && us < MAXPATH)	{
			char *const pc = malloc( us + 1);
			if (!pc)	{
				us_err = eus_ERR_MEM;
				goto errJump;
			}
			pc[ us] = NULL;
			memcpy( pc, puc, us);
			us_err = eus_getAttachmentInfo( h_NOTE, NULL, pc, NULL, NULL, NULL, 
									NULL, pbid_itmFileIncl, pbid_ctntFileIncl);
			if (!us_err && (pbid_itmFileIncl && pbid_itmFileIncl->pool || 
								pbid_ctntFileIncl && pbid_ctntFileIncl->pool))
				pt_ctnt->pc_objNm = pc;
			else
				free( pc);
			if (us_err)
				goto errJump;
		} //if (pt->dwFlags & MIME_PART_BODY_IN_DBOBJECT && (pbid_itmFileIncl ||
	}else if (us_lenCtnt > pt->wBoundaryLen + eus_LEN_MIM_BNDRY_TACK_ON + 
																eui_LEN_CRLF)
		goto errJump;

	if (!pt_ctnt)
		OSUnlockBlock( bid_ctnt);
	if (pbid_ctnt)
		*pbid_ctnt = bid_ctnt;

	return eus_SUCCESS;

errJump:
	OSUnlockBlock( bid_ctnt);
	return us_err ? us_err : eus_ERR_INVLD_ARG;
} //eus_MimePartItmInfo(