Sub pop_ListCompleted (Success As Boolean, Messages As Map)
Log("list completed")
If Success Then
If Messages.Size > 0 Then
LogMessage("Found messages: " & Messages.Size)
For Each id As Int In Messages.Keys
pop.DownloadMessage(id, deleteMsg) 'if true message will be deleted from the server
Next
lastMsgId = id
Else
Log("No messages.")
End If
Else
LogMessage("Error: " & LastException)
End If
pop.Close 'this will close the connection after the messages were downloaded.
End Sub