Merge contribution from vfportero
This commit is contained in:
commit
01ee994424
2 changed files with 223 additions and 143 deletions
|
@ -58,6 +58,13 @@ namespace WebsitePanel.Providers.Mail
|
||||||
{
|
{
|
||||||
return (maxMailboxSize < 0);
|
return (maxMailboxSize < 0);
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
maxMailboxSize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReplyTo
|
public string ReplyTo
|
||||||
|
|
|
@ -44,19 +44,19 @@ Public Class Merak
|
||||||
Const DOMAIN_PROGID As String = "IceWarpServer.DomainObject"
|
Const DOMAIN_PROGID As String = "IceWarpServer.DomainObject"
|
||||||
Const ACCOUNT_PROGID As String = "IceWarpServer.AccountObject"
|
Const ACCOUNT_PROGID As String = "IceWarpServer.AccountObject"
|
||||||
|
|
||||||
Friend ReadOnly Property AccountType As MailType
|
Friend ReadOnly Property AccountType As MailType
|
||||||
Get
|
Get
|
||||||
Dim mType As MailType = MailType.POP
|
Dim mType As MailType = MailType.POP
|
||||||
|
|
||||||
Try
|
Try
|
||||||
mType = CType(ProviderSettings("ServerAccountType"), MailType)
|
mType = CType(ProviderSettings("ServerAccountType"), MailType)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return mType
|
Return mType
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private Function GetDomainName(ByVal email As String) As String
|
Private Function GetDomainName(ByVal email As String) As String
|
||||||
Return email.Substring((email.IndexOf("@"c) + 1))
|
Return email.Substring((email.IndexOf("@"c) + 1))
|
||||||
|
@ -85,22 +85,22 @@ Public Class Merak
|
||||||
Get
|
Get
|
||||||
Dim apiObject = CreateObject(API_PROGID)
|
Dim apiObject = CreateObject(API_PROGID)
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Return CStr(apiObject.GetProperty(MerakInterop.C_System_Storage_Dir_MailPath))
|
Return CStr(apiObject.GetProperty(MerakInterop.C_System_Storage_Dir_MailPath))
|
||||||
Catch ex1 As Exception
|
Catch ex1 As Exception
|
||||||
'Log.WriteError(ex1)
|
'Log.WriteError(ex1)
|
||||||
Try
|
Try
|
||||||
Return CStr(apiObject.GetProperty(MerakInterop.C_MailPath))
|
Return CStr(apiObject.GetProperty(MerakInterop.C_MailPath))
|
||||||
Catch ex2 As Exception
|
Catch ex2 As Exception
|
||||||
'Log.WriteError(ex2)
|
'Log.WriteError(ex2)
|
||||||
Try
|
Try
|
||||||
Return CStr(apiObject.GetProperty(MerakInterop.C_XMailPath))
|
Return CStr(apiObject.GetProperty(MerakInterop.C_XMailPath))
|
||||||
Catch ex3 As Exception
|
Catch ex3 As Exception
|
||||||
Log.WriteError(ex3)
|
Log.WriteError(ex3)
|
||||||
Throw New Exception("Couldn't obtain mail folder path (version compatibility issue).", ex3)
|
Throw New Exception("Couldn't obtain mail folder path (version compatibility issue).", ex3)
|
||||||
End Try
|
End Try
|
||||||
End Try
|
End Try
|
||||||
End Try
|
End Try
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
@ -150,31 +150,31 @@ Public Class Merak
|
||||||
|
|
||||||
Public Overridable Function DomainExists(ByVal domainName As String) As Boolean Implements IMailServer.DomainExists
|
Public Overridable Function DomainExists(ByVal domainName As String) As Boolean Implements IMailServer.DomainExists
|
||||||
Return Not (OpenDomain(domainName) Is Nothing)
|
Return Not (OpenDomain(domainName) Is Nothing)
|
||||||
End Function 'DomainExists
|
End Function 'DomainExists
|
||||||
|
|
||||||
Public Overridable Function GetDomains() As String() Implements IMailServer.GetDomains
|
Public Overridable Function GetDomains() As String() Implements IMailServer.GetDomains
|
||||||
Dim apiObject = CreateObject(API_PROGID)
|
Dim apiObject = CreateObject(API_PROGID)
|
||||||
|
|
||||||
Dim domainList As String = apiObject.GetDomainList()
|
Dim domainList As String = apiObject.GetDomainList()
|
||||||
|
|
||||||
Dim domains As New List(Of String)
|
Dim domains As New List(Of String)
|
||||||
|
|
||||||
Dim indexOf As Integer = domainList.IndexOf(";")
|
Dim indexOf As Integer = domainList.IndexOf(";")
|
||||||
|
|
||||||
While (indexOf > -1)
|
While (indexOf > -1)
|
||||||
Dim domain As String = domainList.Substring(0, indexOf)
|
Dim domain As String = domainList.Substring(0, indexOf)
|
||||||
|
|
||||||
If Not String.IsNullOrEmpty(domain) Then
|
If Not String.IsNullOrEmpty(domain) Then
|
||||||
domains.Add(domain.Trim())
|
domains.Add(domain.Trim())
|
||||||
End If
|
End If
|
||||||
|
|
||||||
domainList = domainList.Substring(indexOf + 1)
|
domainList = domainList.Substring(indexOf + 1)
|
||||||
|
|
||||||
indexOf = domainList.IndexOf(";")
|
indexOf = domainList.IndexOf(";")
|
||||||
End While
|
End While
|
||||||
|
|
||||||
Return domains.ToArray()
|
Return domains.ToArray()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Overridable Function GetDomain(ByVal domainName As String) As MailDomain Implements IMailServer.GetDomain
|
Public Overridable Function GetDomain(ByVal domainName As String) As MailDomain Implements IMailServer.GetDomain
|
||||||
CheckIfDomainExists(domainName)
|
CheckIfDomainExists(domainName)
|
||||||
|
@ -185,9 +185,12 @@ Public Class Merak
|
||||||
|
|
||||||
domainItem.Name = domainObjectClass.Name
|
domainItem.Name = domainObjectClass.Name
|
||||||
domainItem.PostmasterAccount = GetEmailAlias(CStr(domainObjectClass.GetProperty("D_AdminEmail")))
|
domainItem.PostmasterAccount = GetEmailAlias(CStr(domainObjectClass.GetProperty("D_AdminEmail")))
|
||||||
domainItem.CatchAllAccount = GetEmailAlias(CStr(domainObjectClass.GetProperty("D_UnknownForwardTo")))
|
domainItem.CatchAllAccount = GetEmailAlias(CStr(domainObjectClass.GetProperty("D_UnknownForwardTo")))
|
||||||
domainItem.AbuseAccount = ""
|
domainItem.AbuseAccount = ""
|
||||||
|
|
||||||
|
domainItem.Enabled = CInt(domainObjectClass.GetProperty("D_DisableLogin")) = 0
|
||||||
|
domainItem.MaxMailboxSizeInMB = CInt(domainObjectClass.GetProperty("D_UserMailbox")) / 1024
|
||||||
|
|
||||||
'Dim abuseEmail As String = "abuse@" + domainName
|
'Dim abuseEmail As String = "abuse@" + domainName
|
||||||
|
|
||||||
'If MailboxExists(abuseEmail) Then
|
'If MailboxExists(abuseEmail) Then
|
||||||
|
@ -245,34 +248,36 @@ Public Class Merak
|
||||||
domainObject.SetProperty("D_UnknownForwardTo", domain.CatchAllAccount & "@" & domain.Name)
|
domainObject.SetProperty("D_UnknownForwardTo", domain.CatchAllAccount & "@" & domain.Name)
|
||||||
domainObject.SetProperty("D_UnknownUsersType", 1)
|
domainObject.SetProperty("D_UnknownUsersType", 1)
|
||||||
'domainObject.SetProperty(MerakInterop.D_UnknownForwardTo, 1)
|
'domainObject.SetProperty(MerakInterop.D_UnknownForwardTo, 1)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' enable user limits
|
' enable user limits
|
||||||
Dim apiObject = CreateObject(API_PROGID)
|
Dim apiObject = CreateObject(API_PROGID)
|
||||||
apiObject.SetProperty(MerakInterop.C_Config_UseDomainLimits, 1)
|
apiObject.SetProperty(MerakInterop.C_Config_UseDomainLimits, 1)
|
||||||
|
|
||||||
domainObject.SetProperty(MerakInterop.D_DisableLogin, IIf(domain.Enabled, 0, 1))
|
domainObject.SetProperty(MerakInterop.D_DisableLogin, IIf(domain.Enabled, 0, 1))
|
||||||
|
domainObject.SetProperty("D_UserMailbox", domain.MaxMailboxSizeInMB * 1024)
|
||||||
|
|
||||||
'create abuse account mailbox
|
|
||||||
'If Not Utils.IsStringNullOrEmpty(domain.AbuseAccount, True) Then
|
|
||||||
' Dim abuseName As String = "abuse@" + domain.Name
|
|
||||||
|
|
||||||
' Dim mailbox As New MailAccount
|
'create abuse account mailbox
|
||||||
' mailbox.Name = abuseName
|
'If Not Utils.IsStringNullOrEmpty(domain.AbuseAccount, True) Then
|
||||||
' mailbox.Enabled = True
|
' Dim abuseName As String = "abuse@" + domain.Name
|
||||||
|
|
||||||
' If String.Compare(domain.AbuseAccount, abuseName, False) <> 0 Then
|
' Dim mailbox As New MailAccount
|
||||||
' 'done redirect to itself
|
' mailbox.Name = abuseName
|
||||||
' mailbox.ForwardingAddresses = New String() {domain.AbuseAccount}
|
' mailbox.Enabled = True
|
||||||
' End If
|
|
||||||
' If Not MailboxExists(abuseName) Then
|
' If String.Compare(domain.AbuseAccount, abuseName, False) <> 0 Then
|
||||||
' CreateMailbox(mailbox)
|
' 'done redirect to itself
|
||||||
' Else
|
' mailbox.ForwardingAddresses = New String() {domain.AbuseAccount}
|
||||||
' UpdateMailbox(mailbox)
|
' End If
|
||||||
' End If
|
' If Not MailboxExists(abuseName) Then
|
||||||
'End If
|
' CreateMailbox(mailbox)
|
||||||
SaveDomain(domainObject)
|
' Else
|
||||||
End Sub 'UpdateDomain
|
' UpdateMailbox(mailbox)
|
||||||
|
' End If
|
||||||
|
'End If
|
||||||
|
SaveDomain(domainObject)
|
||||||
|
End Sub 'UpdateDomain
|
||||||
|
|
||||||
Public Overridable Sub DeleteDomain(ByVal domainName As String) Implements IMailServer.DeleteDomain
|
Public Overridable Sub DeleteDomain(ByVal domainName As String) Implements IMailServer.DeleteDomain
|
||||||
CheckIfDomainExists(domainName)
|
CheckIfDomainExists(domainName)
|
||||||
|
@ -287,15 +292,15 @@ Public Class Merak
|
||||||
Implements IMailServer.DomainAliasExists
|
Implements IMailServer.DomainAliasExists
|
||||||
If DomainExists(aliasName) Then
|
If DomainExists(aliasName) Then
|
||||||
Dim domainObject = OpenDomain(aliasName)
|
Dim domainObject = OpenDomain(aliasName)
|
||||||
If CInt(domainObject.GetProperty(MerakInterop.D_Type)) = 2 And String.Compare(CStr(domainObject.GetProperty(MerakInterop.D_DomainValue)), domainName, False) = 0 Then
|
If CInt(domainObject.GetProperty(MerakInterop.D_Type)) = 2 And String.Compare(CStr(domainObject.GetProperty(MerakInterop.D_DomainValue)), domainName, False) = 0 Then
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Return False
|
Return False
|
||||||
End Function 'DomainAliasExists
|
End Function 'DomainAliasExists
|
||||||
|
|
||||||
Public Overridable Function GetDomainAliases(ByVal domainName As String) As String() Implements IMailServer.GetDomainAliases
|
Public Overridable Function GetDomainAliases(ByVal domainName As String) As String() Implements IMailServer.GetDomainAliases
|
||||||
Dim domainNameCollection As New List(Of String)
|
Dim domainNameCollection As New List(Of String)
|
||||||
Dim numberOfDomains As Integer = GetNumberOfDomains()
|
Dim numberOfDomains As Integer = GetNumberOfDomains()
|
||||||
|
|
||||||
Dim apiObject = CreateObject(API_PROGID)
|
Dim apiObject = CreateObject(API_PROGID)
|
||||||
|
@ -307,7 +312,7 @@ Public Class Merak
|
||||||
domainNameCollection.Add(aliasName)
|
domainNameCollection.Add(aliasName)
|
||||||
End If
|
End If
|
||||||
Next i
|
Next i
|
||||||
Return domainNameCollection.ToArray()
|
Return domainNameCollection.ToArray()
|
||||||
End Function 'GetDomainAliases
|
End Function 'GetDomainAliases
|
||||||
|
|
||||||
Public Overridable Sub AddDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.AddDomainAlias
|
Public Overridable Sub AddDomainAlias(ByVal domainName As String, ByVal aliasName As String) Implements IMailServer.AddDomainAlias
|
||||||
|
@ -316,7 +321,7 @@ Public Class Merak
|
||||||
CreateDomain(MailDomain)
|
CreateDomain(MailDomain)
|
||||||
Dim domainObject = OpenDomain(aliasName)
|
Dim domainObject = OpenDomain(aliasName)
|
||||||
domainObject.SetProperty(MerakInterop.D_Type, 2)
|
domainObject.SetProperty(MerakInterop.D_Type, 2)
|
||||||
domainObject.SetProperty(MerakInterop.D_DomainValue, domainName)
|
domainObject.SetProperty(MerakInterop.D_DomainValue, domainName)
|
||||||
SaveDomain(domainObject)
|
SaveDomain(domainObject)
|
||||||
End Sub 'AddDomainAlias
|
End Sub 'AddDomainAlias
|
||||||
|
|
||||||
|
@ -329,13 +334,13 @@ Public Class Merak
|
||||||
Public Overridable Function AccountExists(ByVal mailboxName As String) As Boolean Implements IMailServer.AccountExists
|
Public Overridable Function AccountExists(ByVal mailboxName As String) As Boolean Implements IMailServer.AccountExists
|
||||||
Dim accountObject = CreateObject(ACCOUNT_PROGID)
|
Dim accountObject = CreateObject(ACCOUNT_PROGID)
|
||||||
|
|
||||||
If Not accountObject.Open(mailboxName) Or MerakInterop.GetIntSettingValue(CStr(accountObject.GetProperty(MerakInterop.U_Type))) <> 0 Or String.Compare(CStr(accountObject.GetProperty("U_Comment")), GroupIdentifier, False) = 0 Then
|
If Not accountObject.Open(mailboxName) Or MerakInterop.GetIntSettingValue(CStr(accountObject.GetProperty(MerakInterop.U_Type))) <> 0 Or String.Compare(CStr(accountObject.GetProperty("U_Comment")), GroupIdentifier, False) = 0 Then
|
||||||
'maillist?
|
'maillist?
|
||||||
'group?
|
'group?
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
End Function 'MailboxExists
|
End Function 'MailboxExists
|
||||||
|
|
||||||
Public Overridable Function GetAccounts(ByVal domainName As String) As MailAccount() Implements IMailServer.GetAccounts
|
Public Overridable Function GetAccounts(ByVal domainName As String) As MailAccount() Implements IMailServer.GetAccounts
|
||||||
|
@ -435,8 +440,8 @@ ContinueFor1:
|
||||||
Dim accountObject = CreateObject(ACCOUNT_PROGID)
|
Dim accountObject = CreateObject(ACCOUNT_PROGID)
|
||||||
accountObject.[New](mailbox.Name)
|
accountObject.[New](mailbox.Name)
|
||||||
|
|
||||||
' Account type
|
' Account type
|
||||||
accountObject.SetProperty(MerakInterop.U_AccountType, AccountType)
|
accountObject.SetProperty(MerakInterop.U_AccountType, AccountType)
|
||||||
|
|
||||||
SaveMailbox(accountObject)
|
SaveMailbox(accountObject)
|
||||||
|
|
||||||
|
@ -1136,33 +1141,33 @@ ContinueFor1:
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim fs As FileStream = File.Open(filePath, FileMode.OpenOrCreate)
|
Dim fs As FileStream = File.Open(filePath, FileMode.OpenOrCreate)
|
||||||
'clean all old members
|
'clean all old members
|
||||||
Try
|
Try
|
||||||
fs.SetLength(0)
|
fs.SetLength(0)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Log.WriteError(String.Format("Error deleting old mail list memebers for '{0}' mail list", groupName), ex)
|
Log.WriteError(String.Format("Error deleting old mail list memebers for '{0}' mail list", groupName), ex)
|
||||||
Finally
|
Finally
|
||||||
fs.Close()
|
fs.Close()
|
||||||
End Try
|
End Try
|
||||||
'reopen file for new members
|
'reopen file for new members
|
||||||
fs = File.Open(filePath, FileMode.OpenOrCreate)
|
fs = File.Open(filePath, FileMode.OpenOrCreate)
|
||||||
Try
|
Try
|
||||||
Dim sw As New StreamWriter(fs)
|
Dim sw As New StreamWriter(fs)
|
||||||
Try
|
Try
|
||||||
Dim str As String
|
Dim str As String
|
||||||
For Each str In members
|
For Each str In members
|
||||||
sw.WriteLine(str)
|
sw.WriteLine(str)
|
||||||
Next str
|
Next str
|
||||||
sw.Flush()
|
sw.Flush()
|
||||||
sw.Close()
|
sw.Close()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Log.WriteError(String.Format("Unable to update new mail group members for '{0}' group", groupName), ex)
|
Log.WriteError(String.Format("Unable to update new mail group members for '{0}' group", groupName), ex)
|
||||||
Finally
|
Finally
|
||||||
sw.Close()
|
sw.Close()
|
||||||
End Try
|
End Try
|
||||||
Finally
|
Finally
|
||||||
fs.Close()
|
fs.Close()
|
||||||
End Try
|
End Try
|
||||||
End Sub 'UpdateMaillistMembers
|
End Sub 'UpdateMaillistMembers
|
||||||
|
|
||||||
|
|
||||||
|
@ -1175,33 +1180,33 @@ ContinueFor1:
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim fs As FileStream = File.Open(filePath, FileMode.OpenOrCreate)
|
Dim fs As FileStream = File.Open(filePath, FileMode.OpenOrCreate)
|
||||||
'clean all old members
|
'clean all old members
|
||||||
Try
|
Try
|
||||||
fs.SetLength(0)
|
fs.SetLength(0)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Log.WriteError(String.Format("Error deleting old mail list members for '{0}' mail list", listName), ex)
|
Log.WriteError(String.Format("Error deleting old mail list members for '{0}' mail list", listName), ex)
|
||||||
Finally
|
Finally
|
||||||
fs.Close()
|
fs.Close()
|
||||||
End Try
|
End Try
|
||||||
'reopen file for new members
|
'reopen file for new members
|
||||||
fs = File.Open(filePath, FileMode.OpenOrCreate)
|
fs = File.Open(filePath, FileMode.OpenOrCreate)
|
||||||
Try
|
Try
|
||||||
Dim sw As New StreamWriter(fs)
|
Dim sw As New StreamWriter(fs)
|
||||||
Try
|
Try
|
||||||
Dim str As String
|
Dim str As String
|
||||||
For Each str In members
|
For Each str In members
|
||||||
sw.WriteLine(str)
|
sw.WriteLine(str)
|
||||||
Next str
|
Next str
|
||||||
sw.Flush()
|
sw.Flush()
|
||||||
sw.Close()
|
sw.Close()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Log.WriteError(String.Format("Unable to update new mail list memebers for '{0}' mail list", listName), ex)
|
Log.WriteError(String.Format("Unable to update new mail list memebers for '{0}' mail list", listName), ex)
|
||||||
Finally
|
Finally
|
||||||
sw.Close()
|
sw.Close()
|
||||||
End Try
|
End Try
|
||||||
Finally
|
Finally
|
||||||
fs.Close()
|
fs.Close()
|
||||||
End Try
|
End Try
|
||||||
End Sub 'UpdateMaillistMembers
|
End Sub 'UpdateMaillistMembers
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
@ -1234,6 +1239,76 @@ ContinueFor1:
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Overrides Function GetServiceItemsBandwidth(items() As ServiceProviderItem, since As Date) As ServiceProviderItemBandwidth()
|
||||||
|
Dim itemsBandwidth As List(Of ServiceProviderItemBandwidth) = New List(Of ServiceProviderItemBandwidth)
|
||||||
|
Dim item As ServiceProviderItem
|
||||||
|
|
||||||
|
For Each item In items
|
||||||
|
If TypeOf item Is MailAccount Then
|
||||||
|
Dim name As String = item.Name
|
||||||
|
|
||||||
|
Dim bandwidth As New ServiceProviderItemBandwidth()
|
||||||
|
|
||||||
|
bandwidth.ItemId = item.Id
|
||||||
|
bandwidth.Days = GetDailyStatistics(since, name)
|
||||||
|
|
||||||
|
itemsBandwidth.Add(bandwidth)
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next item
|
||||||
|
Return itemsBandwidth.ToArray()
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GetDailyStatistics(since As Date, mailAccount As String) As DailyStatistics()
|
||||||
|
Dim days As List(Of DailyStatistics) = New List(Of DailyStatistics)
|
||||||
|
|
||||||
|
|
||||||
|
Dim currentDate As DateTime = since
|
||||||
|
Dim now As DateTime = DateTime.Now
|
||||||
|
|
||||||
|
|
||||||
|
While currentDate < now
|
||||||
|
days.Add(GetSingleDayBandwidthStatistics(currentDate, mailAccount))
|
||||||
|
|
||||||
|
' advance day
|
||||||
|
currentDate = currentDate.AddDays(1)
|
||||||
|
End While
|
||||||
|
|
||||||
|
|
||||||
|
Return days.ToArray()
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function GetSingleDayBandwidthStatistics(day As Date, mailAccount As String) As DailyStatistics
|
||||||
|
Const ReceivedAmmountPositionInString As Int32 = 18
|
||||||
|
Const SentOutAmmountPositionInString As Int32 = 22
|
||||||
|
|
||||||
|
Dim apiObject = CreateObject(API_PROGID)
|
||||||
|
Dim result As New DailyStatistics()
|
||||||
|
Dim formatedDate As String
|
||||||
|
formatedDate = Format(day, "yyyy/MM/dd")
|
||||||
|
|
||||||
|
result.Day = day.Day
|
||||||
|
result.Month = day.Month
|
||||||
|
result.Year = day.Year
|
||||||
|
result.BytesReceived = 0
|
||||||
|
result.BytesSent = 0
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim apiResult As String = apiObject.GetUserStatistics(formatedDate, formatedDate, mailAccount)
|
||||||
|
|
||||||
|
Dim apiResultSplit As String() = apiResult.Split(",")
|
||||||
|
|
||||||
|
result.BytesReceived = apiResultSplit(ReceivedAmmountPositionInString)
|
||||||
|
result.BytesSent = apiResultSplit(SentOutAmmountPositionInString)
|
||||||
|
Catch ex As Exception
|
||||||
|
Log.WriteError(String.Format("Merak: Error calculating '{0}' bandwidth at {1}", mailAccount, day.ToShortDateString()), ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Overrides Function GetServiceItemsDiskSpace(ByVal items() As ServiceProviderItem) As ServiceProviderItemDiskSpace()
|
Public Overrides Function GetServiceItemsDiskSpace(ByVal items() As ServiceProviderItem) As ServiceProviderItemDiskSpace()
|
||||||
Dim itemsDiskspace As List(Of ServiceProviderItemDiskSpace) = New List(Of ServiceProviderItemDiskSpace)
|
Dim itemsDiskspace As List(Of ServiceProviderItemDiskSpace) = New List(Of ServiceProviderItemDiskSpace)
|
||||||
Dim item As ServiceProviderItem
|
Dim item As ServiceProviderItem
|
||||||
|
@ -1297,8 +1372,6 @@ ContinueFor1:
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'/ Provides constant values for easier interoperability with Merak COM library
|
'/ Provides constant values for easier interoperability with Merak COM library
|
||||||
'/ </summary>
|
'/ </summary>
|
||||||
Private Class MerakInterop
|
Private Class MerakInterop
|
||||||
|
@ -1789,12 +1862,12 @@ Public Class Utils
|
||||||
End Class 'Utils
|
End Class 'Utils
|
||||||
|
|
||||||
Friend Class Service
|
Friend Class Service
|
||||||
Public ComObject As Object
|
Public ComObject As Object
|
||||||
Public Succeed As Boolean
|
Public Succeed As Boolean
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Friend Enum MailType
|
Friend Enum MailType
|
||||||
POP = 0
|
POP = 0
|
||||||
IMAP_POP = 1
|
IMAP_POP = 1
|
||||||
IMAP = 2
|
IMAP = 2
|
||||||
End Enum
|
End Enum
|
Loading…
Add table
Add a link
Reference in a new issue