wodPop3Server ActiveX Control - UpdateMailbox Method
      
 

Description

Called when application needs to update contents of mailbox.


Return Type

None  


Syntax

object.UpdateMailbox Owner, User



The UpdateMailbox Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodPop3Notify.
Owner  A wodPop3ServerCom object. Reference to wodPop3ServerCom instance that called this callback method.
User  A Pop3User object. Reference to user whose mailbox contents needs to be updated.

Remarks

NOTE: This method is called only if you implemented IwodPop3Notify interface in your application, and wodPop3Server1.Notification property has received reference to instance of your implementation.

Just before user will disconnect from your server, you need to update his mailbox changes made in the session so next time his mailbox is synced with his changes. For instance, when user reads and downloads messages from the server he will usually mark them to be deleted so he doesn't need to download them again (and again and again...). For this purpose, UpdateMailbox notification method is called so you can make these changes.

Most changes are related directly to Deleted property. You should make a loop and check each user's message and test if Deleted property is set to True. If so, you should delete it from local storage.

This is rather easy task if you keep each mail in separate file. But, if you have one mailbox per user, and keep all his messages in one file (UNIX systems do this) then you have more work to do. Maybe you should try to keep external file with 'message positions' inside of it, so you know where each message starts and where each message ends. Using such file, it will be easier for you to setup StartPosition and EndPosition properties needed during Connected notification method, and will be easier to remove messages from mailbox file.
If you don't have such file, you can still use already setup (you did that!) StartPosition and EndPosition properties, because wodPop3Server didn't change those values. If you calculated them for Connected notification method, they are still valid.

So, to test if message is deleted or not, simple loop like this will help:

    For i = 0 To User.Messages.Count - 1
         If User.Messages(i).Deleted = True Then
            Kill MessagePath & "\message." & i
         End If
    Next i