NotesUser Activity Class

The NotesUserActivity Class is a customizable LotusScript library that returns database user activity summary information. The usage statistics for the prior day, week, and month since user activity recording began is provided. The number of documents a user or server has read, added, updated or deleted during each session, with the most recent activity first, is returned.

The class returns information that is available from the Notes user interface via the File/Database/Properties menu item, Information tab, Activity section, User Detail button selection. User activity for the specified database must be enabled for this function to work .

The class was created by Alex Elliott of AGECOM (http://www.agecom.com.au). Unfortunately it was only availabe for Windows.

I tried to write a Linux port, but I only had a partial success. The code runs without any issues on Windows.

It also runs fine on a Domino V11 Beta1 server on Linux ( CentOS). But it constantly crashes on Domino 10.0.1 ( with or without FP ) on RHEL.

The crash occurs, when the code tries to get the UserName from the ActivityEntry.

pActivityEntry = puActivity + lEntry * 28
		
CopyMemory dt.Innards(0), pActivityEntry , LEN_DWORD
CopyMemory dt.Innards(1), pActivityEntry + 4 , LEN_DWORD
CopyMemory reads, pActivityEntry + 8 , LEN_WORD
CopyMemory adds, pActivityEntry + 10 , LEN_WORD
CopyMemory updates, pActivityEntry + 12 , LEN_WORD
CopyMemory deletes, pActivityEntry + 14 , LEN_WORD
CopyMemory nonDataReads, pActivityEntry + 16 , LEN_WORD
CopyMemory nonDataAdds, pActivityEntry + 18 , LEN_WORD
CopyMemory nonDataUpdates, pActivityEntry + 20 , LEN_WORD
CopyMemory nonDataDeletes, pActivityEntry + 22 , LEN_WORD
CopyMemory nameOffset, pActivityEntry + 24 , LEN_DWORD		

Dim spUsername As String * MAXUSERNAME
spUsername = Space(MAXUSERNAME)

CopyMemoryString spUsername, puActivity + nameOffset, MAXUSERNAME - 2

Dim sUserName As String
sUserName = Trim(spUsername)

CopyMemory and CopyMemoryString are declared as

Declare Sub TUX_CopyMemory Lib "libc.so.6" Alias "memcpy" _
(hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)

Declare Sub TUX_CopyMemoryString Lib "libc.so.6" Alias "memcpy" _
(ByVal hpvDest As LMBCS String, ByVal hpvSource As Long, ByVal cbCopy As Long)

I tried using undocumented method “Cmovmem” from libnotes.so but it also crashes on V10 AND V11. I must admit that I do not really know, how to use Cmovmem. I declared it this way:

Declare Sub CopyMemoryString Lib LIB_TUX Alias "Cmovmem"  _
(Byval lpSrc As Long, Byval lpDest As String, Byval lSize As Long)

You can find the code here.

Any help to get it working on V10 for Linux is appreciated.