I have an extension manager that has EM_NSFNOTEUPDATEXTENDED to handle delete notifications. It’s registered for EM_BEFORE. I am able to process delete notifications perfectly fine if the user deletes a message from the inbox. But if the user opens the message and then hits the delete button it does generate a delete notification but the document properties are emtpy. I need to process deletes for only those messages that has a certain word in the subject. What am I doing wrong?Here’s a snippet of my code.
STATUS LNCALLBACK ExtMgrCallback (EMRECORD* pExtRec)
{
STATUS err = NOERROR;
VARARG_PTR varptr = pExtRec->Ap;
EventData eventData;
memset(&eventData, 0, sizeof(eventData));
eventData.currentStatus = pExtRec->Status;
eventData.newStatus = ERR_EM_CONTINUE; // by default we continue the event.
eventData.eventId = pExtRec->EId;
eventData.isPreEvent = (pExtRec->NotificationType == EM_BEFORE);
eventData.noteClass = NOTE_CLASS_ALL;
STATUS error = NOERROR;
bool IsAddOperation;
char DbTitle[MAXPATH+1];
char Dbinfo[NSF_INFO_SIZE];
char DMsgId[512];
char Username[MAXUSERNAME+1];
WORD field_len;
switch (eventData.eventId)
{
case EM_NSFNOTEUPDATEXTENDED:
eventData.hNote = VARARG_GET(varptr, NOTEHANDLE);
eventData.updateFlags = VARARG_GET(varptr, DWORD);
if (eventData.updateFlags & UPDATE_DELETED)
{
if (eventData.hNote)
{
if(NSFItemIsPresent (eventData.hNote,"Subject",strlen ("Subject")));
{
if (eventData.hDb == NULLHANDLE)
{
NSFNoteGetInfo(eventData.hNote,_NOTE_DB, &eventData.hDb);
}
field_len = NSFItemGetText(eventData.hNote,"Subject",subject, sizeof (subject));
//Subject is empty if the message is deleted //after opening the message
ConsoleOut(subject);
}