Event Generator and Event Handler

Hello all,

I am trying to create an event handler which will notify me everytime a user sends a mail message exceeding 10 MB. Is that possible? I have tried looking into the different options but none give me the possibility of specifying the message threshold.

Thank you.

Subject: Event Generator and Event Handler

I think you could use the extension manager with the function: EM_MAILSENDNOTE.

Subject: RE: Event Generator and Event Handler

Hi Mr Goudvis,

Thank you very much for your response. Could you please elaborate on the extenion manager method. If I understand correctly, it cannot be achieved using event generator??

Do I have to write code to be able to achieve this?

Thank you for your help.

Subject: RE: Event Generator and Event Handler

The extension manager allows you write, in C/C++, your own functions that will hook in a Notes function. It requires the C API toolkit. Here is a sample:

STATUS LNPUBLIC _export EMHandlerProc( EMRECORD FAR * theData )

{

VARARG_PTR  argPtr;

DBHANDLE    dbHandle;

STATUS      error; 

DBID	     dbID;

USHORT	     retMode;





argPtr = theData->Ap;



/* do nothing if there is an error. */

if ( theData->Status ) 

{

	goto EXIT;

} 





switch (theData->EId)

{

	

	case EM_NSFDBCLOSE:

	/*

	    if database is opened then clear the flag when the close 

             function is called on the database.

	*/

	if ( gGotMyDatabase == FALSE ) break;

		

	dbHandle = VARARG_GET( argPtr, DBHANDLE ); 



        if (theData->NotificationType == EM_BEFORE)

        {

	  if ( dbHandle ) 

	  {

	    NSFDbIDGet( dbHandle, &dbID );

	    if ( EQUAL_DBID(gtheID,dbID) ) 

	    {

                  gGotMyDatabase = FALSE;

	    }

	  }

        }

		break;

	



	case EM_NSFDBOPENEXTENDED:

	/* 

	    don't handle any of the hooks until my database is opened,

	    and be sure to ignore the hooks when my database is closed.

	*/ 

		

	if ( gGotMyDatabase == TRUE ) break;

		

		

	VARARG_GET( argPtr, char FAR * ); 

	VARARG_GET( argPtr, WORD );

	VARARG_GET( argPtr, HANDLE ); 

	VARARG_GET( argPtr, TIMEDATE FAR * ); 

	dbHandle = *( DBHANDLE FAR * )VARARG_GET( argPtr, DBHANDLE FAR *);

	

        if (theData->NotificationType == EM_BEFORE)

        {	

	  if ( dbHandle )

	  {

		/* check to see if i got a db handle! */

		error = NSFDbModeGet( dbHandle, &retMode );

		if ( !error && (retMode & DB_LOADED) )

		{ 

			NSFDbIDGet( dbHandle, &dbID );

			if ( EQUAL_DBID(gtheID,dbID) )

			{

				gGotMyDatabase = TRUE;

			}

		}

	  }

        }  

	break;

		

} /* END SWITCH */

 	

/* 

   if being notified before then always continue onward ignoring 

      the error if not it is possible to return a status code to 

      change the program flow.

*/

EXIT:

if ( theData && theData->NotificationType == EM_BEFORE )

	return( ERR_EM_CONTINUE );

else

	return( theData->Status );

}

Subject: RE: Event Generator and Event Handler

Dear Mr Goudvis,

Thank you for your response. I will try to look into the code. It seems awfully complicated :frowning:

Thank you for your help.