Extension Manager - problem

HiI wrote extension manager add-in with c api. I registered EM_NSFNOTEUPDATE event handler. The code of handler is:

STATUS LNPUBLIC handler(EMRECORD far *data) {

    VARARG_PTR ap;

    NOTEHANDLE hNote;

	        

    if (EM_NSFNOTEUPDATE != data->EId)

            return (ERR_EM_CONTINUE);



ap = data->Ap;

hNote = VARARG_GET (ap, NOTEHANDLE);

[...]

hNote is NULLHANDLE after this. Why? This is running on linux 2.4 (slackware). I tried:

VARARG_COPY(ap, data->Ap);

before WARARG_GET but with the same result.

Subject: Extension Manager - problem

You need to check for EM_BEFORE or EM_AFTER. In this case, you should have

    if (EM_NSFNOTEUPDATE != data->EId)

            return (ERR_EM_CONTINUE);



   if (data->NotificationType == EM_BEFORE)

            return (ERR_EM_CONTINUE);



ap = data->Ap;

hNote = VARARG_GET (ap, NOTEHANDLE);

[...]

Subject: RE: Extension Manager - problem

I registered EM_BEFORE because I need a valid note handle. I’m checking data->NotificationType and it’s always EM_BEFORE. When I register handler as EM_AFTER, hNote is NULLHANDLE too.

Subject: RE: Extension Manager - problem

I’m sorry, I wrote it wrong anyway. You want the EM_BEFORE, but not the EM_AFTER. In any case, if you are getting an invalid handle, it must be a different issue.

The following is code I use that works:

case EM_NSFNOTEUPDATE:

case EM_NSFNOTEUPDATEXTENDED:

  if (pExRecord->Status != NOERROR)

    break;



  if (pExRecord->NotificationType == EM_AFTER)

    break;



  pArgs = pExRecord->Ap;

  hNote = VARARG_GET (pArgs, NOTEHANDLE);

  if (hNote == NULLHANDLE)

    return( ERR_EM_CONTINUE );



  /* Filtering for database, if there are any filters */

  NSFNoteGetInfo(hNote, _NOTE_DB, &hDB);



  sError = ProcessUpdateEvent(hDB, hNote, clientstr, web_server);

  if (sError == NOERROR)

    return (ERR_EM_CONTINUE);



  break;

but I have not actually used it in slackware Linux. The check for hnote == NULLHANDLE has always been in there because there are some spurious updates which you don’t want to trap. Are you sure that is not what you are seeing?

Subject: RE: Extension Manager - problem

Extension Manager calls handler corectly on each dokument update. All events are the same: STATUS == NOERROR and hNote == NULLHANDLE.

What is your operating system?

Subject: *Works the same on Windows, AIX, SUSE Linux