Private Function checkIp(section As String, ip As String, doc As NotesDocument) As Boolean
Dim dtNow As NotesDateTime
Set dtNow = New NotesDateTime(CStr(Now))
Dim fieldName As String
fieldName = "ip_"+section
Dim ipList As Variant
With doc
ipList = .Getitemvalue(fieldName)
If ipList(0) = "" then
Call .Replaceitemvalue(fieldName, CStr(dtNow.LSLocalTime)+"~"+ip)
Else
Dim i As Integer
i = UBound(ipList)
If i>900 Then i=900
Dim a() As String
ReDim a(i+1)
Dim j As Integer
j = i
While j>=0
Dim dtString As String
dtString = StrLeftBack$(ipList(j),"~")
Dim dt As NotesDateTime
Set dt = New NotesDateTime(dtString)
If dtNow.TimeDifference(dt)>1800 Then
j=-1
Else
a(j) = ipList(j)
Dim flag As Boolean
If StrRightBack$(ipList(j),"~") = ip Then flag = True
j=j-1
End If
Wend
If Not flag Then
a(i+1) = CStr(dtNow.LSLocalTime)+"~"+ip
End If
Dim ta As Variant
ta = FullTrim(a)
Call .Replaceitemvalue(fieldName, ta)
End If
End With
If Not flag Then checkIp = true
End Function