Exemplo n.º 1
0
_declspec (dllexport ) WORD ATOM_NSFItemGetText(NOTEHANDLE note_handle,
												const char *item_name,
												char *item_text,
												WORD text_len)
{
	return NSFItemGetText(note_handle, item_name, item_text, text_len);
}
Exemplo n.º 2
0
DWORD CLotusNote::ItemGetText(char *item_name, char *ptext, WORD max_size,WORD* text_size)
{
	WORD	size;
	ptext[0] = 0;	//limpiar el texto
	if (m_hnote == NULL) return Error_Handle("ItemGetText ... failed");
	size = NSFItemGetText(m_hnote,item_name,ptext,max_size);
	if (text_size != NULL) *text_size = size;
	ptext[size] = 0;
	return ERR_OK;
}
Exemplo n.º 3
0
/******************************************************************************
	Detects UPDATES to calendar items
******************************************************************************/
bool Message::IsCalendarItemUpdate(HANDLE hNote)
{
	// Note that 'I' is not included because that is the initial meeting invitation
	#define	UPDATEFLAGS	"UCNARTDL"
	bool bResult = false;
	WORD wValueLen;
	char szBuffer[16];

	if (NSFItemIsPresent(hNote, MAIL_CS_NOTICETYPE_ITEM, (WORD)strlen(MAIL_CS_NOTICETYPE_ITEM)))
	{
		wValueLen = NSFItemGetText(	hNote,
									MAIL_CS_NOTICETYPE_ITEM,
									szBuffer,
									(WORD)sizeof(szBuffer) - 1);
		if (wValueLen == 1)
		{
			if (NULL != strchr(UPDATEFLAGS, szBuffer[0]))
			{
				bResult = true;
			}
		}
	}
	return bResult;
}
Exemplo n.º 4
0
_declspec ( dllexport ) WORD GetServerNamesEx(char retServerNames[MAX_SERVERS][MAXPATH])
{
	BOOL status = NOERROR;
	char szLocation[MAXENVVALUE];
	char szPAB[MAXENVVALUE];
	HANDLE db;
	char full_netpath[MAXPATH-1];
	NOTEID view_id;
	HCOLLECTION hCollection;
	COLLECTIONPOSITION pCollPosition;
	HANDLE hBuffer;
	DWORD NumberReturned = 0;
	NOTEID *IdList;
	NOTEHANDLE note;
	char szFieldName[80] = { 0 };
	char szFieldType[80] = { 0 };
	WORD retServerCount = 0;
	bool bUseLocal = false;

	// first, get the name of the current location
	status = OSGetEnvironmentString("Location", szLocation, MAXENVVALUE);
	if (status == TRUE) 
	{
		char *pb = strchr(szLocation, ',');
		if (pb != NULL)
			*pb = 0 ;
	}

	status = OSGetEnvironmentString("MAILSERVER", szPAB, MAXENVVALUE);
	if (status == TRUE) 
	{
		char *pb = strchr(szPAB, ',');
		if (pb != NULL)
			*pb = 0 ;
	}

	if (status = OSPathNetConstruct(NULL, szPAB, _T("names.nsf"), full_netpath))
	{
		printf("unable to open the public NAB %s!!names.nsf\n", szFieldName);
		return 0;
	}

	if (status = NSFDbOpen (full_netpath, &db))
        return 0;

	if (bUseLocal)
	{
		// choose local PAB view
		if (status = NIFFindView(db, _T("Connections"), &view_id))
		{
			NSFDbClose(db);
			return 0;
		}
	} else
	{
		// choose server list from server Directory
		if (status = NIFFindView(db, _T("Servers"), &view_id))
		{
			NSFDbClose(db);
			return 0;
		}
	}

	if (status = NIFOpenCollection( db,	 
									db,	  
		                			view_id,	 
									0,		   
		                			NULLHANDLE,	  
                					&hCollection,	 
		                			NULL,		   
		                			NULL,		
									NULL,	    	
		                			NULL ))	
	{
		NSFDbClose(db);
		return 0;
	}

	pCollPosition.Level = 0;
	pCollPosition.Tumbler[0] = 1;

	 if (status = NIFReadEntries(hCollection,	
							     &pCollPosition,		
							     NAVIGATE_CURRENT,	   
							     1L,		
							     NAVIGATE_NEXT,	   
							     0xFFFFFFFF,		  
							     READ_MASK_NOTEID,	
							     &hBuffer,	  
							     NULL,		 
							     NULL,		 
							     &NumberReturned,	  
							     NULL))		
	 {
		NIFCloseCollection(hCollection);
		NSFDbClose(db);
		return 0;
	 }

	 strcpy_s(retServerNames[retServerCount++], MAXPATH, _T("Local"));
	 if (NumberReturned != 0) 
	 {
		if (hBuffer != NULLHANDLE)
        {
    		IdList = (NOTEID far *)OSLockObject(hBuffer);
    		for (DWORD i=0; i<(DWORD)NumberReturned; i++)
			{
  				if (status = NSFNoteOpen( db, IdList[i], 0, &note))
				{
					// skip categories
				} else
				{
					// scan documents
					WORD lenFieldName = NSFItemGetText(note, 
													  (bUseLocal) ? _T("Destination") : _T("ServerName"), 
													  szFieldName, 
													  sizeof(szFieldName)); 
					strcpy_s(retServerNames[retServerCount++], MAXPATH, szFieldName);
					status = NSFNoteClose(note);
				}
			}
			OSUnlockObject(hBuffer);
            OSMemFree(hBuffer);
		}
	}

	if (status)
	{
		NIFCloseCollection(hCollection);
		NSFDbClose(db);
		return 0;
	}

	if (status = NIFCloseCollection(hCollection))
	{
		NSFDbClose(db);
		return 0;
	}

	if (status = NSFDbClose(db))
		return 0;

	return retServerCount;
}