Is it a deletion Stub using C/C++ API

Hey Guys

I am trying to “catch” a inbound document deletion stub via nreplica with my extension manager API code.

The code I have is firing correctly when the server replicates & updated docs. are inbound to the server addin exchange manager I have developed

What I cant get my head around is what indicates that a note has been deleted.

In the sample the tracker code has this snippet

    if (UpdateFlags & UPDATE_DELETED)

    {

        fprintf(pTraceFile[inst-1], "Adding a deletion stub to database.\n");

        goto Exit;

    }

UPDATE_DELETED is defined in the document regarding UPDATE_xxx - Flags to control how a note is updated or deleted.

I have searched the API database & cant find any reference to deletion stub.

In this post

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/2715b9e55f3292668525729000359f21?OpenDocument

They are talking about deletion stubs & I have found other similar posts.

But no example of how to extract the unid of the deletion stub.

Does any one have any ideas ?

TIA

NG

Subject: Is it a deletion Stub using C/C++ API

I use this constant:

Const RRV_DELETED = &H80000000

and XOR it with the NoteID to get the actual noteid.

Subject: RE: Is it a deletion Stub using C/C++ API

Hey Rob

Thxs for the prompt reply :slight_smile:

I have read about this constant: Const RRV_DELETED = &H80000000, but I thought I had to write a DBHOOKVEC - Hook Driver Vector to make use of this.

In the document

/* Note add/update hook, also handles deletion. Called before a note is updated. */

STATUS (LNCALLBACKPTR NoteUpdate)(

          struct dbhookvec far *vec,

          char far *UserName,

          LIST far *GroupList,

          DBHANDLE hDB,

          NOTEID NoteID,

          NOTEHANDLE hNote,

          WORD far *UpdateFlags);

Apparently UpdateFlags indicates that the note is deleted.

I dont want to write a Hook, If I understand what you are saying I can continue to use the Extension Manager .exe /. dll I have already developed ?

Plus I need to extract the UNID of the in-bound “deletion stub.”, do you know how to do this ?

I have read in the API DB doco. but there only example is using DBHOOKVEC - Hook Driver Vector not Ext. Mgr.

TIA

NG

Subject: RE: Is it a deletion Stub using C/C++ API

Hi NG,

I cannot find the documentation you are referring to. Where did you find this? I have looked in my C API and C++ API help db’s.

I do not see any reason why you could not use the extension manager you are already using.

If I understand you correctly, the only thing you like to achieve is to find out if an obtained noteid refers to a deleted note. True?

Subject: RE: Is it a deletion Stub using C/C++ API

Hey Rob

I cannot find the documentation you are referring to. Where did you find this? I have looked in my C API and C++ API help db’s.

[NG] In this database → Lotus C API Notes/Domino 6.5.6 Reference

[NG] In the All \ Alphabetical - view

[NG] The - DBHOOKVEC - Hook Driver Vector document.

[NG] This document says - See Sample Program :

[NG] ADMIN\TRACKER

[NG] In tracker I can see “how” to catch a deletion stub, but this is not using Ext. Mgr. it is using a Hook Drive Vector :frowning:

[NG] I found this document after a FT search of the DB for “deletion stub”

[NG] This is also how I found RRV_xxx

I do not see any reason why you could not use the extension manager you are already using. If I understand you correctly, the only thing you like to achieve is to find out if an obtained noteid refers to a deleted note. True?

[NG] Almost, I want to know if it is a deletion stub & the UNID of this Document.

[NG] I have read in the forum that you can get the UNID but no example of how to do this :frowning:

[NG] Have you done this ?

[NG] If you have can I see a snippet as I have gone around & around completely lost with this !!!

TIA

NG

Subject: RE: Is it a deletion Stub using C/C++ API

Hi NG,

I found the documentation; thanks.

There is no direct way to get the noteid. Normally you have a collection of documents that you walk through. The collection is a list of noteid’s. There are of course many collections, e.g. in a view, unprocesseddocuments, unread marks, etc.

What trigger do you use to know which document(s) to handle? Or better: what collection are you using? Can you show me this part of your code?

Subject: RE: Is it a deletion Stub using C/C++ API

Hi Rob

I am glad you have been able to find the doco - that helps my creability :slight_smile:

In my code I register for “updates of document” with

EM_NSFNOTEUPDATE & EM_NSFNOTEUPDATEXTENDED

In my EM code I have a “debug” message -

if ( note_id & RRV_DELETED )

{

sprintf( szDebugMsg, "After - This document is a deletion stub - UNID - %s" , szCurrentUNID );

WriteDebugMessage( szDebugMsg );

}

Immediately below this code I have

if ( CheckModuleName ( NOTES_REPLICA_EXE ) )

{

WriteDebugMessage( "After - Replicator - nreplica.exe" );

szServerAddin = "Replicator - nreplica.exe";

}

To test this code I replicate with a server which has a document I just deleted “deletion stub” in the names.nsf.

I see the message

“After - Replicator - nreplica.exe”

in my debug.log text file

But I dont have the text

After - This document is a deletion stub - UNID - …

So I am not using a collection.

I am triggering on update to docs & checking if it is due to replicator which is working fine.

So my question is - How do I determine that a document is a deletion stub ?

TIA

NG

Subject: RE: Is it a deletion Stub using C/C++ API

I think this statement:

if ( note_id & RRV_DELETED )

should read:

if (( note_id & RRV_DELETED ) == RRV_DELETED )

Please bear in mind that the deletion-bit is the leftmost bit, thus indicating a negative value.

Subject: RE: Is it a deletion Stub using C/C++ API

Hey Rob

Sorry to take so long to get back with a response but I have been trying all kinds of things to try to get this to work.

Yes sorry :slight_smile:

You are completely correct I posted in code from my “test” program.

I have already tried

if (( note_id & RRV_DELETED ) == RRV_DELETED )

But still no joy finding out if a document is a deletion stub :frowning:

I am starting to think that possibly I am not getting the note_id correctly ???

I get the note_id

/* retrieve note id */

NSFNoteGetInfo (pNoteData->hNote, _NOTE_ID, &pNoteData->note_id);

The only way I can determine that a doc. is deleted is with this code

if (error = NSFDbGetNoteInfo (

	ndSource.hDb ,  

	ndSource.note_id , // note_unid, 

	&NoteOID, 

	&lastmod_td, 

	&note_class

	)

	)

{

sprintf ( szDebugMsg, "NSFDbGetNoteInfo - failed" );

WriteDebugMessage ( szDebugMsg );



     OSLoadString (0, ERR(error), szErrorMsg, 255);

sprintf ( szDebugMsg , "Error from NSFDbGetNoteInfo: '%s' " , szErrorMsg );

WriteDebugMessage( szDebugMsg );

AddInLogMessageText( szDebugMsg ,NOERROR );	



if ( strcmp ( szErrorMsg , "Invalid or nonexistent document" ) == 0 )

{

	return FALSE;

}

}

But this code only works in registrations for “After” not “Before”.

Any other ideas ?

NG