fixed some bugs in redis and disque; add mail compose and smtp client module
@ -619,6 +619,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_pool", "lib_acl_cpp\s
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mail_build", "lib_acl_cpp\samples\mime\mail_build\mail_build_vc2008.vcproj", "{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{64BF4D83-53BB-4045-8522-9FF9F73B14D4} = {64BF4D83-53BB-4045-8522-9FF9F73B14D4}
|
||||
{B40213C2-507C-4C7F-A6E1-B850C9BDC27B} = {B40213C2-507C-4C7F-A6E1-B850C9BDC27B}
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -1313,6 +1320,14 @@ Global
|
||||
{CDB5750C-9937-47BB-B138-63E2318CEF52}.Release|Win32.Build.0 = Release|Win32
|
||||
{CDB5750C-9937-47BB-B138-63E2318CEF52}.Releasedll|Win32.ActiveCfg = Releasedll|Win32
|
||||
{CDB5750C-9937-47BB-B138-63E2318CEF52}.Releasedll|Win32.Build.0 = Releasedll|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Release|Win32.Build.0 = Release|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Releasedll|Win32.ActiveCfg = Releasedll|Win32
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}.Releasedll|Win32.Build.0 = Releasedll|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -1371,6 +1386,7 @@ Global
|
||||
{5DC79C83-9DE8-46B3-A172-8A4E3371878B} = {A5249932-813D-4B64-9307-0EB5FC464705}
|
||||
{1B51538E-859A-46FE-B423-592D79DEEF63} = {A5249932-813D-4B64-9307-0EB5FC464705}
|
||||
{503AFD46-DF2F-4D2B-8584-60AD2007D2BE} = {A5249932-813D-4B64-9307-0EB5FC464705}
|
||||
{D21BD1E5-C188-4061-BA52-70ECD86BFBDA} = {A5249932-813D-4B64-9307-0EB5FC464705}
|
||||
{82C00ED0-AEF5-4E5B-9581-1EA052CBEA01} = {9FE233BA-6510-4A21-9CB4-C2FF448506A3}
|
||||
{A804ECF6-59F0-4CCF-8D71-6E44CBCA2796} = {9FE233BA-6510-4A21-9CB4-C2FF448506A3}
|
||||
{20013703-57CC-4821-BF24-129A12490435} = {9FE233BA-6510-4A21-9CB4-C2FF448506A3}
|
||||
|
@ -338,6 +338,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_pool", "lib_acl_cpp\s
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mail_build", "lib_acl_cpp\samples\mime\mail_build\mail_build.vcxproj", "{11AE8D75-CAF0-445A-980C-662CFDDC0B38}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC} = {6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC}
|
||||
{B40213C2-507C-4C7F-A6E1-B850C9BDC27B} = {B40213C2-507C-4C7F-A6E1-B850C9BDC27B}
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -917,6 +924,16 @@ Global
|
||||
{7C56C0AF-4311-4D5B-BD32-DC240B4752B1}.Releasedll|Win32.Build.0 = Releasedll|Win32
|
||||
{7C56C0AF-4311-4D5B-BD32-DC240B4752B1}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{7C56C0AF-4311-4D5B-BD32-DC240B4752B1}.Template|Win32.Build.0 = Release|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Release|Win32.Build.0 = Release|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Releasedll|Win32.ActiveCfg = Releasedll|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Releasedll|Win32.Build.0 = Releasedll|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38}.Template|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -942,6 +959,7 @@ Global
|
||||
{19CB30E5-2672-4A8B-96FB-9C42970CCF69} = {DF3C05FD-61B1-4523-BB79-C84782024DD0}
|
||||
{5DC79C83-9DE8-46B3-A172-8A4E3371878B} = {DF3C05FD-61B1-4523-BB79-C84782024DD0}
|
||||
{52AA7352-CE48-4F60-B92D-1EB16A79FE54} = {DF3C05FD-61B1-4523-BB79-C84782024DD0}
|
||||
{11AE8D75-CAF0-445A-980C-662CFDDC0B38} = {DF3C05FD-61B1-4523-BB79-C84782024DD0}
|
||||
{9A04F86E-D4CB-45ED-9BB6-9939B9400B6F} = {0C3E1FB7-2436-4CC7-B671-AE907ABF6FDE}
|
||||
{ADE6F714-BD52-432D-AB86-62FA59AB6746} = {0C3E1FB7-2436-4CC7-B671-AE907ABF6FDE}
|
||||
{956FA905-A77F-41FE-A4BE-C3BD3B5B3E83} = {0C3E1FB7-2436-4CC7-B671-AE907ABF6FDE}
|
||||
|
@ -561,6 +561,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mysql_manager", "lib_acl_cp
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smtp_client", "lib_acl_cpp\samples\smtp_client\smtp_vc2012.vcxproj", "{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC} = {6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC}
|
||||
{B40213C2-507C-4C7F-A6E1-B850C9BDC27B} = {B40213C2-507C-4C7F-A6E1-B850C9BDC27B}
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mail_build", "lib_acl_cpp\samples\mime\mail_build\mail_build_vc2012.vcxproj", "{DBC43D27-7731-409D-A931-26D141A5FC6B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC} = {6EC1F44E-6A6A-48E9-B699-D7E89B63C8DC}
|
||||
{B40213C2-507C-4C7F-A6E1-B850C9BDC27B} = {B40213C2-507C-4C7F-A6E1-B850C9BDC27B}
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
@ -2710,6 +2724,66 @@ Global
|
||||
{A3F59765-4327-4A1F-82EF-AE0FF3D81503}.Template|Win32.Build.0 = DebugDll|Win32
|
||||
{A3F59765-4327-4A1F-82EF-AE0FF3D81503}.Template|x64.ActiveCfg = DebugDll|x64
|
||||
{A3F59765-4327-4A1F-82EF-AE0FF3D81503}.Template|x64.Build.0 = DebugDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Debug|x64.Build.0 = Debug|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|Mixed Platforms.ActiveCfg = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|Mixed Platforms.Build.0 = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|x64.ActiveCfg = DebugDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.DebugDll|x64.Build.0 = DebugDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|Win32.Build.0 = Release|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|x64.ActiveCfg = Release|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Release|x64.Build.0 = Release|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|Mixed Platforms.ActiveCfg = ReleaseDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|Mixed Platforms.Build.0 = ReleaseDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|Win32.ActiveCfg = ReleaseDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|Win32.Build.0 = ReleaseDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|x64.ActiveCfg = ReleaseDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Releasedll|x64.Build.0 = ReleaseDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|Mixed Platforms.ActiveCfg = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|Mixed Platforms.Build.0 = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|Win32.ActiveCfg = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|Win32.Build.0 = DebugDll|Win32
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|x64.ActiveCfg = DebugDll|x64
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}.Template|x64.Build.0 = DebugDll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Debug|x64.Build.0 = Debug|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|Mixed Platforms.ActiveCfg = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|Mixed Platforms.Build.0 = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|Win32.ActiveCfg = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|Win32.Build.0 = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|x64.ActiveCfg = DebugDll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.DebugDll|x64.Build.0 = DebugDll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|Win32.Build.0 = Release|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|x64.ActiveCfg = Release|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Release|x64.Build.0 = Release|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|Mixed Platforms.ActiveCfg = Releasedll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|Mixed Platforms.Build.0 = Releasedll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|Win32.ActiveCfg = Releasedll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|Win32.Build.0 = Releasedll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|x64.ActiveCfg = Releasedll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Releasedll|x64.Build.0 = Releasedll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|Mixed Platforms.ActiveCfg = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|Mixed Platforms.Build.0 = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|Win32.ActiveCfg = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|Win32.Build.0 = DebugDll|Win32
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|x64.ActiveCfg = DebugDll|x64
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B}.Template|x64.Build.0 = DebugDll|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -2735,6 +2809,7 @@ Global
|
||||
{C799E376-2F01-4877-AF18-7F3CC8B95792} = {324E7B70-E11C-4A39-A11F-4BB2A8E70064}
|
||||
{14531A45-383C-4CCF-870B-B5C867A314F2} = {324E7B70-E11C-4A39-A11F-4BB2A8E70064}
|
||||
{B6BE4E77-F69D-43B0-BE8A-77A8AA61A89E} = {324E7B70-E11C-4A39-A11F-4BB2A8E70064}
|
||||
{A7459536-E4FE-4ECE-A721-EE49DBA0CF95} = {324E7B70-E11C-4A39-A11F-4BB2A8E70064}
|
||||
{956FA905-A77F-41FE-A4BE-C3BD3B5B3E83} = {02535D96-1693-4AA3-B650-B22DC776FDC2}
|
||||
{225D0BFA-64D7-4F8F-951E-36A494CF6178} = {02535D96-1693-4AA3-B650-B22DC776FDC2}
|
||||
{ADE6F714-BD52-432D-AB86-62FA59AB6746} = {02535D96-1693-4AA3-B650-B22DC776FDC2}
|
||||
@ -2757,6 +2832,7 @@ Global
|
||||
{5DC79C83-9DE8-46B3-A172-8A4E3371878B} = {B1A07893-DA8C-43D8-A2F1-0940837C482F}
|
||||
{503AFD46-DF2F-4D2B-8584-60AD2007D2BE} = {B1A07893-DA8C-43D8-A2F1-0940837C482F}
|
||||
{52AA7352-CE48-4F60-B92D-1EB16A79FE54} = {B1A07893-DA8C-43D8-A2F1-0940837C482F}
|
||||
{DBC43D27-7731-409D-A931-26D141A5FC6B} = {B1A07893-DA8C-43D8-A2F1-0940837C482F}
|
||||
{2F6EDD90-FE9E-4D1F-B2FE-7FED6805B1D4} = {37A14D60-8196-4BCA-9B1A-48302446AFAF}
|
||||
{946DAF94-90C7-44F9-B24B-6B8F105A84EF} = {37A14D60-8196-4BCA-9B1A-48302446AFAF}
|
||||
{DE0F9993-7821-4659-B1C2-3A24DE292E87} = {37A14D60-8196-4BCA-9B1A-48302446AFAF}
|
||||
|
@ -15,7 +15,8 @@ extern "C" {
|
||||
* @param len {int} in 源数据的长度
|
||||
* @return {ACL_VSTRING*} 与 vp 相同
|
||||
*/
|
||||
ACL_API ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *vp, const char *in, int len);
|
||||
ACL_API ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *vp,
|
||||
const char *in, int len);
|
||||
|
||||
/**
|
||||
* BASE64 解码函数
|
||||
@ -24,7 +25,8 @@ ACL_API ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *vp, const char *in,
|
||||
* @param len {int} in 数据长度
|
||||
* @return {ACL_VSTRING*} NULL: 解码失败; !=NULL: 解码成功且与 vp 相同地址
|
||||
*/
|
||||
ACL_API ACL_VSTRING *acl_vstring_base64_decode(ACL_VSTRING *vp, const char *in, int len);
|
||||
ACL_API ACL_VSTRING *acl_vstring_base64_decode(ACL_VSTRING *vp,
|
||||
const char *in, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ static const unsigned char un_b64[] = {
|
||||
|
||||
/* vstring_base64_encode - raw data to encoded */
|
||||
|
||||
ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *result, const char *in, int len)
|
||||
ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *result,
|
||||
const char *in, int len)
|
||||
{
|
||||
const unsigned char *cp;
|
||||
int count;
|
||||
@ -89,7 +90,8 @@ ACL_VSTRING *acl_vstring_base64_encode(ACL_VSTRING *result, const char *in, int
|
||||
|
||||
/* acl_vstring_base64_decode - encoded data to raw */
|
||||
|
||||
ACL_VSTRING *acl_vstring_base64_decode(ACL_VSTRING *result, const char *in, int len)
|
||||
ACL_VSTRING *acl_vstring_base64_decode(ACL_VSTRING *result,
|
||||
const char *in, int len)
|
||||
{
|
||||
const unsigned char *cp;
|
||||
int count;
|
||||
|
@ -403,18 +403,13 @@ const char *acl_i64toa(acl_int64 value, char *buf, size_t size)
|
||||
|
||||
acl_uint64 acl_atoui64(const char *str)
|
||||
{
|
||||
#ifdef MINGW
|
||||
return (acl_uint64) atol(str);
|
||||
#else
|
||||
return (acl_uint64) strtoull(str, NULL, 10);
|
||||
#endif
|
||||
return (acl_uint64) atoll(str);
|
||||
}
|
||||
|
||||
acl_int64 acl_atoi64(const char *str)
|
||||
{
|
||||
#ifdef MINGW
|
||||
return (acl_int64) atol(str);
|
||||
#else
|
||||
return (acl_int64) atoll(str);
|
||||
#if 0
|
||||
return (acl_int64) strtoull(str, NULL, 10);
|
||||
#endif
|
||||
}
|
||||
|
@ -402,9 +402,11 @@ ACL_VSTRING *acl_xml_build(ACL_XML *xml, ACL_VSTRING *buf)
|
||||
acl_vstring_strcat(buf, ">");
|
||||
continue;
|
||||
}
|
||||
if (LEN(node->text) == 0)
|
||||
acl_vstring_strcat(buf, " />");
|
||||
else
|
||||
if (LEN(node->text) == 0) {
|
||||
acl_vstring_strcat(buf, "></");
|
||||
acl_vstring_strcat(buf, STR(node->ltag));
|
||||
acl_vstring_strcat(buf, ">");
|
||||
} else
|
||||
acl_vstring_sprintf_append(buf, ">%s</%s>",
|
||||
STR(node->text), STR(node->ltag));
|
||||
|
||||
|
@ -111,6 +111,7 @@ OBJS_DST = $(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/*.cpp)
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/beanstalk/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/memcache/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/session/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/smtp/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/mime/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/mime/internal/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/connpool/*.cpp))) \
|
||||
@ -130,6 +131,7 @@ OBJS_DEF = $(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/*.cp
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/beanstalk/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/memcache/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/session/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/smtp/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/mime/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/mime/internal/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/connpool/*.cpp))) \
|
||||
@ -218,6 +220,8 @@ $(OBJ_PATH_DST)/%.o: ./src/session/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/connpool/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/smtp/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/mime/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/mime/internal/%.cpp
|
||||
@ -255,6 +259,8 @@ $(DEF_PATH_DST)/%.inc: ./src/session/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/connpool/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/smtp/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/mime/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/mime/internal/%.cpp
|
||||
|
@ -1,290 +0,0 @@
|
||||
SHELL = /bin/sh
|
||||
CC = g++
|
||||
AR = ar
|
||||
ARFL = rv
|
||||
#ARFL = cru
|
||||
RANLIB = ranlib
|
||||
|
||||
CFLAGS = -c -g -W -Wall -Wcast-align \
|
||||
-Wpointer-arith -Werror -Wshadow -O3 \
|
||||
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS \
|
||||
-Wno-long-long \
|
||||
-fPIC \
|
||||
-DHAS_MYSQL \
|
||||
-DHAS_SQLITE \
|
||||
-Wformat
|
||||
#-DHAS_POLARSSL
|
||||
#-DUSE_DYNAMIC
|
||||
#-Wcast-qual
|
||||
|
||||
###########################################################
|
||||
#Check system:
|
||||
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
|
||||
SYSLIB =
|
||||
CHECKSYSRES = @echo "Unknow system type!";exit 1
|
||||
UNIXNAME = $(shell uname -sm)
|
||||
UNIXTYPE = LINUX
|
||||
|
||||
ifeq ($(CC),)
|
||||
CC = g++
|
||||
endif
|
||||
|
||||
# For FreeBSD
|
||||
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
|
||||
CFLAGS += -DFREEBSD -D_REENTRANT
|
||||
UNIXTYPE = FREEBSD
|
||||
endif
|
||||
|
||||
# For Darwin
|
||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
||||
-Wno-extended-offsetof -fPIC -Werror \
|
||||
-Wno-unused-private-field
|
||||
UNIXTYPE = MACOSX
|
||||
endif
|
||||
|
||||
# For Linux
|
||||
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
||||
CFLAGS += -DLINUX2 -D_REENTRANT
|
||||
UNIXTYPE = LINUX
|
||||
endif
|
||||
|
||||
# For SunOS
|
||||
ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
|
||||
ifeq ($(findstring 86, $(UNIXNAME)), 86)
|
||||
SYSLIB = -lsocket -lnsl -lrt
|
||||
endif
|
||||
ifeq ($(findstring sun4u, $(UNIXNAME)), sun4u)
|
||||
SYSLIB = -lsocket -lnsl -lrt
|
||||
endif
|
||||
CFLAGS += -DSUNOS5 -D_REENTRANT
|
||||
UNIXTYPE = SUNOS5
|
||||
endif
|
||||
|
||||
# For HP-UX
|
||||
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
|
||||
CFLAGS += -DHP_UX -DHPUX11
|
||||
UNIXTYPE = HPUX
|
||||
endif
|
||||
|
||||
#Find system type.
|
||||
ifneq ($(SYSPATH),)
|
||||
CHECKSYSRES = @echo "System is $(shell uname -sm)"
|
||||
endif
|
||||
###########################################################
|
||||
|
||||
OBJ_PATH_DST = ./Debug
|
||||
LIB_PATH_DST = ./lib
|
||||
DEF_PATH_DST = ./Debug
|
||||
|
||||
CFLAGS += -I./src -I./include -I../lib_acl/include -I../lib_protocol/include \
|
||||
-I../include/sqlite -I../include/mysql -I../include/zlib -I../include
|
||||
|
||||
#Project's objs
|
||||
OBJS_DST = $(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/stdlib/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/stream/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/master/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/ipc/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/db/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/event/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/queue/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/http/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/hsocket/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/beanstalk/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/memcache/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/session/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/mime/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/mime/internal/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/connpool/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/redis/*.cpp))) \
|
||||
$(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(wildcard src/disque/*.cpp)))
|
||||
|
||||
OBJS_DEF = $(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/stdlib/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/stream/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/master/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/ipc/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/db/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/event/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/queue/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/http/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/hsocket/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/beanstalk/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/memcache/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/session/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/mime/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/mime/internal/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/connpool/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/redis/*.cpp))) \
|
||||
$(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/disque/*.cpp)))
|
||||
|
||||
###########################################################
|
||||
.PHONY = static shared clean
|
||||
VERSION = 1.1.1.2
|
||||
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
||||
|
||||
STATIC_LIBNAME = lib_acl_cpp.a
|
||||
SHARED_LIBNAME = lib_acl_cpp.so
|
||||
|
||||
all: static shared sample
|
||||
|
||||
$(shell mkdir -p $(DEF_PATH_DST))
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include $(OBJS_DEF)
|
||||
endif
|
||||
|
||||
COMPILE = $(CC) $(CFLAGS)
|
||||
COMPILE_OBJ = @(echo 'building $<'; $(COMPILE) $< -o $@)
|
||||
CREATE_DEF = @(echo 'creating $@'; rm -f $@; \
|
||||
$(COMPILE) -MM $< > $@.$$$$; \
|
||||
sed 's,.*.o\( \)*:,$(patsubst %.inc,%.o,$@) $@ :,g' < $@.$$$$ > $@; \
|
||||
rm -f $@.$$$$)
|
||||
|
||||
###########################################################
|
||||
|
||||
sample: static
|
||||
@(cd samples; make)
|
||||
|
||||
static: depends $(OBJS_DST)
|
||||
@echo 'creating $(LIB_PATH_DST)/$(STATIC_LIBNAME)'
|
||||
@$(AR) $(ARFL) $(LIB_PATH_DST)/$(STATIC_LIBNAME) $(OBJS_DST)
|
||||
@$(RANLIB) $(LIB_PATH_DST)/$(STATIC_LIBNAME)
|
||||
@echo 'create $(LIB_PATH_DST)/$(STATIC_LIBNAME) ok!'
|
||||
|
||||
shared_ldflags = -l_protocol -l_acl \
|
||||
-lmysqlclient -lsqlite3 -lrt -lpthread -lz -ldl
|
||||
shared: depends $(OBJS_DST)
|
||||
@echo 'creating $(SHARED_LIBNAME)'
|
||||
@if test -n "$(rpath)" && test "$(UNIXTYPE)" = "LINUX"; then \
|
||||
echo "building for linux"; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||
-L$(rpath) $(shared_ldflags) -Wl,-rpath,$(rpath); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "SUNOS5"; then \
|
||||
echo "building for sunos5"; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||
-R$(rpath) -L$(rpath) $(shared_ldflags); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
else \
|
||||
echo 'skip build $(SHARED_LIBNAME); usage: make rpath=xxx'; \
|
||||
fi
|
||||
|
||||
depends: $(OBJS_DEF)
|
||||
|
||||
## for src
|
||||
$(OBJ_PATH_DST)/%.o: ./src/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/stdlib/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/stream/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/master/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/ipc/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/db/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/event/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/queue/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/http/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/hsocket/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/beanstalk/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/memcache/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/session/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/connpool/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/mime/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/mime/internal/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/redis/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
$(OBJ_PATH_DST)/%.o: ./src/disque/%.cpp
|
||||
$(COMPILE_OBJ)
|
||||
|
||||
## for depend
|
||||
$(DEF_PATH_DST)/%.inc: ./src/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/stdlib/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/stream/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/master/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/ipc/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/db/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/event/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/queue/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/http/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/hsocket/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/beanstalk/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/memcache/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/session/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/connpool/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/mime/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/mime/internal/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/redis/%.cpp
|
||||
$(CREATE_DEF)
|
||||
$(DEF_PATH_DST)/%.inc: ./src/disque/%.cpp
|
||||
$(CREATE_DEF)
|
||||
|
||||
clean:
|
||||
rm -f $(LIB_PATH_DST)/lib_acl_cpp.a
|
||||
rm -f $(OBJS_DST)
|
||||
rm -f $(OBJS_DEF)
|
||||
@(cd samples; make clean)
|
||||
|
||||
rebuild rb: clean static
|
||||
|
||||
build_src: clean
|
||||
@(echo "begin building src release...")
|
||||
@(rm -rf acl_cpp)
|
||||
@(echo "copy files ...")
|
||||
@(mkdir acl_cpp)
|
||||
@(cp -R src acl_cpp/)
|
||||
@(cp -R mime acl_cpp/)
|
||||
@(cp -R lib acl_cpp/)
|
||||
@(cp -R include acl_cpp/)
|
||||
@(cp -R samples acl_cpp/)
|
||||
@(cp -R Debug acl_cpp/)
|
||||
@(cp -R DebugDll acl_cpp/)
|
||||
@(cp -R Release acl_cpp/)
|
||||
@(cp -R ReleaseDll acl_cpp/)
|
||||
@(cp -R bin acl_cpp/)
|
||||
@(cp -R doc acl_cpp/)
|
||||
@(cp lib_acl_cpp_vc2003.vcproj acl_cpp/)
|
||||
@(cp acl_wrap_vc2003.sln acl_cpp/)
|
||||
@(cp lib_acl_cpp_vc2010.vcxproj acl_cpp/)
|
||||
@(cp acl_wrap_vc2010.sln acl_cpp/)
|
||||
@(cp Makefile acl_cpp/)
|
||||
@(cp changes.txt acl_cpp/)
|
||||
@(cp ReadMe.txt acl_cpp/)
|
||||
@(cp Doxyfile acl_cpp/)
|
||||
@(echo "make tar package ...")
|
||||
@(tar -cf acl_cpp.src.tar acl_cpp)
|
||||
@(echo "make gzip package ...")
|
||||
@(gzip -c acl_cpp.src.tar > acl_cpp.src.tgz)
|
||||
@(rm acl_cpp.src.tar)
|
||||
@(rm -rf acl_cpp)
|
||||
@(echo "move acl_cpp.src.tgz to ../acl_cpp$(VERSION).src.$(DATE_NOW).tgz")
|
||||
(mv acl_cpp.src.tgz ../acl_cpp$(VERSION).src.$(DATE_NOW).tgz)
|
@ -1,5 +1,25 @@
|
||||
修改历史列表:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
354) 2015.9.7
|
||||
354.1) bugfix: geo_member::set_coordinate 中设置经纬度的参数有误
|
||||
354.2) bugfix: db_row::field_int64 之前使用的将字符串转为64位整数的方法在32位
|
||||
机器上有问题,统一换成 acl_atoi64
|
||||
354.3) feature: smtp 模块增加了邮件合成的功能
|
||||
354.4) sample: mime_builder 例子用来测试邮件合成功能
|
||||
354.5) bugfix: mime_stype_name 函数的下标起始位置不是从 0 开始的,所以需要将所给的
|
||||
下标位置减去起始下标值方能得到数组的真正下标值
|
||||
|
||||
353) 2015.9.6
|
||||
353.1) bugfix: redis_zset::zrangebyscore_get 其中的 argc 计数有误
|
||||
|
||||
352) 2015.9.2
|
||||
352.1) feature: 添加 smtp_client 类用来发送电子邮件,同时支持 SSL 方式发送邮件
|
||||
|
||||
351)2015.8.31
|
||||
351.1) compile: VC2010 工程中未包含 thread_queue 类的源文件和头文件
|
||||
351.2) feature: locker 互斥类增加了 lock_guard 类以便于简化加锁/解锁操作
|
||||
|
||||
------------------------------------------------------------------------
|
||||
350) 2015.8.26
|
||||
350.1) feature: string 类在进行 base64 解码时,需要自动在尾部添加 \0 以防止使用者
|
||||
|
@ -15,6 +15,9 @@ class disque_cond;
|
||||
class disque_node;
|
||||
class disque_job;
|
||||
|
||||
/**
|
||||
* disque 命令操作类
|
||||
*/
|
||||
class ACL_CPP_API disque : virtual public redis_command
|
||||
{
|
||||
public:
|
||||
@ -39,15 +42,26 @@ public:
|
||||
|
||||
/**
|
||||
* add a job to the specified queue
|
||||
* 添加一个任务消息至指定的队列中
|
||||
* @param name {const char*} the name of the specified queue
|
||||
* 队列名称
|
||||
* @param job {const char*} a message to deliver
|
||||
* 任务消息字符串
|
||||
* @param timeout {int} the command timeout in milliseconds
|
||||
* 该命令执行的超时时间(毫秒)
|
||||
* @param args {const std::map<acl::string, int>*} the condition
|
||||
* for ADDJOB command, the conditions name include:
|
||||
* REPLICATE, DELAY, RETRY, TTL, MAXLEN, ASYNC, if the args was NULL,
|
||||
* none condition will be used in this operation
|
||||
* 添加消息的处理条件集合,对应的条件内容项:
|
||||
* REPLICATE -- 副本个数,
|
||||
* DELAY -- 指定任务在放入各个节点的队列之前, 需要等待多少秒钟
|
||||
* TTL -- 任务生存周期(秒)
|
||||
* MAXLEN -- 指定队列最多可以存放多少个待传递的任务
|
||||
* ASYNC -- 服务端采用异步方式将任务同步至其副本结点
|
||||
* @return {const char*} a ID of the job will be returned, NULL will
|
||||
* be returned if some error happened.
|
||||
* 返回任务 ID 号,如果返回 NULL 则表示出错
|
||||
*/
|
||||
const char* addjob(const char* name, const char* job,
|
||||
int timeout, const std::map<string, int>* args = NULL);
|
||||
@ -58,12 +72,18 @@ public:
|
||||
|
||||
/**
|
||||
* add a job to the specified queue
|
||||
* 向指定消息队列添加任务
|
||||
* @param name {const char*} the name of the specified queue
|
||||
* 指定的消息队列名称
|
||||
* @param job {const char*} a message to deliver
|
||||
* 将添加的任务
|
||||
* @param timeout {int} the command timeout in milliseconds
|
||||
* 毫秒精度的命令超时限制
|
||||
* @param cond {const acl::disque_cond*} the condition for the ADDJOB
|
||||
* 添加任务的条件,参见类 disque_cond
|
||||
* @return {const char*} a ID of the job will be returned, NULL will
|
||||
* be returned if some error happened.
|
||||
* 返回任务 ID 号,如果返回 NULL 则表示出错
|
||||
*/
|
||||
const char* addjob(const char* name, const char* job,
|
||||
int timeout, const disque_cond* cond);
|
||||
@ -75,96 +95,140 @@ public:
|
||||
/**
|
||||
* get jobs from the specified queues, or return NULL if the timeout
|
||||
* is reached.
|
||||
* 从指定的队列集合中获得取指定最大数量的任务
|
||||
* @param names {const std::vector<acl::string>&} the specified queues
|
||||
* 指定的列表名称集合
|
||||
* @param timeout {int} the command timeout in milliseconds
|
||||
* 毫秒精度的命令超时限制
|
||||
* @param count {size_t} the max count of the jobs to be got
|
||||
* 指定了返回任务结果集的最大个数限制
|
||||
* @return {const std::vector<acl::disque_job*>*} return the jobs,
|
||||
* or return NULL if the timeout is reached or some error happens.
|
||||
* 返回结果集。如果超时或发生错误则返回 NULL
|
||||
*/
|
||||
const std::vector<disque_job*>* getjob(const std::vector<string>& names,
|
||||
size_t timeout, size_t count);
|
||||
const std::vector<disque_job*>* getjob(const char* name,
|
||||
size_t timeout, size_t count);
|
||||
|
||||
/**
|
||||
* acknowledge the execution of one or more jobs via IDs. The node
|
||||
* receiving the ACK will replicate it to multiple nodes and will try
|
||||
* to garbage collect both the job and the ACKs from the cluster so
|
||||
* that memory can be freed.
|
||||
* 通过给定任务 ID , 向节点告知任务已经被执行。接收到 ACK 消息的节点会将该消息
|
||||
* 复制至多个节点, 并尝试对任务和来自集群的 ACK 消息进行垃圾回收操作, 从而释放
|
||||
* 被占用的内存。
|
||||
* @param job_ids {const std::vector<acl::string>&} the jobs' IDs
|
||||
* 任务 ID 集合
|
||||
* @return {int} return the number of IDs been ACKed, -1 will be
|
||||
* returned if some error happened
|
||||
* 返回被确认的任务个数,如果出错则返回 -1
|
||||
*/
|
||||
int ackjob(const std::vector<string>& job_ids);
|
||||
|
||||
/**
|
||||
* perform a best effort cluster wide detection of the specified
|
||||
* job IDs.
|
||||
* 尽最大努力在集群范围内对给定的任务进行删除;在网络连接良好并且所有节点都在线时,
|
||||
* 这个命令的效果和 ACKJOB 命令的效果一样, 但是因为这个命令引发的消息交换比
|
||||
* ACKJOB 要少, 所以它的速度比 ACKJOB 要快不少;但是当集群中包含了失效节点的
|
||||
* 时候, FASTACK 命令比 ACKJOB 命令更容易出现多次发送同一消息的情况
|
||||
* @param job_ids {const std::vector<acl::string>&} the jobs' IDs
|
||||
* 任务 ID 集合
|
||||
* @return {int} return the number of IDs been ACKed, -1 will be
|
||||
* returned if some error happened
|
||||
* 返回被确认的任务个数,如果出错则返回 -1
|
||||
*/
|
||||
int fastack(const std::vector<string>& job_ids);
|
||||
|
||||
/**
|
||||
* peek some jobs no more than the specified count from the specified
|
||||
* queue and remain these jobs in queue.
|
||||
* 在不取出任务的情况下, 从队列里面返回指定数量的任务
|
||||
* @param name {const char*} the specified queue
|
||||
* 指定的队列名称
|
||||
* @param count {int} limit the max count of jobs to be got
|
||||
* 限定了返回结果集的最大数量
|
||||
* @return {const std::vector<acl::disque_job*>*} return the jobs
|
||||
* if the queue isn't empty. NULL will be returned if the queue
|
||||
* is empty or some error happened.
|
||||
* 返回结果集,如果队列为空或出错则返回 NULL
|
||||
*/
|
||||
const std::vector<disque_job*>* qpeek(const char* name, int count);
|
||||
|
||||
/**
|
||||
* get the number of jobs stored in the specified queue
|
||||
* 获得指定队列中的任务数量
|
||||
* @param name {const char*} the specified queue
|
||||
* 指定的队列名称
|
||||
* @return {int} return the number of the jobs in queue
|
||||
* 返回指定队列中的任务数量,返回出错则返回 -1
|
||||
*/
|
||||
int qlen(const char* name);
|
||||
|
||||
/**
|
||||
* get the stat information of the specified job by job id
|
||||
* 根据任务 ID 获得任务的相关信息
|
||||
* @param job_id {const char*} the id of the job
|
||||
* 指定的任务 ID
|
||||
* @return {const acl::disque_job*} return the job's information,
|
||||
* return NULL if the job doesn't exist or some error happens.
|
||||
* 返回指定任务的信息,参考类 disque_job;如果任务不存在或出错则返回 NULL
|
||||
*/
|
||||
const disque_job* show(const char* job_id);
|
||||
|
||||
/**
|
||||
* queue jobs if not already queued
|
||||
* 如果给定任务未被放入到队列里, 则把它们放入到队列里
|
||||
* @param job_ids {const std::vector<acl::string>&} the job IDs
|
||||
* 指定的任务 ID 集合
|
||||
* @return {int} return the number of jobs been queued, -1 will be
|
||||
* returned if some error happens.
|
||||
* 返回被放入队列里的任务数量,如果出错则返回 -1
|
||||
*/
|
||||
int enqueue(const std::vector<string>& job_ids);
|
||||
|
||||
/**
|
||||
* remove the jobs from the queue
|
||||
* 从队列里面移除指定的任务
|
||||
* @param job_ids {const std::vector<acl::string>&} the job IDs
|
||||
* 准备移除的任务 ID 集合
|
||||
* @return {int} return the number of jobs been removed, -1 will be
|
||||
* returned if some error happens.
|
||||
* 返回被移除的任务数量,如果出错则返回 -1
|
||||
*/
|
||||
int dequeue(const std::vector<string>& job_ids);
|
||||
|
||||
/**
|
||||
* completely delete a job from a node.
|
||||
* 在节点里面彻底地删除给定的任务。 这个命令和 FASTACK 很相似, 唯一的不同是,
|
||||
* DELJOB 命令引发的删除操作只会在单个节点里面执行, 它不会将 DELJOB 集群总线
|
||||
* 消息(cluster bus message)发送至其他节点
|
||||
* @param job_ids {const std::vector<acl::string>&} the job IDs
|
||||
* 被删除的任务 ID 集合
|
||||
* @return {int} return the number of jobs been deleted, -1 will be
|
||||
* returned if some error happens.
|
||||
* 返回被删除的任务数量,如果出错则返回 -1
|
||||
*/
|
||||
int deljob(const std::vector<string>& job_ids);
|
||||
|
||||
/**
|
||||
* display the information of the disque cluster
|
||||
* 获得当前集群的状态信息
|
||||
* @param out {std::map<acl::string, acl::string>&} store result
|
||||
* 存储结果
|
||||
* @return {bool} if the operation is successful
|
||||
* 操作是否正常,如果出错则返回 false
|
||||
*/
|
||||
bool info(std::map<string, string>& out);
|
||||
|
||||
/**
|
||||
* get the information of all the nodes in the cluster
|
||||
* 获得集群中所有结点的信息
|
||||
* @return {const std::vector<acl::disque_node*>*} all the nodes'
|
||||
* information in the cluster, return NULL if some error happened.
|
||||
* 返回集群中所有结点信息的结果集,如果出错则返回 NULL;参考类 disque_node
|
||||
*/
|
||||
const std::vector<disque_node*>* hello();
|
||||
|
||||
|
@ -4,6 +4,9 @@
|
||||
namespace acl
|
||||
{
|
||||
|
||||
/**
|
||||
* 在添加任务时,此类指定的任务的添加条件限定
|
||||
*/
|
||||
class ACL_CPP_API disque_cond
|
||||
{
|
||||
public:
|
||||
|
@ -8,22 +8,40 @@ namespace acl
|
||||
|
||||
class redis_result;
|
||||
|
||||
/**
|
||||
* 在从 disque 队列中获得的任务信息的类
|
||||
*/
|
||||
class ACL_CPP_API disque_job
|
||||
{
|
||||
public:
|
||||
disque_job();
|
||||
~disque_job();
|
||||
|
||||
/**
|
||||
* get the ID of the job
|
||||
* 获得当前任务的 ID 号
|
||||
* @return {const char*}
|
||||
*/
|
||||
const char* get_id() const
|
||||
{
|
||||
return id_.c_str();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the queue name holding the job
|
||||
* 获得当前任务所在的队列
|
||||
* @return {const char*}
|
||||
*/
|
||||
const char* get_queue() const
|
||||
{
|
||||
return queue_.c_str();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the job's data
|
||||
* 获得当前任务的消息内容
|
||||
* @return {const string&}
|
||||
*/
|
||||
const string& get_body() const
|
||||
{
|
||||
return body_;
|
||||
|
@ -120,6 +120,11 @@
|
||||
#include "acl_cpp/mime/rfc2047.hpp"
|
||||
#include "acl_cpp/mime/rfc822.hpp"
|
||||
|
||||
#include "acl_cpp/smtp/mail_attach.hpp"
|
||||
#include "acl_cpp/smtp/mail_body.hpp"
|
||||
#include "acl_cpp/smtp/mail_message.hpp"
|
||||
#include "acl_cpp/smtp/smtp_client.hpp"
|
||||
|
||||
#include "acl_cpp/event/event_timer.hpp"
|
||||
|
||||
#include "acl_cpp/master/master_base.hpp"
|
||||
|
@ -7,14 +7,12 @@ namespace acl {
|
||||
class ACL_CPP_API mime_base64 : public mime_code
|
||||
{
|
||||
public:
|
||||
mime_base64();
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param addCrlf {bool} 非流式编码时是否在末尾添加 "\r\n"
|
||||
* @param addInvalid {bool} 流式解码时是否遇到非法字符是否原样拷贝
|
||||
*/
|
||||
mime_base64(bool addCrlf, bool addInvalid);
|
||||
mime_base64(bool addCrlf = false, bool addInvalid = false);
|
||||
~mime_base64();
|
||||
|
||||
/**
|
||||
@ -33,9 +31,6 @@ public:
|
||||
* @param out {string*} 存储解析结果
|
||||
*/
|
||||
static void decode(const char* in, int n, string* out);
|
||||
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace acl
|
||||
|
@ -8,16 +8,24 @@ namespace acl {
|
||||
class ACL_CPP_API mime_code : public pipe_stream
|
||||
{
|
||||
public:
|
||||
mime_code();
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param addCrlf {bool} 非流式编码时是否在末尾添加 "\r\n"
|
||||
* @param addInvalid {bool} 流式解码时是否遇到非法字符是否原样拷贝
|
||||
* @param encoding {const char*} ±àÂëÀàÐͱêʶ·û
|
||||
*/
|
||||
mime_code(bool addCrlf, bool addInvalid);
|
||||
mime_code(bool addCrlf, bool addInvalid, const char* encoding_type);
|
||||
virtual ~mime_code() = 0;
|
||||
|
||||
/**
|
||||
* »ñµÃ±àÂëÀàÐͱêʶ·û
|
||||
* @return {const char*}
|
||||
*/
|
||||
const char* get_encoding_type() const
|
||||
{
|
||||
return encoding_type_;
|
||||
}
|
||||
|
||||
/* 流式编码函数,使用方法: encode_update->encode_update->...->encode_finish */
|
||||
|
||||
/**
|
||||
@ -144,6 +152,7 @@ private:
|
||||
const unsigned char *m_unTab;
|
||||
unsigned char m_fillChar;
|
||||
string* m_pBuf;
|
||||
char* encoding_type_;
|
||||
};
|
||||
|
||||
} // namespace acl
|
||||
|
@ -9,14 +9,12 @@ class string;
|
||||
class ACL_CPP_API mime_quoted_printable : public mime_code
|
||||
{
|
||||
public:
|
||||
mime_quoted_printable();
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param addCrlf {bool} 非流式编码时是否在末尾添加 "\r\n"
|
||||
* @param addInvalid {bool} 流式解码时是否遇到非法字符是否原样拷贝
|
||||
*/
|
||||
mime_quoted_printable(bool addCrlf, bool addInvalid);
|
||||
mime_quoted_printable(bool addCrlf = false, bool addInvalid = false);
|
||||
~mime_quoted_printable();
|
||||
|
||||
// 基类的虚函数重载
|
||||
|
@ -7,14 +7,12 @@ namespace acl {
|
||||
class ACL_CPP_API mime_uucode : public mime_code
|
||||
{
|
||||
public:
|
||||
mime_uucode();
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param addCrlf {bool} 非流式编码时是否在末尾添加 "\r\n"
|
||||
* @param addInvalid {bool} 流式解码时是否遇到非法字符是否原样拷贝
|
||||
*/
|
||||
mime_uucode(bool addCrlf, bool addInvalid);
|
||||
mime_uucode(bool addCrlf = false, bool addInvalid = false);
|
||||
~mime_uucode();
|
||||
|
||||
/**
|
||||
|
@ -7,14 +7,12 @@ namespace acl {
|
||||
class ACL_CPP_API mime_xxcode : public mime_code
|
||||
{
|
||||
public:
|
||||
mime_xxcode();
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param addCrlf {bool} 非流式编码时是否在末尾添加 "\r\n"
|
||||
* @param addInvalid {bool} 流式解码时是否遇到非法字符是否原样拷贝
|
||||
*/
|
||||
mime_xxcode(bool addCrlf, bool addInvalid);
|
||||
mime_xxcode(bool addCrlf = false, bool addInvalid = false);
|
||||
~mime_xxcode();
|
||||
|
||||
/**
|
||||
|
@ -68,18 +68,22 @@ public:
|
||||
* "\t\"=?GB2312?B?t+vBosn6?=\" <fenglisheng@51iker.com>;\r\n"
|
||||
* "\t\"zhengshuxin3\";\"zhengshuxin4\" <zhengshuxin2@51iker.com>;"
|
||||
* "<xuganghui@51iker.com>;<wangwenquan@51iker.com>;"
|
||||
* @param to_charset {const char*} 目标字符集,例如:gbk, gb18030, utf-8
|
||||
* @return {const std::list<rfc822_addr*>&} 解析结果
|
||||
*/
|
||||
const std::list<rfc822_addr*>& parse_addrs(const char* in);
|
||||
const std::list<rfc822_addr*>& parse_addrs(const char* in,
|
||||
const char* to_charset = "utf-8");
|
||||
|
||||
/**
|
||||
* 解析一个符合 RFC822 标准的邮件地址,同时将用户名注释部分按
|
||||
* RFC2047 标准进行解码
|
||||
* @param in {const char*} RFC822 格式的邮件地址
|
||||
* @param to_charset {const char*} 目标字符集,例如:gbk, gb18030, utf-8
|
||||
* @return {const rfc822_addr*} 返回 NULL 表明输入的邮件地址不符合
|
||||
* RFC822 规范
|
||||
*/
|
||||
const rfc822_addr* parse_addr(const char* in);
|
||||
const rfc822_addr* parse_addr(const char* in,
|
||||
const char* to_charset = "utf-8");
|
||||
|
||||
/**
|
||||
* 检查邮件地址是否合法
|
||||
|
51
lib_acl_cpp/include/acl_cpp/smtp/mail_attach.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "acl_cpp/acl_cpp_define.hpp"
|
||||
#include "acl_cpp/stdlib/string.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
class mime_code;
|
||||
class ostream;
|
||||
|
||||
class ACL_CPP_API mail_attach
|
||||
{
|
||||
public:
|
||||
mail_attach(const char* filepath, const char* content_type,
|
||||
const char* charset);
|
||||
~mail_attach();
|
||||
|
||||
mail_attach& set_content_id(const char* id);
|
||||
|
||||
const char* get_filepath() const
|
||||
{
|
||||
return filepath_.c_str();
|
||||
}
|
||||
|
||||
const char* get_filename() const
|
||||
{
|
||||
return filename_.c_str();
|
||||
}
|
||||
|
||||
const char* get_content_type() const
|
||||
{
|
||||
return ctype_.c_str();
|
||||
}
|
||||
|
||||
const char* get_content_id() const
|
||||
{
|
||||
return cid_.c_str();
|
||||
}
|
||||
|
||||
bool save_to(mime_code* coder, string& out);
|
||||
bool save_to(mime_code* coder, ostream& out);
|
||||
void build_header(const char* transfer_encoding, string& out);
|
||||
|
||||
private:
|
||||
string filepath_;
|
||||
string filename_;
|
||||
string ctype_;
|
||||
string cid_;
|
||||
string charset_;
|
||||
};
|
||||
|
||||
} // namespace acl
|
81
lib_acl_cpp/include/acl_cpp/smtp/mail_body.hpp
Normal file
@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
#include "acl_cpp/acl_cpp_define.hpp"
|
||||
#include <vector>
|
||||
#include "acl_cpp/stdlib/string.hpp"
|
||||
#include "acl_cpp/http/http_ctype.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
class mime_code;
|
||||
class mail_attach;
|
||||
|
||||
class ACL_CPP_API mail_body
|
||||
{
|
||||
public:
|
||||
mail_body(const char* charset = "utf-8",
|
||||
const char* encoding = "base64");
|
||||
~mail_body();
|
||||
|
||||
const string& get_content_type() const
|
||||
{
|
||||
return content_type_;
|
||||
}
|
||||
const http_ctype& get_ctype() const
|
||||
{
|
||||
return ctype_;
|
||||
}
|
||||
|
||||
mail_body& set_html(const char* html, size_t len);
|
||||
mail_body& set_text(const char* text, size_t len);
|
||||
mail_body& set_alternative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen);
|
||||
mail_body& set_relative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen,
|
||||
const std::vector<mail_attach*>& attachments);
|
||||
|
||||
const char* get_html(size_t& len) const
|
||||
{
|
||||
len = hlen_;
|
||||
return html_;
|
||||
}
|
||||
const char* get_text(size_t& len) const
|
||||
{
|
||||
len = tlen_;
|
||||
return text_;
|
||||
}
|
||||
const std::vector<mail_attach*>* get_attachments() const
|
||||
{
|
||||
return attachments_;
|
||||
}
|
||||
|
||||
bool save_to(ostream& out) const;
|
||||
bool save_to(string& out) const;
|
||||
bool save_html(const char* in, size_t len, string& out) const;
|
||||
bool save_text(const char* in, size_t len, string& out) const;
|
||||
bool save_relative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen,
|
||||
const std::vector<mail_attach*>& attachments,
|
||||
string& out) const;
|
||||
bool save_alternative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen, string& out) const;
|
||||
|
||||
private:
|
||||
string charset_;
|
||||
string content_type_;
|
||||
string transfer_encoding_;
|
||||
mime_code* coder_;
|
||||
string boundary_;
|
||||
http_ctype ctype_;
|
||||
int mime_stype_;
|
||||
|
||||
const char* html_;
|
||||
size_t hlen_;
|
||||
const char* text_;
|
||||
size_t tlen_;
|
||||
const std::vector<mail_attach*>* attachments_;
|
||||
|
||||
bool build(const char* in, size_t len, string& out) const;
|
||||
void set_content_type(const char* content_type);
|
||||
};
|
||||
|
||||
} // namespace acl
|
145
lib_acl_cpp/include/acl_cpp/smtp/mail_message.hpp
Normal file
@ -0,0 +1,145 @@
|
||||
#pragma once
|
||||
#include "acl_cpp/acl_cpp_define.hpp"
|
||||
#include "acl_cpp/stdlib/string.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace acl {
|
||||
|
||||
class dbuf_pool;
|
||||
struct rfc822_addr;
|
||||
class mail_attach;
|
||||
class mail_body;
|
||||
class ofstream;
|
||||
|
||||
class ACL_CPP_API mail_message
|
||||
{
|
||||
public:
|
||||
mail_message(const char* charset = "utf-8");
|
||||
~mail_message();
|
||||
|
||||
mail_message& set_auth(const char* user, const char* pass);
|
||||
mail_message& set_from(const char* from, const char* name = NULL);
|
||||
mail_message& set_sender(const char* sender, const char* name = NULL);
|
||||
mail_message& set_reply_to(const char* reply_to, const char* name = NULL);
|
||||
mail_message& set_return_path(const char* return_path);
|
||||
mail_message& set_delivered_to(const char* delivered_to);
|
||||
mail_message& add_recipients(const char* recipients);
|
||||
mail_message& add_to(const char* to);
|
||||
mail_message& add_cc(const char* cc);
|
||||
mail_message& add_bcc(const char* bcc);
|
||||
mail_message& set_subject(const char* subject);
|
||||
mail_message& add_header(const char* name, const char* value);
|
||||
mail_message& set_body(const mail_body* body);
|
||||
mail_message& add_attachment(const char* filepath,
|
||||
const char* content_type);
|
||||
|
||||
bool save_to(const char* filepath);
|
||||
|
||||
bool build_header(string& out);
|
||||
|
||||
const char* get_email() const
|
||||
{
|
||||
return filepath_;
|
||||
}
|
||||
|
||||
const char* get_auth_user() const
|
||||
{
|
||||
return auth_user_;
|
||||
}
|
||||
|
||||
const char* get_auth_pass() const
|
||||
{
|
||||
return auth_pass_;
|
||||
}
|
||||
|
||||
const rfc822_addr* get_from() const
|
||||
{
|
||||
return from_;
|
||||
}
|
||||
|
||||
const rfc822_addr* get_sender() const
|
||||
{
|
||||
return sender_;
|
||||
}
|
||||
|
||||
const rfc822_addr* get_reply_to() const
|
||||
{
|
||||
return reply_to_;
|
||||
}
|
||||
|
||||
const rfc822_addr* get_return_path() const
|
||||
{
|
||||
return return_path_;
|
||||
}
|
||||
|
||||
const rfc822_addr* get_delivered_to() const
|
||||
{
|
||||
return delivered_to_;
|
||||
}
|
||||
|
||||
const std::vector<rfc822_addr*>& get_to() const
|
||||
{
|
||||
return to_list_;
|
||||
}
|
||||
|
||||
const std::vector<rfc822_addr*>& get_cc() const
|
||||
{
|
||||
return cc_list_;
|
||||
}
|
||||
|
||||
const std::vector<rfc822_addr*>& get_bcc() const
|
||||
{
|
||||
return bcc_list_;
|
||||
}
|
||||
|
||||
const std::vector<rfc822_addr*>& get_recipients() const
|
||||
{
|
||||
return recipients_;
|
||||
}
|
||||
|
||||
const char* get_header_value(const char* name) const;
|
||||
|
||||
const char* get_filepath() const
|
||||
{
|
||||
return filepath_;
|
||||
}
|
||||
|
||||
static void create_boundary(const char* id, string& out);
|
||||
|
||||
private:
|
||||
dbuf_pool* dbuf_;
|
||||
char* charset_;
|
||||
char* transfer_encoding_;
|
||||
|
||||
char* auth_user_;
|
||||
char* auth_pass_;
|
||||
rfc822_addr* from_;
|
||||
rfc822_addr* sender_;
|
||||
rfc822_addr* reply_to_;
|
||||
rfc822_addr* return_path_;
|
||||
rfc822_addr* delivered_to_;
|
||||
std::vector<rfc822_addr*> to_list_;
|
||||
std::vector<rfc822_addr*> cc_list_;
|
||||
std::vector<rfc822_addr*> bcc_list_;
|
||||
std::vector<rfc822_addr*> recipients_;
|
||||
char* subject_;
|
||||
std::vector<std::pair<char*, char*> > headers_;
|
||||
std::vector<mail_attach*> attachments_;
|
||||
const mail_body* body_;
|
||||
size_t body_len_;
|
||||
char* filepath_;
|
||||
|
||||
void add_addrs(const char* in, std::vector<rfc822_addr*>& out);
|
||||
bool append_addr(const rfc822_addr& addr, string& out);
|
||||
bool append_addr(const char* name, const rfc822_addr& addr,
|
||||
string& out);
|
||||
bool append_addrs(const char* name,
|
||||
const std::vector<rfc822_addr*>& addrs, string& out);
|
||||
bool append_message_id(string& out);
|
||||
bool append_subject(const char* subject, string& out);
|
||||
bool append_date(string& out);
|
||||
bool append_header(ofstream& fp);
|
||||
bool append_multipart(ofstream& fp);
|
||||
};
|
||||
|
||||
} // namespace acl
|
128
lib_acl_cpp/include/acl_cpp/smtp/smtp_client.hpp
Normal file
@ -0,0 +1,128 @@
|
||||
#pragma once
|
||||
#include "acl_cpp/acl_cpp_define.hpp"
|
||||
#include "acl_cpp/stream/socket_stream.hpp"
|
||||
#include <vector>
|
||||
|
||||
struct SMTP_CLIENT;
|
||||
|
||||
namespace acl {
|
||||
|
||||
class istream;
|
||||
class polarssl_conf;
|
||||
class mail_message;
|
||||
|
||||
class ACL_CPP_API smtp_client
|
||||
{
|
||||
public:
|
||||
smtp_client(const char* addr, int conn_timeout, int rw_timeout);
|
||||
~smtp_client();
|
||||
|
||||
/**
|
||||
* 调用本函数发送邮件数据至邮件服务端
|
||||
* @param message {const mail_messsage&} 邮件相关信息,必须提前构建好
|
||||
* @param email {const char*} 非空时,优先使用此文件做为邮件体数据发送
|
||||
* @
|
||||
*/
|
||||
bool send(const mail_message& message, const char* email = NULL);
|
||||
|
||||
/**
|
||||
* 设置 SSL 数据传输模式
|
||||
* @param ssl_conf {polarssl_conf*} 非空时,指定采用 SSL 传输模式
|
||||
* @return {smtp_client&}
|
||||
*/
|
||||
smtp_client& set_ssl(polarssl_conf* ssl_conf);
|
||||
|
||||
/**
|
||||
* 获得上次 SMTP 交互过程服务端返回的状态码
|
||||
* @return {int}
|
||||
*/
|
||||
int get_code() const;
|
||||
|
||||
/**
|
||||
* 获得上次 SMTP 交互过程服务端返回的状态信息
|
||||
* @return {const char*}
|
||||
*/
|
||||
const char* get_status() const;
|
||||
|
||||
/**
|
||||
* 发送邮件体数据,可以循环调用本函数,但数据内容必须是严格的邮件格式
|
||||
* @param data {const char*} 邮件内容
|
||||
* @param len {size_t} data 邮件数据长度
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool write(const char* data, size_t len);
|
||||
|
||||
/**
|
||||
* 发送邮件体数据,可以循环调用本函数,但数据内容必须是严格的邮件格式
|
||||
* @param fmt {const char*} 变参格式
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool format(const char* fmt, ...);
|
||||
|
||||
/**
|
||||
* 发送邮件体数据,可以循环调用本函数,但数据内容必须是严格的邮件格式
|
||||
* @param fmt {const char*} 变参格式
|
||||
* @param ap {va_list}
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool vformat(const char* fmt, va_list ap);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 以下是打开连接和发送信封的分步步骤
|
||||
bool open();
|
||||
bool get_banner();
|
||||
bool greet();
|
||||
bool auth_login(const char* user, const char* pass);
|
||||
bool mail_from(const char* from);
|
||||
bool rcpt_to(const char* to);
|
||||
|
||||
/**
|
||||
* 发送一封完整的邮件,需要给出邮件存储于磁盘上的路径
|
||||
* @param filepath {const char*} 邮件文件路径
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool send_email(const char* filepath);
|
||||
|
||||
/**
|
||||
* 开始发送邮件数据命令:DATA
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool data_begin();
|
||||
/**
|
||||
* 邮件发送完毕后,最后必须调用本函数告诉邮件服务器发送数据结束
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool data_end();
|
||||
|
||||
/**
|
||||
* 断开与邮件服务器的连接
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool quit();
|
||||
|
||||
/**
|
||||
* NOOP 命令
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool noop();
|
||||
|
||||
/**
|
||||
* 重置与邮件服务器的连接状态
|
||||
* @return {bool} 命令操作是否成功
|
||||
*/
|
||||
bool reset();
|
||||
|
||||
private:
|
||||
polarssl_conf* ssl_conf_;
|
||||
char* addr_;
|
||||
int conn_timeout_;
|
||||
int rw_timeout_;
|
||||
SMTP_CLIENT* client_;
|
||||
socket_stream stream_;
|
||||
bool ehlo_;
|
||||
|
||||
bool to_recipients(const std::vector<rfc822_addr*>& recipients);
|
||||
};
|
||||
|
||||
} // namespace acl
|
@ -83,4 +83,14 @@ private:
|
||||
void init_mutex(bool use_spinlock);
|
||||
};
|
||||
|
||||
class ACL_CPP_API lock_guard
|
||||
{
|
||||
public:
|
||||
lock_guard(locker& lk);
|
||||
~lock_guard();
|
||||
|
||||
private:
|
||||
locker& lk_;
|
||||
};
|
||||
|
||||
} // namespace acl
|
||||
|
@ -417,6 +417,9 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<File
|
||||
RelativePath=".\src\stdlib\thread_pool.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\thread_queue.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\url_coder.cpp">
|
||||
</File>
|
||||
@ -880,6 +883,13 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
RelativePath=".\src\event\event_timer.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="smtp"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\smtp\smtp_client.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="disque"
|
||||
Filter="">
|
||||
@ -1037,6 +1047,9 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\thread_pool.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\thread_queue.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\url_coder.hpp">
|
||||
</File>
|
||||
@ -1408,6 +1421,13 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
RelativePath=".\include\acl_cpp\event\event_timer.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="smtp"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\smtp\smtp_client.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="disque"
|
||||
Filter="">
|
||||
|
@ -985,6 +985,10 @@
|
||||
RelativePath=".\src\stdlib\thread_pool.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\thread_queue.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\url_coder.cpp"
|
||||
>
|
||||
@ -1126,6 +1130,26 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="smtp"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\smtp\mail_attach.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\smtp\mail_body.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\smtp\mail_message.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\smtp\smtp_client.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="头文件"
|
||||
@ -1675,6 +1699,10 @@
|
||||
RelativePath=".\include\acl_cpp\stdlib\thread_pool.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\thread_queue.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\url_coder.hpp"
|
||||
>
|
||||
@ -1808,6 +1836,26 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="smtp"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\smtp\mail_attach.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\smtp\mail_body.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\smtp\mail_message.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\smtp\smtp_client.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="资源文件"
|
||||
|
@ -319,6 +319,10 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<ClCompile Include="src\session\memcache_session.cpp" />
|
||||
<ClCompile Include="src\session\redis_session.cpp" />
|
||||
<ClCompile Include="src\session\session.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_attach.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_body.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_message.cpp" />
|
||||
<ClCompile Include="src\smtp\smtp_client.cpp" />
|
||||
<ClCompile Include="src\stdlib\charset_conv.cpp" />
|
||||
<ClCompile Include="src\stdlib\dbuf_pool.cpp" />
|
||||
<ClCompile Include="src\stdlib\dns_service.cpp" />
|
||||
@ -335,6 +339,7 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<ClCompile Include="src\stdlib\string.cpp" />
|
||||
<ClCompile Include="src\stdlib\thread.cpp" />
|
||||
<ClCompile Include="src\stdlib\thread_pool.cpp" />
|
||||
<ClCompile Include="src\stdlib\thread_queue.cpp" />
|
||||
<ClCompile Include="src\stdlib\url_coder.cpp" />
|
||||
<ClCompile Include="src\stdlib\util.cpp" />
|
||||
<ClCompile Include="src\stdlib\xml.cpp" />
|
||||
@ -472,6 +477,10 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<ClInclude Include="include\acl_cpp\session\memcache_session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\session\redis_session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\session\session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_attach.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_body.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_message.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\smtp_client.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\charset_conv.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\dbuf_pool.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\dns_service.hpp" />
|
||||
@ -490,6 +499,7 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<ClInclude Include="include\acl_cpp\stdlib\string.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\thread.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\thread_pool.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\thread_queue.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\url_coder.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\util.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\vld.h" />
|
||||
|
@ -487,6 +487,21 @@
|
||||
<ClCompile Include="src\db\mysql_conf.cpp">
|
||||
<Filter>src\db</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\stdlib\thread_queue.cpp">
|
||||
<Filter>src\stdlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\smtp_client.cpp">
|
||||
<Filter>src\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_attach.cpp">
|
||||
<Filter>src\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_body.cpp">
|
||||
<Filter>src\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_message.cpp">
|
||||
<Filter>src\smtp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\acl_stdafx.hpp">
|
||||
@ -1005,6 +1020,21 @@
|
||||
<ClInclude Include="include\acl_cpp\db\mysql_conf.hpp">
|
||||
<Filter>include\db</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\stdlib\thread_queue.hpp">
|
||||
<Filter>include\stdlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\smtp_client.hpp">
|
||||
<Filter>include\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_attach.hpp">
|
||||
<Filter>include\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_body.hpp">
|
||||
<Filter>include\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_message.hpp">
|
||||
<Filter>include\smtp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="lib_acl_cpp_vc2010.rc" />
|
||||
@ -1122,5 +1152,11 @@
|
||||
<Filter Include="src\disque">
|
||||
<UniqueIdentifier>{8cd1597f-0491-4bb1-81d1-4a8e9f30edf5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="include\smtp">
|
||||
<UniqueIdentifier>{1a00c331-81cd-42b7-bf85-1715c2801ed1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\smtp">
|
||||
<UniqueIdentifier>{49f8268a-7d4d-4e7e-930c-13e26dc8cd2c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -513,6 +513,10 @@ copy $(TargetName).pdb ..\dist\lib\win64\$(TargetName).pdb /Y
|
||||
<ClCompile Include="src\session\memcache_session.cpp" />
|
||||
<ClCompile Include="src\session\redis_session.cpp" />
|
||||
<ClCompile Include="src\session\session.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_attach.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_body.cpp" />
|
||||
<ClCompile Include="src\smtp\mail_message.cpp" />
|
||||
<ClCompile Include="src\smtp\smtp_client.cpp" />
|
||||
<ClCompile Include="src\stdlib\charset_conv.cpp" />
|
||||
<ClCompile Include="src\stdlib\dbuf_pool.cpp" />
|
||||
<ClCompile Include="src\stdlib\dns_service.cpp" />
|
||||
@ -667,6 +671,10 @@ copy $(TargetName).pdb ..\dist\lib\win64\$(TargetName).pdb /Y
|
||||
<ClInclude Include="include\acl_cpp\session\memcache_session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\session\redis_session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\session\session.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_attach.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_body.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_message.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\smtp\smtp_client.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\charset_conv.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\dbuf_pool.hpp" />
|
||||
<ClInclude Include="include\acl_cpp\stdlib\dns_service.hpp" />
|
||||
|
@ -490,6 +490,18 @@
|
||||
<ClCompile Include="src\db\mysql_conf.cpp">
|
||||
<Filter>Source Files\db</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\smtp_client.cpp">
|
||||
<Filter>Source Files\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_message.cpp">
|
||||
<Filter>Source Files\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_attach.cpp">
|
||||
<Filter>Source Files\smtp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\smtp\mail_body.cpp">
|
||||
<Filter>Source Files\smtp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\acl_stdafx.hpp">
|
||||
@ -1011,6 +1023,18 @@
|
||||
<ClInclude Include="include\acl_cpp\db\mysql_conf.hpp">
|
||||
<Filter>Header Files\db</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\smtp_client.hpp">
|
||||
<Filter>Header Files\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_message.hpp">
|
||||
<Filter>Header Files\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_attach.hpp">
|
||||
<Filter>Header Files\smtp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\acl_cpp\smtp\mail_body.hpp">
|
||||
<Filter>Header Files\smtp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
@ -1130,6 +1154,12 @@
|
||||
<Filter Include="Source Files\disque">
|
||||
<UniqueIdentifier>{a6fc0af4-630b-4f95-9d1a-eb8fcaf1c78f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\smtp">
|
||||
<UniqueIdentifier>{bdeed402-2f54-4ea3-8f25-f3e8663fbe8f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\smtp">
|
||||
<UniqueIdentifier>{d34f52dc-798d-4c26-b23f-25210566d571}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="lib_acl_cpp_vc2012.rc" />
|
||||
|
@ -312,7 +312,7 @@ static void do_alone(void)
|
||||
acl::log::stdout_open(true);
|
||||
const char* addr = "0.0.0.0:8081";
|
||||
printf("listen: %s ...\r\n", addr);
|
||||
service.run_alone(addr, NULL, 1); // 单独运行方式
|
||||
service.run_alone(addr, NULL, 0); // 单独运行方式
|
||||
}
|
||||
|
||||
// WEB CGI ģʽ
|
||||
|
@ -13,7 +13,7 @@ int main(void)
|
||||
dp->set_idle(1);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
db_handle* dh = dp->peek();
|
||||
db_handle* dh = (db_handle*) dp->peek();
|
||||
dbs.push_back(dh);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "util.h"
|
||||
|
||||
static acl::string __queue("greeting");
|
||||
static acl::string __jobpre("test_job");
|
||||
@ -35,7 +36,7 @@ static bool test_ackjob(acl::disque& cmd,
|
||||
int ret = cmd.ackjob(job_ids);
|
||||
if (ret < 0)
|
||||
printf("ackjob error: %s\r\n", cmd.result_error());
|
||||
else if (i >= 10)
|
||||
else if (i >= 20)
|
||||
return true;
|
||||
|
||||
printf("%s -> addr: %s, tid: %lu\r\n", __FUNCTION__,
|
||||
@ -43,10 +44,13 @@ static bool test_ackjob(acl::disque& cmd,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool test_getjob(acl::disque& cmd, int i)
|
||||
static bool test_getjob(acl::disque& cmd, int max, int& i, int count)
|
||||
{
|
||||
if (i >= max)
|
||||
return true;
|
||||
|
||||
std::vector<acl::string> queues;
|
||||
size_t timeout = 10, count = 10;
|
||||
size_t timeout = 10;
|
||||
|
||||
queues.push_back(__queue);
|
||||
|
||||
@ -72,11 +76,14 @@ static bool test_getjob(acl::disque& cmd, int i)
|
||||
if (!job_ids.empty() && !test_ackjob(cmd, job_ids, i))
|
||||
return false;
|
||||
|
||||
if (i >= 10)
|
||||
i += jobs->size();
|
||||
|
||||
if (i >= 2 * (int) count)
|
||||
return true;
|
||||
|
||||
printf("%s -> addr: %s, tid: %lu\r\n", __FUNCTION__,
|
||||
cmd.get_client_addr(), acl::thread::thread_self());
|
||||
printf("%s -> addr: %s, tid: %lu, count: %d, %d\r\n", __FUNCTION__,
|
||||
cmd.get_client_addr(), acl::thread::thread_self(),
|
||||
(int) count, (int) jobs->size());
|
||||
|
||||
std::vector<acl::disque_job*>::const_iterator cit2;
|
||||
for (cit2 = jobs->begin(); cit2 != jobs->end(); ++cit2)
|
||||
@ -137,8 +144,8 @@ class test_thread : public acl::thread
|
||||
{
|
||||
public:
|
||||
test_thread(acl::disque_client_cluster& cluster,
|
||||
acl::disque_cond& cond, const char* cmd, int n)
|
||||
: cluster_(cluster), cond_(cond), cmd_(cmd), n_(n) {}
|
||||
acl::disque_cond& cond, const char* cmd, int n, int count)
|
||||
: cluster_(cluster), cond_(cond), cmd_(cmd), n_(n), m_(count) {}
|
||||
|
||||
~test_thread() {}
|
||||
|
||||
@ -147,15 +154,18 @@ protected:
|
||||
{
|
||||
bool ret;
|
||||
acl::disque cmd;
|
||||
int max_conns = 1000;
|
||||
int max_conns = 1000, i;
|
||||
cmd.set_cluster(&cluster_, max_conns);
|
||||
|
||||
for (int i = 0; i < n_; i++)
|
||||
struct timeval begin;
|
||||
gettimeofday(&begin, NULL);
|
||||
|
||||
for (i = 0; i < n_;)
|
||||
{
|
||||
if (cmd_ == "addjob")
|
||||
ret = test_addjob(cmd, cond_, i);
|
||||
else if (cmd_ == "getjob")
|
||||
ret = test_getjob(cmd, i);
|
||||
ret = test_getjob(cmd, n_, i, m_);
|
||||
else if (cmd_ == "qlen")
|
||||
ret = test_qlen(cmd, i);
|
||||
else if (cmd_ == "qpeek")
|
||||
@ -166,9 +176,23 @@ protected:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == false)
|
||||
if (ret == false || i >= n_)
|
||||
break;
|
||||
i++;
|
||||
if (i % 1000 == 0)
|
||||
{
|
||||
char tmp[128];
|
||||
acl::safe_snprintf(tmp, sizeof(tmp), "%d", i);
|
||||
acl::meter_time(__FILE__, __LINE__, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
struct timeval end;
|
||||
gettimeofday(&end, NULL);
|
||||
double spent = util::stamp_sub(&end, &begin);
|
||||
|
||||
printf(">>>total: %d, curr: %d, spent: %.2f, speed: %.2f\r\n",
|
||||
i, i, spent, i * 1000 / (spent > 0 ? spent : 1));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -178,6 +202,7 @@ private:
|
||||
acl::disque_cond& cond_;
|
||||
acl::string cmd_;
|
||||
int n_;
|
||||
int m_;
|
||||
};
|
||||
|
||||
static void usage(const char* procname)
|
||||
@ -194,6 +219,7 @@ static void usage(const char* procname)
|
||||
"-T ttl\r\n"
|
||||
"-M maxlen\r\n"
|
||||
"-A [async]\r\n"
|
||||
"-w result_max_for_every_getjob[default: 10]\r\n"
|
||||
"-a cmd[addjob|getjob|qlen|qpeek]\r\n",
|
||||
procname);
|
||||
|
||||
@ -207,12 +233,12 @@ static void usage(const char* procname)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ch, n = 1, conn_timeout = 10, rw_timeout = 10;
|
||||
int ch, n = 1, conn_timeout = 10, rw_timeout = 10, get_count = 10;
|
||||
int max_threads = 10;
|
||||
acl::disque_cond cond;
|
||||
acl::string addrs("127.0.0.1:7711,127.0.0.1:7712,127.0.0.1:7713"), cmd;
|
||||
|
||||
while ((ch = getopt(argc, argv, "hs:n:C:I:c:a:D:R:r:T:M:A")) > 0)
|
||||
while ((ch = getopt(argc, argv, "hs:n:C:I:c:a:D:R:r:T:M:Aw:")) > 0)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
@ -255,6 +281,9 @@ int main(int argc, char* argv[])
|
||||
case 'A':
|
||||
cond.set_async(true);
|
||||
break;
|
||||
case 'w':
|
||||
get_count = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -275,7 +304,7 @@ int main(int argc, char* argv[])
|
||||
for (int i = 0; i < max_threads; i++)
|
||||
{
|
||||
test_thread* thread = new test_thread(cluster, cond,
|
||||
cmd.c_str(), n);
|
||||
cmd.c_str(), n, get_count);
|
||||
threads.push_back(thread);
|
||||
thread->set_detachable(false);
|
||||
thread->start();
|
||||
|
@ -5,9 +5,11 @@ all:
|
||||
@(cd mime_qp; make)
|
||||
@(cd mime_base64; make)
|
||||
@(cd mime_xxcode; make)
|
||||
@(cd mail_build; make)
|
||||
|
||||
clean:
|
||||
@(cd mime; make clean)
|
||||
@(cd mime_qp; make clean)
|
||||
@(cd mime_base64; make clean)
|
||||
@(cd mime_xxcode; make clean)
|
||||
@(cd mail_build; make clean)
|
||||
|
3
lib_acl_cpp/samples/mime/mail_build/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
base_path = ../../..
|
||||
include ../../Makefile.in
|
||||
PROG = mail_build
|
240
lib_acl_cpp/samples/mime/mail_build/mail_build.vcproj
Normal file
@ -0,0 +1,240 @@
|
||||
<?xml version="1.0" encoding="gb2312"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="mail_build"
|
||||
ProjectGUID="{5DC79C83-9DE8-46B3-A172-8A4E3371878B}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="lib_acl_vc2003d.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;VC2003"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib wsock32.lib lib_acl_vc2003.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugDll|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;VC2003;ACL_CPP_DLL;ACL_DLL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Releasedll|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;VC2003;ACL_CPP_DLL;ACL_DLL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Ô´Îļþ"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\main.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Í·Îļþ"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="×ÊÔ´Îļþ"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
189
lib_acl_cpp/samples/mime/mail_build/mail_build.vcxproj
Normal file
@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="DebugDll|Win32">
|
||||
<Configuration>DebugDll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Releasedll|Win32">
|
||||
<Configuration>Releasedll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{11AE8D75-CAF0-445A-980C-662CFDDC0B38}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">true</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;..\..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;lib_acl_vc2010d.lib;lib_acl_cpp_vc2010d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;..\..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;wsock32.lib;lib_acl_vc2010.lib;lib_acl_cpp_vc2010.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;..\..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_d.lib;lib_acl_cpp_d.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;..\..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
365
lib_acl_cpp/samples/mime/mail_build/mail_build_vc2008.vcproj
Normal file
@ -0,0 +1,365 @@
|
||||
<?xml version="1.0" encoding="gb2312"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mail_build"
|
||||
ProjectGUID="{D21BD1E5-C188-4061-BA52-70ECD86BFBDA}"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\lib_acl\include;"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\lib_acl\include;"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib wsock32.lib "
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugDll|Win32"
|
||||
OutputDirectory=".\"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\lib_acl\include;"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;VC2003;ACL_CPP_DLL;ACL_DLL"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Releasedll|Win32"
|
||||
OutputDirectory=".\"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\lib_acl\include;"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;VC2003;ACL_CPP_DLL;ACL_DLL"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
OutputFile="$(OutDir)/mail_build.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\..\lib\win32"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/mail_build.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Ô´Îļþ"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\main.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Í·Îļþ"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="×ÊÔ´Îļþ"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
361
lib_acl_cpp/samples/mime/mail_build/mail_build_vc2012.vcxproj
Normal file
@ -0,0 +1,361 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="DebugDll|Win32">
|
||||
<Configuration>DebugDll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugDll|x64">
|
||||
<Configuration>DebugDll</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Releasedll|Win32">
|
||||
<Configuration>Releasedll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Releasedll|x64">
|
||||
<Configuration>Releasedll</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DBC43D27-7731-409D-A931-26D141A5FC6B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>mail_build</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'">true</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'">
|
||||
<OutDir>.\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>.\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">
|
||||
<OutDir>.\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>.\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;..\..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;lib_acl_vc2012d.lib;lib_acl_cpp_vc2012d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\lib\win32;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;lib_acl_vc2012d.lib;lib_acl_cpp_vc2012d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\lib\win64;..\..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;wsock32.lib;lib_acl_vc2012.lib;lib_acl_cpp_vc2012.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;wsock32.lib;lib_acl_vc2012.lib;lib_acl_cpp_vc2012.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_d.lib;lib_acl_cpp_d.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_d.lib;lib_acl_cpp_d.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Releasedll|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;ACL_CPP_DLL;ACL_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl.lib;lib_acl_cpp.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)mail_build.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib;..\..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mail_build.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
256
lib_acl_cpp/samples/mime/mail_build/main.cpp
Normal file
@ -0,0 +1,256 @@
|
||||
#include <string>
|
||||
#include "lib_acl.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include <vector>
|
||||
|
||||
static void build_html(void)
|
||||
{
|
||||
acl::mail_message message("gbk");
|
||||
|
||||
message.set_from("zsxxsz@263.net")
|
||||
.set_sender("zsx1@263.net")
|
||||
.set_reply_to("zsx2@263.net")
|
||||
.add_to("\"郑树新1\" <zsx1@sina.com>; \"郑树新2\" <zsx2@sina.com>")
|
||||
.add_cc("\"郑树新3\" <zsx1@163.com>; \"郑树新4\" <zsx2@163.com>")
|
||||
.set_subject("主题:中国人民银行!")
|
||||
.add_header("X-Forward-For", "<zsx@263.net>");
|
||||
|
||||
const char* html = "<html><body>中国人民银行 HTML 格式</body></html>";
|
||||
acl::mail_body body("gbk");
|
||||
body.set_html(html, strlen(html));
|
||||
message.set_body(&body);
|
||||
|
||||
const char* filepath = "./html.eml";
|
||||
if (message.save_to(filepath) == false)
|
||||
printf("compose %s error: %s\r\n", filepath, acl::last_serror());
|
||||
else
|
||||
printf("compose %s ok\r\n", filepath);
|
||||
}
|
||||
|
||||
static void build_text(void)
|
||||
{
|
||||
acl::mail_message message("gbk");
|
||||
|
||||
message.set_from("zsxxsz@263.net")
|
||||
.set_sender("zsx1@263.net")
|
||||
.set_reply_to("zsx2@263.net")
|
||||
.add_to("\"郑树新1\" <zsx1@sina.com>; \"郑树新2\" <zsx2@sina.com>")
|
||||
.add_cc("\"郑树新3\" <zsx1@163.com>; \"郑树新4\" <zsx2@163.com>")
|
||||
.set_subject("主题:中国人民银行!");
|
||||
|
||||
const char* text = "中国人民银行 TEXT 格式";
|
||||
acl::mail_body body("gbk");
|
||||
body.set_text(text, strlen(text));
|
||||
message.set_body(&body);
|
||||
|
||||
const char* filepath = "./text.eml";
|
||||
if (message.save_to(filepath) == false)
|
||||
printf("compose %s error: %s\r\n", filepath, acl::last_serror());
|
||||
else
|
||||
printf("compose %s ok\r\n", filepath);
|
||||
}
|
||||
|
||||
static void build_alternative(void)
|
||||
{
|
||||
acl::mail_message message("gbk");
|
||||
|
||||
message.set_from("zsxxsz@263.net", "郑树新")
|
||||
.set_sender("zsx1@263.net")
|
||||
.set_reply_to("zsx2@263.net")
|
||||
.add_to("\"郑树新1\" <zsx1@sina.com>; \"郑树新2\" <zsx2@sina.com>")
|
||||
.add_cc("\"郑树新3\" <zsx1@163.com>; \"郑树新4\" <zsx2@163.com>")
|
||||
.set_subject("主题:中国人民银行!");
|
||||
message.add_attachment("main.cpp", "text/plain")
|
||||
.add_attachment("Makefile", "text/plain");
|
||||
|
||||
const char* text = "中国人民银行 TEXT 格式";
|
||||
const char* html = "<html><body>中国人民银行 HTML 格式</body></html>";
|
||||
acl::mail_body body("gbk");
|
||||
body.set_alternative(html, strlen(html), text, strlen(text));
|
||||
message.set_body(&body);
|
||||
|
||||
const char* filepath = "./alternative.eml";
|
||||
if (message.save_to(filepath) == false)
|
||||
printf("compose %s error: %s\r\n", filepath, acl::last_serror());
|
||||
else
|
||||
printf("compose %s ok\r\n", filepath);
|
||||
}
|
||||
|
||||
static void build_relative(void)
|
||||
{
|
||||
acl::mail_message message("gbk");
|
||||
|
||||
message.set_from("zsxxsz@263.net", "郑树新")
|
||||
.set_sender("zsx1@263.net")
|
||||
.set_reply_to("zsx2@263.net")
|
||||
.add_to("\"郑树新1\" <zsx1@sina.com>; \"郑树新2\" <zsx2@sina.com>")
|
||||
.add_cc("\"郑树新3\" <zsx1@163.com>; \"郑树新4\" <zsx2@163.com>")
|
||||
.set_subject("主题:中国人民银行!");
|
||||
|
||||
const char* text_file = "./var/text.txt";
|
||||
const char* html_file = "./var/html.txt";
|
||||
acl::string text, html;
|
||||
if (acl::ifstream::load(text_file, &text) == false)
|
||||
{
|
||||
printf("load %s error %s\r\n", text_file, acl::last_serror());
|
||||
return;
|
||||
}
|
||||
if (acl::ifstream::load(html_file, &html) == false)
|
||||
{
|
||||
printf("load %s error %s\r\n", html_file, acl::last_serror());
|
||||
return;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
acl::dbuf_pool* dbuf = new acl::dbuf_pool;
|
||||
std::vector<acl::mail_attach*> attachments;
|
||||
acl::mail_attach* attach;
|
||||
|
||||
attach = new((char*) dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/spacer.gif", "image/gif", "gbk");
|
||||
attach->set_content_id("__0@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/tl.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__1@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/t_bg.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__2@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/tr.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__3@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/m_bgl.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__4@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/m.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__5@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/m_bgr.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__6@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/dl.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__7@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/d_bg.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__8@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/dr.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__9@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/t_ml.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__10@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/m_tl.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__11@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/m_dr.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__12@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
attach = new(dbuf->dbuf_alloc(sizeof(acl::mail_attach)))
|
||||
acl::mail_attach("./var/img/d_mr.jpg", "image/jpg", "gbk");
|
||||
attach->set_content_id("__13@Foxmail.net");
|
||||
attachments.push_back(attach);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
acl::mail_body body("gbk");
|
||||
body.set_relative(html.c_str(), html.size(),
|
||||
text.c_str(), text.size(), attachments);
|
||||
message.set_body(&body);
|
||||
|
||||
const char* filepath = "./relative.eml";
|
||||
if (message.save_to(filepath) == false)
|
||||
printf("compose %s error: %s\r\n", filepath, acl::last_serror());
|
||||
else
|
||||
printf("compose %s ok\r\n", filepath);
|
||||
|
||||
// 调用所有动态对象的析构函数
|
||||
std::vector<acl::mail_attach*>::iterator it = attachments.begin();
|
||||
for (; it != attachments.end(); ++it)
|
||||
(*it)->~mail_attach();
|
||||
|
||||
// 一次性释放前面动态分配的内存
|
||||
dbuf->destroy();
|
||||
}
|
||||
|
||||
static void usage(const char* procname)
|
||||
{
|
||||
printf("usage: %s -h [help]\r\n"
|
||||
"-t mime_type[1: html, 2: text, 3: alternative, 4: relative\r\n",
|
||||
procname);
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
printf("Enter any key to exit...\r\n");
|
||||
getchar();
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ch;
|
||||
int mime_type = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "ht:")) > 0)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
case 't':
|
||||
mime_type = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mime_type == 1)
|
||||
build_html();
|
||||
else if (mime_type == 2)
|
||||
build_text();
|
||||
else if (mime_type == 3)
|
||||
build_alternative();
|
||||
else if (mime_type == 4)
|
||||
build_relative();
|
||||
else
|
||||
{
|
||||
build_html();
|
||||
build_text();
|
||||
build_alternative();
|
||||
build_relative();
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
printf("Enter any key to exit...\r\n");
|
||||
getchar();
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
3
lib_acl_cpp/samples/mime/mail_build/valgrind.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
valgrind --tool=memcheck --leak-check=yes -v ./mail_build
|
100
lib_acl_cpp/samples/mime/mail_build/var/html.txt
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML xmlns:o = "urn:schemas-microsoft-com:office:office"><HEAD>
|
||||
<META http-equiv=Content-Type content="text/html; charset=gb2312">
|
||||
<STYLE type=text/css>BODY {
|
||||
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
|
||||
}
|
||||
BLOCKQUOTE {
|
||||
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
|
||||
}
|
||||
OL {
|
||||
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
|
||||
}
|
||||
UL {
|
||||
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
|
||||
}
|
||||
</STYLE>
|
||||
|
||||
<META content="MSHTML 6.00.2900.6003" name=GENERATOR></HEAD>
|
||||
<BODY style="MARGIN-TOP: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px"><!-- 52_302903_e11415f126781bf -->
|
||||
<TABLE id=Table_01
|
||||
style="BACKGROUND: #fff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif"
|
||||
cellSpacing=0 cellPadding=0 width="99.99%" border=0>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD vAlign=top background=cid:__1@Foxmail.net><IMG height=1
|
||||
src="cid:__0@Foxmail.net" width=49></TD>
|
||||
<TD vAlign=top background=cid:__2@Foxmail.net>
|
||||
<TABLE cellSpacing=0 cellPadding=0 width=87 border=0>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD background=cid:__10@Foxmail.net><IMG height=50
|
||||
src="cid:__0@Foxmail.net" width=87></TD></TR></TBODY></TABLE></TD>
|
||||
<TD vAlign=top background=cid:__3@Foxmail.net><IMG height=50
|
||||
src="cid:__0@Foxmail.net" width=84></TD></TR>
|
||||
<TR>
|
||||
<TD vAlign=top align=right background=cid:__4@Foxmail.net>
|
||||
<TABLE cellSpacing=0 cellPadding=0 width=50 border=0>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD background=cid:__11@Foxmail.net><IMG height=134
|
||||
src="cid:__0@Foxmail.net" width=49></TD></TR></TBODY></TABLE></TD>
|
||||
<TD
|
||||
style="PADDING-RIGHT: 50px; BACKGROUND-POSITION: right bottom; PADDING-LEFT: 40px; PADDING-BOTTOM: 60px; PADDING-TOP: 40px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 300px"
|
||||
vAlign=top width="100%" background=cid:__5@Foxmail.net bgColor=#fffcf3>
|
||||
<TABLE style="MARGIN-TOP: 0px; cellpadding: 0px; cellspacing: 0px"
|
||||
width="100%" valign="top">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD style="LINE-HEIGHT: 160%">
|
||||
<DIV
|
||||
style="WIDTH: 100%; WORD-BREAK: break-all; WHITE-SPACE: normal"><FONT
|
||||
face=Verdana color=#000080 size=2>
|
||||
<DIV>
|
||||
<DIV><FONT size=3></FONT></DIV> </DIV>
|
||||
<DIV><FONT color=#c0c0c0>
|
||||
<DIV><FONT color=#000000 size=4>各位同学:</FONT></DIV>
|
||||
<DIV><FONT color=#000000 size=4></FONT> </DIV>
|
||||
<DIV><FONT color=#000000
|
||||
size=4> 本月考勤统计日为20日,烦请各位同学在19日下班之前尽快将个人需要申诉的事由找部门领导审批通</FONT></DIV>
|
||||
<DIV><FONT color=#000000 size=4></FONT> </DIV>
|
||||
<DIV><FONT color=#000000 size=4>过。</FONT><FONT color=#ff0000
|
||||
size=4><STRONG>逾期不再修改考勤。</STRONG></FONT></DIV>
|
||||
<DIV><FONT color=#000000 size=4>
|
||||
</FONT></DIV>
|
||||
<DIV><FONT color=#000000 size=4>
|
||||
另烦请本月有请年假、事假、病假的同学补发邮件给部门领导审批并转发给行政部。谢谢各位同学配合。</FONT></DIV><FONT
|
||||
color=#000000 size=4></FONT>
|
||||
<DIV><FONT color=#c0c0c0><FONT color=#000000
|
||||
size=4></FONT></FONT> </DIV>
|
||||
<DIV><FONT color=#c0c0c0><FONT color=#ff0000
|
||||
size=4><STRONG>如在考勤日未收到以上邮件,我部门将按照考勤严格执行不再做任何修改。</STRONG></FONT></FONT></DIV>
|
||||
<DIV><FONT color=#c0c0c0><STRONG><FONT color=#ff0000
|
||||
size=4></FONT></STRONG></FONT> </DIV>
|
||||
<DIV><FONT color=#c0c0c0><STRONG><FONT color=#ff0000
|
||||
size=4>
|
||||
<FONT
|
||||
color=#000000>艾克赛乐行政部</FONT></FONT></STRONG></FONT><BR>2010-09-17
|
||||
</FONT></DIV></DIV>
|
||||
<DIV align=left>
|
||||
<HR style="WIDTH: 122px; HEIGHT: 2px" align=left SIZE=2>
|
||||
</DIV>
|
||||
<DIV><FONT color=#c0c0c0><SPAN>行政部</SPAN>
|
||||
</DIV></FONT></DIV></FONT></TD></TR></TBODY></TABLE></TD>
|
||||
<TD vAlign=bottom background=cid:__6@Foxmail.net>
|
||||
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD background=cid:__12@Foxmail.net><IMG height=357
|
||||
src="cid:__0@Foxmail.net" width=84></TD></TR></TBODY></TABLE></TD></TR>
|
||||
<TR>
|
||||
<TD vAlign=top background=cid:__7@Foxmail.net><IMG height=1
|
||||
src="cid:__0@Foxmail.net" width=49></TD>
|
||||
<TD vAlign=top align=right background=cid:__8@Foxmail.net>
|
||||
<TABLE cellSpacing=0 cellPadding=0 width=125 border=0>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD background=cid:__13@Foxmail.net><IMG height=58
|
||||
src="cid:__0@Foxmail.net" width=125></TD></TR></TBODY></TABLE></TD>
|
||||
<TD vAlign=top background=cid:__9@Foxmail.net><IMG height=58
|
||||
src="cid:__0@Foxmail.net" width=84></TD></TR></TBODY></TABLE></BODY></HTML>
|
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/d_bg.jpg
Normal file
After Width: | Height: | Size: 682 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/d_mr.jpg
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/dl.jpg
Normal file
After Width: | Height: | Size: 890 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/dr.jpg
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/m.jpg
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/m_bgl.jpg
Normal file
After Width: | Height: | Size: 681 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/m_bgr.jpg
Normal file
After Width: | Height: | Size: 687 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/m_dr.jpg
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/m_tl.jpg
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/spacer.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/t_bg.jpg
Normal file
After Width: | Height: | Size: 679 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/t_ml.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/tl.jpg
Normal file
After Width: | Height: | Size: 963 B |
BIN
lib_acl_cpp/samples/mime/mail_build/var/img/tr.jpg
Normal file
After Width: | Height: | Size: 897 B |
16
lib_acl_cpp/samples/mime/mail_build/var/text.txt
Normal file
@ -0,0 +1,16 @@
|
||||
各位同学:
|
||||
|
||||
本月考勤统计日为20日,烦请各位同学在19日下班之前尽快将个人需要申诉的事由找部门领导审批通
|
||||
|
||||
过。逾期不再修改考勤。
|
||||
|
||||
另烦请本月有请年假、事假、病假的同学补发邮件给部门领导审批并转发给行政部。谢谢各位同学配合。
|
||||
|
||||
如在考勤日未收到以上邮件,我部门将按照考勤严格执行不再做任何修改。
|
||||
|
||||
艾克赛乐行政部
|
||||
2010-09-17
|
||||
|
||||
|
||||
|
||||
行政部
|
@ -110,7 +110,7 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
|
1
lib_acl_cpp/samples/mime/mime/var/keep
Normal file
@ -0,0 +1 @@
|
||||
keepme
|
3
lib_acl_cpp/samples/smtp_client/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
include ../Makefile.in
|
||||
EXTLIBS = -lpolarssl
|
||||
PROG = smtp_client
|
129
lib_acl_cpp/samples/smtp_client/main.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
// md5.cpp : 定义控制台应用程序的入口点。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
static acl::polarssl_conf ssl_conf;
|
||||
|
||||
static bool send_mail(const char* addr, const char* sender, const char* pass,
|
||||
const char* recipients, bool use_ssl)
|
||||
{
|
||||
acl::smtp_client conn(addr, 60, 60);
|
||||
|
||||
if (use_ssl)
|
||||
conn.set_ssl(&ssl_conf);
|
||||
|
||||
conn.set_auth(sender, pass)
|
||||
.set_from(sender)
|
||||
.add_recipients(recipients);
|
||||
|
||||
if (conn.send_envelope() == false)
|
||||
{
|
||||
printf("send envelope error: %d, %s\r\n",
|
||||
conn.get_smtp_code(), conn.get_smtp_status());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (conn.data_begin() == false)
|
||||
{
|
||||
printf("send data begin error: %d, %s\r\n",
|
||||
conn.get_smtp_code(), conn.get_smtp_status());
|
||||
}
|
||||
|
||||
const char* data = "From: <zsxxsz@263.net>\r\n"
|
||||
"To: zsxxsz@263.net\r\n"
|
||||
"Subject: hello, world!\r\n"
|
||||
"\r\n"
|
||||
"hello world!\r\n";
|
||||
|
||||
if (conn.write(data, strlen(data)) == false)
|
||||
{
|
||||
printf("send data error: %d, %s\r\n",
|
||||
conn.get_smtp_code(), conn.get_smtp_status());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (conn.data_end() == false)
|
||||
{
|
||||
printf("send data end error: %d, %s\r\n",
|
||||
conn.get_smtp_code(), conn.get_smtp_status());
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("sendmail ok, from: %s, to: %s, code: %d, status: %s\r\n",
|
||||
sender, recipients, conn.get_smtp_code(),
|
||||
conn.get_smtp_status());
|
||||
|
||||
if (conn.quit() == false)
|
||||
{
|
||||
printf("send quit error: %d, %s\r\n",
|
||||
conn.get_smtp_code(), conn.get_smtp_status());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void usage(const char* procname)
|
||||
{
|
||||
printf("usage: %s -h[help]\r\n"
|
||||
"\t-s smtp_server_addr\r\n"
|
||||
"\t-e [if use ssl]\r\n"
|
||||
"\t-u sender\r\n"
|
||||
"\t-p sender_pass\r\n"
|
||||
"\t-t recipients[sample: to1@xxx.com; to2@xxx.com\r\n",
|
||||
procname);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ch;
|
||||
bool use_ssl = false;
|
||||
acl::string addr("smtp.263.net:25");
|
||||
acl::string sender("zsxxsz@263.net"), pass, recipients;
|
||||
|
||||
acl::acl_cpp_init();
|
||||
acl::log::stdout_open(true);
|
||||
|
||||
while ((ch = getopt(argc, argv, "hs:u:p:t:e")) > 0)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
case 's':
|
||||
addr = optarg;
|
||||
break;
|
||||
case 'u':
|
||||
sender = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
pass = optarg;
|
||||
break;
|
||||
case 't':
|
||||
recipients = optarg;
|
||||
break;
|
||||
case 'e':
|
||||
use_ssl = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addr.empty() || sender.empty() || pass.empty() || recipients.empty())
|
||||
{
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
(void) send_mail(addr.c_str(), sender.c_str(), pass.c_str(),
|
||||
recipients.c_str(), use_ssl);
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
getchar();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
354
lib_acl_cpp/samples/smtp_client/smtp_vc2012.vcxproj
Normal file
@ -0,0 +1,354 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="DebugDll|Win32">
|
||||
<Configuration>DebugDll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugDll|x64">
|
||||
<Configuration>DebugDll</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseDll|Win32">
|
||||
<Configuration>ReleaseDll</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseDll|x64">
|
||||
<Configuration>ReleaseDll</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A7459536-E4FE-4ECE-A721-EE49DBA0CF95}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>smtp_client</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2012d.lib;lib_protocol_vc2012d.lib;lib_acl_cpp_vc2012d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib\win32;..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)smtp_client.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2012d.lib;lib_protocol_vc2012d.lib;lib_acl_cpp_vc2012d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\..\lib\win64;..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)smtp_client.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2012.lib;lib_protocol_vc2012.lib;lib_acl_cpp_vc2012.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2012.lib;lib_protocol_vc2012.lib;lib_acl_cpp_vc2012.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_CPP_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)smtp_client.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>lib_acl_cpp_d.lib;lib_acl_d.lib;lib_protocol_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_CPP_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)smtp_client.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>lib_acl_cpp_d.lib;lib_acl_d.lib;lib_protocol_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ACL_CPP_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>lib_acl_cpp.lib;lib_protocol.lib;lib_acl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;ACL_CPP_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)smtp_client.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\..\lib;..\..\..\dist\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalDependencies>lib_acl_cpp.lib;lib_protocol.lib;lib_acl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugDll|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
8
lib_acl_cpp/samples/smtp_client/stdafx.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// md5.pch 将成为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
//引用任何所需的附加头文件,而不是在此文件中引用
|
13
lib_acl_cpp/samples/smtp_client/stdafx.h
Normal file
@ -0,0 +1,13 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是常用但不常更改的项目特定的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
//#include <iostream>
|
||||
//#include <tchar.h>
|
||||
|
||||
// TODO: 在此处引用程序要求的附加头文件
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include "lib_acl.h"
|
3
lib_acl_cpp/samples/smtp_client/valgrind.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
valgrind --tool=memcheck --leak-check=yes -v ./smtp_client -s smtp.126.com:465 -u zsxxsz@126.com -p 111111 -t zsxxsz@126.com -e
|
@ -101,7 +101,7 @@ acl_int64 db_row::field_int64(size_t ifield, acl_int64 null_value /* = 0 */) con
|
||||
if (ptr == NULL)
|
||||
return null_value;
|
||||
else
|
||||
return ACL_DB_ATOU(ptr);
|
||||
return acl_atoi64(ptr);
|
||||
}
|
||||
|
||||
acl_int64 db_row::field_int64(const char* name, acl_int64 null_value /* = 0 */) const
|
||||
@ -110,7 +110,7 @@ acl_int64 db_row::field_int64(const char* name, acl_int64 null_value /* = 0 */)
|
||||
if (ptr == NULL)
|
||||
return null_value;
|
||||
else
|
||||
return ACL_DB_ATOU(ptr);
|
||||
return acl_atoi64(ptr);
|
||||
}
|
||||
|
||||
double db_row::field_double(size_t ifield, double null_value /* = 0.0 */) const
|
||||
|
@ -169,6 +169,14 @@ void disque::free_jobs()
|
||||
jobs_.clear();
|
||||
}
|
||||
|
||||
const std::vector<disque_job*>* disque::getjob(const char* name,
|
||||
size_t timeout, size_t count)
|
||||
{
|
||||
std::vector<string> names;
|
||||
names.push_back(name);
|
||||
return getjob(names, timeout, count);
|
||||
}
|
||||
|
||||
const std::vector<disque_job*>* disque::getjob(const std::vector<string>& names,
|
||||
size_t timeout, size_t count)
|
||||
{
|
||||
|
@ -489,7 +489,7 @@ const char *mime_ctype_name(size_t ctype)
|
||||
|
||||
const char *mime_stype_name(size_t stype)
|
||||
{
|
||||
if (stype > MIME_STYPE_MAX)
|
||||
if (stype > MIME_STYPE_MAX || stype < MIME_STYPE_MIN)
|
||||
return (OTHER_NAME);
|
||||
return (mime_stype_map[stype].name);
|
||||
return (mime_stype_map[stype - MIME_STYPE_MIN].name);
|
||||
}
|
||||
|
@ -817,12 +817,14 @@ void mime::mime_debug(const char* save_path, bool decode /* = true */)
|
||||
acl_foreach(iter, &state_dummy)
|
||||
{
|
||||
MIME_NODE *node = (MIME_NODE*) iter.data;
|
||||
printf("ctype: %s, stype: %s\r\n",
|
||||
mime_ctype_name(node->ctype),
|
||||
mime_stype_name(node->stype));
|
||||
const char* ctype = mime_ctype_name(node->ctype);
|
||||
const char* stype = mime_stype_name(node->stype);
|
||||
printf("ctype: %s, stype: %s\r\n", ctype, stype);
|
||||
|
||||
if (node->boundary)
|
||||
printf(">>boundary: %s\r\n",
|
||||
acl_vstring_str(node->boundary));
|
||||
|
||||
if (node->header_filename)
|
||||
{
|
||||
header_filename.clear();
|
||||
|
@ -25,20 +25,14 @@ static const unsigned char un_b64_tab[] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
mime_base64::mime_base64()
|
||||
{
|
||||
init(to_b64_tab, un_b64_tab, '=');
|
||||
}
|
||||
|
||||
mime_base64::mime_base64(bool addCrlf, bool addInvalid)
|
||||
: mime_code(addCrlf, addInvalid)
|
||||
mime_base64::mime_base64(bool addCrlf /* = false */, bool addInvalid /* = false */)
|
||||
: mime_code(addCrlf, addInvalid, "base64")
|
||||
{
|
||||
init(to_b64_tab, un_b64_tab, '=');
|
||||
}
|
||||
|
||||
mime_base64::~mime_base64()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void mime_base64::encode(const char* in, int n, acl::string* out)
|
||||
|
@ -15,19 +15,7 @@ namespace acl {
|
||||
#define UCHAR_MAX 0xff
|
||||
#endif
|
||||
|
||||
mime_code::mime_code()
|
||||
: m_addCrLf(true)
|
||||
, m_addInvalid(false)
|
||||
, m_encoding(false)
|
||||
, m_toTab(NULL)
|
||||
, m_unTab(NULL)
|
||||
, m_fillChar('=')
|
||||
, m_pBuf(NULL)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
mime_code::mime_code(bool addCrlf, bool addInvalid)
|
||||
mime_code::mime_code(bool addCrlf, bool addInvalid, const char* encoding_type)
|
||||
: m_addCrLf(addCrlf)
|
||||
, m_addInvalid(addInvalid)
|
||||
, m_encoding(false)
|
||||
@ -36,11 +24,16 @@ mime_code::mime_code(bool addCrlf, bool addInvalid)
|
||||
, m_fillChar('=')
|
||||
, m_pBuf(NULL)
|
||||
{
|
||||
if (encoding_type)
|
||||
encoding_type_ = acl_mystrdup(encoding_type);
|
||||
else
|
||||
encoding_type_ = acl_mystrdup("unknown");
|
||||
reset();
|
||||
}
|
||||
|
||||
mime_code::~mime_code()
|
||||
{
|
||||
acl_myfree(encoding_type_);
|
||||
delete m_pBuf;
|
||||
}
|
||||
|
||||
|
@ -5,14 +5,9 @@ namespace acl {
|
||||
|
||||
#define CU_CHAR_PTR(x) ((const unsigned char *) (x))
|
||||
|
||||
mime_quoted_printable::mime_quoted_printable()
|
||||
{
|
||||
m_addCrLf = true;
|
||||
m_addInvalid = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
mime_quoted_printable::mime_quoted_printable(bool addCrlf, bool addInvalid)
|
||||
mime_quoted_printable::mime_quoted_printable(
|
||||
bool addCrlf /* = false */, bool addInvalid /* = false */)
|
||||
: mime_code(addCrlf, addInvalid, "quoted_printable")
|
||||
{
|
||||
m_addCrLf = addCrlf;
|
||||
m_addInvalid = addInvalid;
|
||||
|
@ -25,20 +25,14 @@ static const unsigned char un_uucode_tab[] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
mime_uucode::mime_uucode()
|
||||
{
|
||||
init(to_uucode_tab, un_uucode_tab, '~');
|
||||
}
|
||||
|
||||
mime_uucode::mime_uucode(bool addCrlf, bool addInvalid)
|
||||
: mime_code(addCrlf, addInvalid)
|
||||
mime_uucode::mime_uucode(bool addCrlf /* = false */, bool addInvalid /* = false */)
|
||||
: mime_code(addCrlf, addInvalid, "uucode")
|
||||
{
|
||||
init(to_uucode_tab, un_uucode_tab, '~');
|
||||
}
|
||||
|
||||
mime_uucode::~mime_uucode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void mime_uucode::encode(const char* in, int n, acl::string* out)
|
||||
|
@ -25,20 +25,14 @@ static const unsigned char un_xx_tab[] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
mime_xxcode::mime_xxcode()
|
||||
{
|
||||
init(to_xx_tab, un_xx_tab, '~');
|
||||
}
|
||||
|
||||
mime_xxcode::mime_xxcode(bool addCrlf, bool addInvalid)
|
||||
: mime_code(addCrlf, addInvalid)
|
||||
mime_xxcode::mime_xxcode(bool addCrlf /* = false */, bool addInvalid /* = false */)
|
||||
: mime_code(addCrlf, addInvalid, "xxcode")
|
||||
{
|
||||
init(to_xx_tab, un_xx_tab, '~');
|
||||
}
|
||||
|
||||
mime_xxcode::~mime_xxcode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void mime_xxcode::encode(const char* in, int n, acl::string* out)
|
||||
|
@ -439,10 +439,14 @@ void rfc822::mkdate_cst(time_t t, char *buf, size_t size)
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::list<rfc822_addr*>& rfc822::parse_addrs(const char* in)
|
||||
const std::list<rfc822_addr*>& rfc822::parse_addrs(const char* in,
|
||||
const char* to_charset /* = "utf-8" */)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (to_charset == NULL)
|
||||
to_charset = "gb18030";
|
||||
|
||||
if (in == NULL || *in == 0)
|
||||
{
|
||||
logger_error("input invalid");
|
||||
@ -480,7 +484,7 @@ const std::list<rfc822_addr*>& rfc822::parse_addrs(const char* in)
|
||||
{
|
||||
buf.clear();
|
||||
rfc2047::decode(STR(comment_prev),
|
||||
(int) LEN(comment_prev), &buf, "gb18030");
|
||||
(int) LEN(comment_prev), &buf, to_charset);
|
||||
addr->comment = acl_mystrdup(buf.c_str());
|
||||
comment_prev = NULL;
|
||||
}
|
||||
@ -493,9 +497,10 @@ const std::list<rfc822_addr*>& rfc822::parse_addrs(const char* in)
|
||||
return (addrs_);
|
||||
}
|
||||
|
||||
const rfc822_addr* rfc822::parse_addr(const char* in)
|
||||
const rfc822_addr* rfc822::parse_addr(const char* in,
|
||||
const char* to_charset /* = "utf-8" */)
|
||||
{
|
||||
const std::list<rfc822_addr*> addr_list = parse_addrs(in);
|
||||
const std::list<rfc822_addr*> addr_list = parse_addrs(in, to_charset);
|
||||
if (addr_list.empty())
|
||||
return (NULL);
|
||||
std::list<rfc822_addr*>::const_iterator cit = addr_list.begin();
|
||||
|
@ -51,7 +51,7 @@ void geo_member::set_coordinate(double longitude, double latitude)
|
||||
&& latitude <= GEO_LATITUDE_MAX)
|
||||
{
|
||||
longitude_ = longitude;
|
||||
latitude_ = longitude;
|
||||
latitude_ = latitude;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,7 @@ int redis_zset::zrangebyscore_get(const char* cmd, const char* key,
|
||||
argv[6] = count_s;
|
||||
lens[6] = strlen(count_s);
|
||||
|
||||
argc += 2;
|
||||
argc += 3;
|
||||
}
|
||||
|
||||
hash_slot(key);
|
||||
@ -571,7 +571,7 @@ int redis_zset::zrangebyscore_get_with_scores(const char* cmd,
|
||||
argv[7] = count_s;
|
||||
lens[7] = strlen(count_s);
|
||||
|
||||
argc += 2;
|
||||
argc += 3;
|
||||
}
|
||||
|
||||
hash_slot(key);
|
||||
|
155
lib_acl_cpp/src/smtp/mail_attach.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
#include "acl_stdafx.hpp"
|
||||
#include "acl_cpp/stdlib/log.hpp"
|
||||
#include "acl_cpp/stdlib/util.hpp"
|
||||
#include "acl_cpp/mime/mime_code.hpp"
|
||||
#include "acl_cpp/mime//rfc2047.hpp"
|
||||
#include "acl_cpp/stream/ostream.hpp"
|
||||
#include "acl_cpp/stream/ifstream.hpp"
|
||||
#include "acl_cpp/smtp/mail_attach.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
mail_attach::mail_attach(const char* filepath, const char* content_type,
|
||||
const char* charset)
|
||||
: filepath_(filepath)
|
||||
, ctype_(content_type)
|
||||
, cid_(64)
|
||||
, charset_(charset)
|
||||
{
|
||||
string filename;
|
||||
filename.basename(filepath);
|
||||
|
||||
// ÎļþÃûÐèÒª²ÉÓà rfc2047 ±àÂë
|
||||
if (!rfc2047::encode(filename.c_str(), (int) filename.size(),
|
||||
&filename_, charset, 'B', false))
|
||||
{
|
||||
filename_ = filename;
|
||||
}
|
||||
}
|
||||
|
||||
mail_attach::~mail_attach()
|
||||
{
|
||||
}
|
||||
|
||||
mail_attach& mail_attach::set_content_id(const char* id)
|
||||
{
|
||||
if (id && *id)
|
||||
cid_.format("%s", id);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool mail_attach::save_to(mime_code* coder, string& out)
|
||||
{
|
||||
if (coder)
|
||||
build_header(coder->get_encoding_type(), out);
|
||||
else
|
||||
build_header("base64", out);
|
||||
|
||||
string buf;
|
||||
if (ifstream::load(filepath_.c_str(), &buf) == false)
|
||||
{
|
||||
logger_error("load %s error %s",
|
||||
filepath_.c_str(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (coder)
|
||||
{
|
||||
coder->reset();
|
||||
coder->encode_update(buf.c_str(), (int) buf.size(), &out);
|
||||
coder->encode_finish(&out);
|
||||
}
|
||||
else
|
||||
out.append(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_attach::save_to(mime_code* coder, ostream& out)
|
||||
{
|
||||
string header;
|
||||
|
||||
if (coder)
|
||||
build_header(coder->get_encoding_type(), header);
|
||||
else
|
||||
build_header("base64", header);
|
||||
|
||||
if (out.write(header) == -1)
|
||||
{
|
||||
logger_error("write to stream error %s", last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
ifstream in;
|
||||
if (in.open_read(filepath_.c_str()) == false)
|
||||
{
|
||||
logger_error("open %s error %s",
|
||||
filepath_.c_str(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
char buf[8192];
|
||||
int ret;
|
||||
string body(8192);
|
||||
|
||||
while (!in.eof())
|
||||
{
|
||||
ret = in.read(buf, sizeof(buf), false);
|
||||
if (ret == -1)
|
||||
break;
|
||||
if (coder == NULL)
|
||||
{
|
||||
if (out.write(buf, ret) == -1)
|
||||
{
|
||||
logger_error("write body error %s",
|
||||
last_serror());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
coder->encode_update(buf, ret, &body);
|
||||
if (body.empty())
|
||||
continue;
|
||||
|
||||
if (out.write(body) == -1)
|
||||
{
|
||||
logger_error("write body error %s", last_serror());
|
||||
return false;
|
||||
}
|
||||
body.clear();
|
||||
}
|
||||
|
||||
if (coder)
|
||||
{
|
||||
coder->encode_finish(&body);
|
||||
body.append("\r\n");
|
||||
}
|
||||
else
|
||||
body.append("\r\n");
|
||||
|
||||
if (out.write(body) == -1)
|
||||
{
|
||||
logger_error("write body error %s", last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void mail_attach::build_header(const char* transfer_encoding, string& out)
|
||||
{
|
||||
out.format_append("Content-Type: %s;\r\n", ctype_.c_str());
|
||||
out.format_append("\tname=\"%s\"\r\n", filename_.c_str());
|
||||
out.format_append("Content-Transfer-Encoding: %s\r\n",
|
||||
transfer_encoding);
|
||||
|
||||
if (cid_.empty())
|
||||
out.format_append("Content-Disposition: attachment;\r\n"
|
||||
"\tfilename=\"%s\"\r\n", filename_.c_str());
|
||||
else
|
||||
out.format_append("Content-ID: <%s>\r\n", cid_.c_str());
|
||||
|
||||
out.append("\r\n");
|
||||
}
|
||||
|
||||
} // namespace acl
|
234
lib_acl_cpp/src/smtp/mail_body.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
#include "acl_stdafx.hpp"
|
||||
#include "acl_cpp/stdlib/log.hpp"
|
||||
#include "acl_cpp/mime/mime_base64.hpp"
|
||||
#include "acl_cpp/mime/mime_code.hpp"
|
||||
#include "acl_cpp/mime/mime_quoted_printable.hpp"
|
||||
#include "acl_cpp/mime/mime_uucode.hpp"
|
||||
#include "acl_cpp/mime/mime_xxcode.hpp"
|
||||
#include "acl_cpp/mime/mime_define.hpp"
|
||||
#include "acl_cpp/smtp/mail_attach.hpp"
|
||||
#include "acl_cpp/smtp/mail_message.hpp"
|
||||
#include "acl_cpp/smtp/mail_body.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
mail_body::mail_body(const char* charset /* = "utf-8" */,
|
||||
const char* encoding /* = "base64" */)
|
||||
: charset_(charset)
|
||||
, transfer_encoding_(encoding)
|
||||
{
|
||||
if (transfer_encoding_.compare("base64", false) == 0)
|
||||
coder_ = NEW mime_base64(true, true);
|
||||
else if (transfer_encoding_.compare("qp", false) == 0)
|
||||
coder_ = NEW mime_quoted_printable(true, true);
|
||||
else if (transfer_encoding_.compare("uucode", false) == 0)
|
||||
coder_ = NEW mime_uucode(true, true);
|
||||
else if (transfer_encoding_.compare("xxcode", false) == 0)
|
||||
coder_ = NEW mime_xxcode(true, true);
|
||||
else
|
||||
coder_ = NULL;
|
||||
|
||||
html_ = NULL;
|
||||
hlen_ = 0;
|
||||
text_ = NULL;
|
||||
tlen_ = 0;
|
||||
attachments_ = NULL;
|
||||
mime_stype_ = MIME_STYPE_OTHER;
|
||||
}
|
||||
|
||||
mail_body::~mail_body()
|
||||
{
|
||||
delete coder_;
|
||||
}
|
||||
|
||||
mail_body& mail_body::set_html(const char* html, size_t len)
|
||||
{
|
||||
html_ = html;
|
||||
hlen_ = len;
|
||||
mime_stype_ = MIME_STYPE_HTML;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_body& mail_body::set_text(const char* text, size_t len)
|
||||
{
|
||||
text_ = text;
|
||||
tlen_ = len;
|
||||
mime_stype_ = MIME_STYPE_PLAIN;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_body& mail_body::set_alternative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen)
|
||||
{
|
||||
html_ = html;
|
||||
hlen_ = hlen;
|
||||
text_ = text;
|
||||
tlen_ = tlen;
|
||||
mime_stype_ = MIME_STYPE_ALTERNATIVE;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_body& mail_body::set_relative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen,
|
||||
const std::vector<mail_attach*>& attachments)
|
||||
{
|
||||
html_ = html;
|
||||
hlen_ = hlen;
|
||||
text_ = text;
|
||||
tlen_ = tlen;
|
||||
attachments_ = &attachments;
|
||||
mime_stype_ = MIME_STYPE_RELATED;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool mail_body::build(const char* in, size_t len, string& out) const
|
||||
{
|
||||
out.format_append("Content-Type: %s;\r\n", content_type_.c_str());
|
||||
out.format_append("\tcharset=\"%s\"\r\n", charset_.c_str());
|
||||
out.format_append("Content-Transfer-Encoding: %s\r\n\r\n",
|
||||
transfer_encoding_.c_str());
|
||||
coder_->encode_update(in, (int) len, &out);
|
||||
coder_->encode_finish(&out);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_body::save_to(string& out) const
|
||||
{
|
||||
switch (mime_stype_)
|
||||
{
|
||||
case MIME_STYPE_HTML:
|
||||
return save_html(html_, hlen_, out);
|
||||
case MIME_STYPE_PLAIN:
|
||||
return save_text(text_, tlen_, out);
|
||||
case MIME_STYPE_ALTERNATIVE:
|
||||
return save_alternative(html_, hlen_, text_, tlen_, out);
|
||||
case MIME_STYPE_RELATED:
|
||||
acl_assert(attachments_);
|
||||
return save_relative(html_, hlen_, text_, tlen_,
|
||||
*attachments_, out);
|
||||
default:
|
||||
logger_error("unknown mime_stype: %d", mime_stype_);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void mail_body::set_content_type(const char* content_type)
|
||||
{
|
||||
content_type_.format(content_type);
|
||||
ctype_.parse(content_type_);
|
||||
}
|
||||
|
||||
bool mail_body::save_html(const char* html, size_t len, string& out) const
|
||||
{
|
||||
if (!html || !len)
|
||||
{
|
||||
logger_error("invalid input!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const_cast<mail_body*>(this)->set_content_type("text/html");
|
||||
return build(html, len, out);
|
||||
}
|
||||
|
||||
bool mail_body::save_text(const char* text, size_t len, string& out) const
|
||||
{
|
||||
if (!text || !len)
|
||||
{
|
||||
logger_error("invalid input!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const_cast<mail_body*>(this)->set_content_type("text/plain");
|
||||
return build(text, len, out);
|
||||
}
|
||||
|
||||
bool mail_body::save_relative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen,
|
||||
const std::vector<mail_attach*>& attachments,
|
||||
string& out) const
|
||||
{
|
||||
if (!html || !hlen || !text || !tlen || attachments.empty())
|
||||
{
|
||||
logger_error("invalid input!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mail_message::create_boundary("0002",
|
||||
const_cast<mail_body*>(this)->boundary_);
|
||||
string ctype;
|
||||
ctype.format("multipart/relative;\r\n"
|
||||
"\ttype=\"multipart/alternative\";\r\n"
|
||||
"\tboundary=\"%s\"", boundary_.c_str());
|
||||
const_cast<mail_body*>(this)->set_content_type(ctype);
|
||||
|
||||
out.format_append("Content-Type: %s\r\n\r\n", content_type_.c_str());
|
||||
out.append("\r\n");
|
||||
out.format_append("--%s\r\n", boundary_.c_str());
|
||||
|
||||
// 递归一层,调用生成 alternative 格式数据
|
||||
mail_body body(charset_.c_str(), transfer_encoding_.c_str());
|
||||
bool ret = body.save_alternative(html, hlen, text, tlen, out);
|
||||
if (ret == false)
|
||||
return ret;
|
||||
|
||||
out.append("\r\n");
|
||||
|
||||
std::vector<mail_attach*>::const_iterator cit;
|
||||
for (cit = attachments.begin(); cit != attachments.end(); ++cit)
|
||||
{
|
||||
out.format_append("--%s\r\n", boundary_.c_str());
|
||||
if ((*cit)->save_to(coder_, out) == false)
|
||||
return false;
|
||||
out.append("\r\n");
|
||||
}
|
||||
|
||||
out.format_append("\r\n--%s--\r\n", boundary_.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_body::save_alternative(const char* html, size_t hlen,
|
||||
const char* text, size_t tlen, string& out) const
|
||||
{
|
||||
if (!html || !hlen || !text || !tlen)
|
||||
{
|
||||
logger_error("invalid input!");
|
||||
return false;
|
||||
}
|
||||
|
||||
mail_message::create_boundary("0003",
|
||||
const_cast<mail_body*>(this)->boundary_);
|
||||
string ctype;
|
||||
ctype.format("multipart/alternative;\r\n"
|
||||
"\tboundary=\"%s\"", boundary_.c_str());
|
||||
const_cast<mail_body*>(this)->set_content_type(ctype);
|
||||
|
||||
out.format_append("Content-Type: %s\r\n\r\n", content_type_.c_str());
|
||||
out.format_append("--%s\r\n", boundary_.c_str());
|
||||
out.format_append("Content-Type: text/plain;\r\n");
|
||||
out.format_append("\tcharset=\"%s\"\r\n", charset_.c_str());
|
||||
out.format_append("Content-Transfer-Encoding: %s\r\n\r\n",
|
||||
transfer_encoding_.c_str());
|
||||
coder_->encode_update(text, (int) tlen, &out);
|
||||
coder_->encode_finish(&out);
|
||||
out.append("\r\n\r\n");
|
||||
|
||||
out.format_append("--%s\r\n", boundary_.c_str());
|
||||
out.format_append("Content-Type: text/html;\r\n");
|
||||
out.format_append("\tcharset=\"%s\"\r\n", charset_.c_str());
|
||||
out.format_append("Content-Transfer-Encoding: %s\r\n\r\n",
|
||||
transfer_encoding_.c_str());
|
||||
coder_->encode_update(html, (int) hlen, &out);
|
||||
coder_->encode_finish(&out);
|
||||
out.append("\r\n\r\n");
|
||||
|
||||
out.format_append("--%s--\r\n", boundary_.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace acl
|
493
lib_acl_cpp/src/smtp/mail_message.cpp
Normal file
@ -0,0 +1,493 @@
|
||||
#include "acl_stdafx.hpp"
|
||||
#include <list>
|
||||
#include "acl_cpp/stdlib/log.hpp"
|
||||
#include "acl_cpp/stdlib/util.hpp"
|
||||
#include "acl_cpp/stdlib/string.hpp"
|
||||
#include "acl_cpp/stdlib/dbuf_pool.hpp"
|
||||
#include "acl_cpp/stream/ofstream.hpp"
|
||||
#include "acl_cpp/stream/ifstream.hpp"
|
||||
#include "acl_cpp/stdlib/thread.hpp"
|
||||
#include "acl_cpp/mime/rfc822.hpp"
|
||||
#include "acl_cpp/mime/rfc2047.hpp"
|
||||
#include "acl_cpp/mime/mime_base64.hpp"
|
||||
#include "acl_cpp/smtp/mail_attach.hpp"
|
||||
#include "acl_cpp/smtp/mail_body.hpp"
|
||||
#include "acl_cpp/smtp/mail_message.hpp"
|
||||
|
||||
namespace acl
|
||||
{
|
||||
|
||||
mail_message::mail_message(const char* charset /* = "utf-8"*/)
|
||||
{
|
||||
dbuf_ = new dbuf_pool;
|
||||
if (charset == NULL || *charset == 0)
|
||||
charset = "utf-8";
|
||||
charset_ = dbuf_->dbuf_strdup(charset);
|
||||
transfer_encoding_ = dbuf_->dbuf_strdup("base64");
|
||||
auth_user_ = NULL;
|
||||
auth_pass_ = NULL;
|
||||
from_ = NULL;
|
||||
sender_ = NULL;
|
||||
reply_to_ = NULL;
|
||||
return_path_ = NULL;
|
||||
delivered_to_ = NULL;
|
||||
subject_ = NULL;
|
||||
body_ = NULL;
|
||||
body_len_ = 0;
|
||||
filepath_ = NULL;
|
||||
}
|
||||
|
||||
mail_message::~mail_message()
|
||||
{
|
||||
std::vector<mail_attach*>::iterator it;
|
||||
for (it = attachments_.begin(); it != attachments_.end(); ++it)
|
||||
(*it)->~mail_attach();
|
||||
dbuf_->destroy();
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_auth(const char* user, const char* pass)
|
||||
{
|
||||
if (user && *user && pass && *pass)
|
||||
{
|
||||
auth_user_ = dbuf_->dbuf_strdup(user);
|
||||
auth_pass_ = dbuf_->dbuf_strdup(pass);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_from(const char* from, const char* name)
|
||||
{
|
||||
if (from == NULL || *from == 0)
|
||||
return *this;
|
||||
from_ = (rfc822_addr*) dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
from_->addr = dbuf_->dbuf_strdup(from);
|
||||
if (name && *name)
|
||||
from_->comment = dbuf_->dbuf_strdup(name);
|
||||
else
|
||||
from_->comment = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_sender(const char* sender, const char* name)
|
||||
{
|
||||
if (sender == NULL || *sender == 0)
|
||||
return *this;
|
||||
sender_ = (rfc822_addr*) dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
sender_->addr = dbuf_->dbuf_strdup(sender);
|
||||
if (name && *name)
|
||||
sender_->comment = dbuf_->dbuf_strdup(name);
|
||||
else
|
||||
sender_->comment = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_reply_to(const char* replyto, const char* name)
|
||||
{
|
||||
if (replyto == NULL || *replyto == 0)
|
||||
return *this;
|
||||
reply_to_ = (rfc822_addr*) dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
reply_to_->addr = dbuf_->dbuf_strdup(replyto);
|
||||
if (name && *name)
|
||||
reply_to_->comment = dbuf_->dbuf_strdup(name);
|
||||
else
|
||||
reply_to_->comment = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_return_path(const char* return_path)
|
||||
{
|
||||
if (return_path == NULL || *return_path == 0)
|
||||
return *this;
|
||||
return_path_ = (rfc822_addr*) dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
return_path_->addr = dbuf_->dbuf_strdup(return_path);
|
||||
return_path_->comment = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_delivered_to(const char* delivered_to)
|
||||
{
|
||||
if (delivered_to == NULL || *delivered_to == 0)
|
||||
return *this;
|
||||
delivered_to_ = (rfc822_addr*) dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
delivered_to_->addr = dbuf_->dbuf_strdup(delivered_to);
|
||||
delivered_to_->comment = NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void mail_message::add_addrs(const char* in, std::vector<rfc822_addr*>& out)
|
||||
{
|
||||
rfc822 rfc;
|
||||
const std::list<rfc822_addr*>& addrs = rfc.parse_addrs(in, charset_);
|
||||
std::list<rfc822_addr*>::const_iterator cit = addrs.begin();
|
||||
for (; cit != addrs.end(); ++cit)
|
||||
{
|
||||
rfc822_addr* addr = (rfc822_addr* )
|
||||
dbuf_->dbuf_alloc(sizeof(rfc822_addr));
|
||||
if ((*cit)->addr == NULL)
|
||||
continue;
|
||||
addr->addr = dbuf_->dbuf_strdup((*cit)->addr);
|
||||
if ((*cit)->comment)
|
||||
addr->comment = dbuf_->dbuf_strdup((*cit)->comment);
|
||||
else
|
||||
addr->comment = NULL;
|
||||
out.push_back(addr);
|
||||
}
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_recipients(const char* recipients)
|
||||
{
|
||||
string buf(recipients);
|
||||
std::list<string>& tokens = buf.split(" \t;,");
|
||||
std::list<string>::const_iterator cit;
|
||||
for (cit = tokens.begin(); cit != tokens.end(); ++cit)
|
||||
(void) add_to((*cit).c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_to(const char* to)
|
||||
{
|
||||
if (to && *to)
|
||||
{
|
||||
add_addrs(to, to_list_);
|
||||
add_addrs(to, recipients_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_cc(const char* cc)
|
||||
{
|
||||
if (cc && *cc)
|
||||
{
|
||||
add_addrs(cc, to_list_);
|
||||
add_addrs(cc, recipients_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_bcc(const char* bcc)
|
||||
{
|
||||
if (bcc && *bcc)
|
||||
{
|
||||
add_addrs(bcc, to_list_);
|
||||
add_addrs(bcc, recipients_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_subject(const char* subject)
|
||||
{
|
||||
if (subject && *subject)
|
||||
subject_ = dbuf_->dbuf_strdup(subject);
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_header(const char* name, const char* value)
|
||||
{
|
||||
if (name == NULL || *name == 0 || value == NULL || *value == 0)
|
||||
return *this;
|
||||
char* n = dbuf_->dbuf_strdup(name);
|
||||
char* v = dbuf_->dbuf_strdup(value);
|
||||
headers_.push_back(std::make_pair(n, v));
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char* mail_message::get_header_value(const char* name) const
|
||||
{
|
||||
std::vector<std::pair<char*, char*> >::const_iterator cit;
|
||||
for (cit = headers_.begin(); cit != headers_.end(); ++cit)
|
||||
{
|
||||
if (strcasecmp((*cit).first, name) == 0)
|
||||
return (*cit).second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mail_message& mail_message::set_body(const mail_body* body)
|
||||
{
|
||||
body_ = body;
|
||||
return *this;
|
||||
}
|
||||
|
||||
mail_message& mail_message::add_attachment(const char* filepath,
|
||||
const char* content_type)
|
||||
{
|
||||
if (filepath == NULL || content_type == NULL)
|
||||
return *this;
|
||||
|
||||
char* buf = (char*) dbuf_->dbuf_alloc(sizeof(mail_attach));
|
||||
mail_attach* attach = new(buf) mail_attach(filepath,
|
||||
content_type, charset_);
|
||||
attachments_.push_back(attach);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <process.h>
|
||||
#define PID _getpid
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define PID getpid
|
||||
#endif // defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
bool mail_message::append_addr(const rfc822_addr& addr, string& out)
|
||||
{
|
||||
if (addr.comment)
|
||||
{
|
||||
out.append("\"");
|
||||
if (rfc2047::encode(addr.comment, strlen(addr.comment),
|
||||
&out, charset_, 'B', false) == false)
|
||||
{
|
||||
logger_error("rfc2047::encode(%s) error",
|
||||
addr.comment);
|
||||
return false;
|
||||
}
|
||||
out.append("\"");
|
||||
}
|
||||
|
||||
out.format_append(" <%s>", addr.addr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_addr(const char* name, const rfc822_addr& addr,
|
||||
string& out)
|
||||
{
|
||||
out.format_append("%s: ", name);
|
||||
|
||||
if (append_addr(addr, out) == false)
|
||||
return false;
|
||||
|
||||
out.append("\r\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_addrs(const char* name,
|
||||
const std::vector<rfc822_addr*>& addrs, string& out)
|
||||
{
|
||||
std::vector<rfc822_addr*>::const_iterator cit = addrs.begin();
|
||||
if (cit == addrs.end())
|
||||
return true;
|
||||
|
||||
out.format_append("%s: ", name);
|
||||
if (append_addr(**cit, out) == false)
|
||||
return false;
|
||||
out.append(";\r\n");
|
||||
++cit;
|
||||
|
||||
while (true)
|
||||
{
|
||||
out.append("\t");
|
||||
if (append_addr(**cit, out) == false)
|
||||
return false;
|
||||
++cit;
|
||||
if (cit == addrs.end())
|
||||
{
|
||||
out.append("\r\n");
|
||||
break;
|
||||
}
|
||||
out.append(";\r\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_subject(const char* subject, string& out)
|
||||
{
|
||||
out.append("Subject: ");
|
||||
if (rfc2047::encode(subject, (int) strlen(subject), &out,
|
||||
charset_, 'B', false) == false)
|
||||
{
|
||||
logger_error("rfc2047::encode error!");
|
||||
return false;
|
||||
}
|
||||
out.append("\r\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_date(string& out)
|
||||
{
|
||||
rfc822 rfc;
|
||||
char buf[128];
|
||||
rfc.mkdate(time(NULL), buf, sizeof(buf), tzone_cst);
|
||||
out.format_append("Date: %s\r\n", buf);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_message_id(string& out)
|
||||
{
|
||||
out.format_append("Message-ID: <%lu.%lu.%lu.acl@localhost>\r\n",
|
||||
(unsigned long) PID(), thread::thread_self(),
|
||||
(unsigned long) time(NULL));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::build_header(string& out)
|
||||
{
|
||||
std::vector<std::pair<char*, char*> >::const_iterator cit;
|
||||
for (cit = headers_.begin(); cit != headers_.end(); ++cit)
|
||||
out.format_append("%s: %s\r\n", (*cit).first, (*cit).second);
|
||||
|
||||
//if (reply_to_ && !append_addr(fp, "ReplyTo", *reply_to_))
|
||||
// return false;
|
||||
|
||||
if (return_path_ && !append_addr("Return-Path", *return_path_, out))
|
||||
return false;
|
||||
|
||||
if (delivered_to_ && !append_addr("Delivered-To", *delivered_to_, out))
|
||||
return false;
|
||||
|
||||
if (from_ && !append_addr("From", *from_, out))
|
||||
return false;
|
||||
|
||||
if (!append_addrs("To", to_list_, out))
|
||||
return false;
|
||||
|
||||
if (!append_addrs("Cc", cc_list_, out))
|
||||
return false;
|
||||
|
||||
if (subject_ && !append_subject(subject_, out))
|
||||
return false;
|
||||
|
||||
if (!append_date(out))
|
||||
return false;
|
||||
|
||||
out.append("MIME-Version: 1.0\r\n");
|
||||
|
||||
if (append_message_id(out) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::append_header(ofstream& fp)
|
||||
{
|
||||
string buf;
|
||||
|
||||
if (build_header(buf) == false)
|
||||
return false;
|
||||
|
||||
if (fp.write(buf) == -1)
|
||||
{
|
||||
logger_error("write mail header to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void mail_message::create_boundary(const char* id, string& out)
|
||||
{
|
||||
out.format("====_%s_aclPart_%lu_%lu_%lu_====",
|
||||
id, (unsigned long) PID(), thread::thread_self(),
|
||||
(unsigned long) time(NULL));
|
||||
}
|
||||
|
||||
bool mail_message::append_multipart(ofstream& fp)
|
||||
{
|
||||
string boundary;
|
||||
|
||||
// 创建 MIME 数据唯一分隔符
|
||||
create_boundary("0001", boundary);
|
||||
|
||||
string buf(8192);
|
||||
|
||||
// 向邮件头中添加 MIME 相关的信息头
|
||||
buf.format("Content-Type: multipart/mixed;\r\n"
|
||||
"\tcharset=\"%s\";\r\n"
|
||||
"\tboundary=\"%s\"\r\n\r\n",
|
||||
charset_, boundary.c_str());
|
||||
|
||||
const char *prompt = "This is a multi-part message in MIME format.";
|
||||
buf.format_append("%s\r\n\r\n--%s\r\n", prompt, boundary.c_str());
|
||||
|
||||
// 添加数据体
|
||||
if (body_->save_to(buf) == false)
|
||||
return false;
|
||||
|
||||
buf.append("\r\n");
|
||||
|
||||
if (fp.write(buf) == -1)
|
||||
{
|
||||
logger_error("write to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
// 将所有附件内容进行 BASE64 编码后存入目标文件中
|
||||
|
||||
mime_base64 base64(true, false);
|
||||
|
||||
std::vector<mail_attach*>::const_iterator cit;
|
||||
for (cit = attachments_.begin(); cit != attachments_.end(); ++cit)
|
||||
{
|
||||
if (fp.format("--%s\r\n", boundary.c_str()) == -1)
|
||||
{
|
||||
logger_error("write boundary to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((*cit)->save_to(&base64, fp) == false)
|
||||
{
|
||||
logger_error("write attachment header to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加最后的分隔符至邮件尾部
|
||||
|
||||
if (fp.format("--%s--\r\n", boundary.c_str()) == -1)
|
||||
{
|
||||
logger_error("write boundary end to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mail_message::save_to(const char* filepath)
|
||||
{
|
||||
if (body_ == NULL)
|
||||
{
|
||||
logger_error("body null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ofstream fp;
|
||||
if (fp.open_write(filepath) == false)
|
||||
{
|
||||
logger_error("open %s error: %s", filepath, last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
filepath_ = dbuf_->dbuf_strdup(filepath);
|
||||
|
||||
// 先添加邮件头部分数据至文件流中
|
||||
|
||||
if (append_header(fp) == false)
|
||||
return false;
|
||||
|
||||
// 如果是 multipart 格式,则将 multipart 数据输出至文件流中
|
||||
|
||||
if (!attachments_.empty())
|
||||
return append_multipart(fp);
|
||||
|
||||
|
||||
// 对非 multipart 格式,直接将正文数据输出至文件流中
|
||||
|
||||
string buf(8192);
|
||||
if (body_->save_to(buf) == false)
|
||||
return false;
|
||||
|
||||
if (fp.write(buf) == -1)
|
||||
{
|
||||
logger_error("write to %s error %s",
|
||||
fp.file_path(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace acl
|
233
lib_acl_cpp/src/smtp/smtp_client.cpp
Normal file
@ -0,0 +1,233 @@
|
||||
#include "acl_stdafx.hpp"
|
||||
#include "acl_cpp/stdlib/log.hpp"
|
||||
#include "acl_cpp/stdlib/util.hpp"
|
||||
#include "acl_cpp/stream/istream.hpp"
|
||||
#include "acl_cpp/stream/polarssl_conf.hpp"
|
||||
#include "acl_cpp/stream/polarssl_io.hpp"
|
||||
#include "acl_cpp/mime/rfc822.hpp"
|
||||
#include "acl_cpp/smtp/mail_message.hpp"
|
||||
#include "acl_cpp/smtp/smtp_client.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
smtp_client::smtp_client(const char* addr, int conn_timeout, int rw_timeout)
|
||||
{
|
||||
addr_ = acl_mystrdup(addr);
|
||||
conn_timeout_ = conn_timeout;
|
||||
rw_timeout_ = rw_timeout;
|
||||
client_ = NULL;
|
||||
|
||||
ehlo_ = true;
|
||||
ssl_conf_ = NULL;
|
||||
}
|
||||
|
||||
smtp_client::~smtp_client()
|
||||
{
|
||||
acl_myfree(addr_);
|
||||
|
||||
if (client_)
|
||||
{
|
||||
// 将 SMTP_CLIENT 对象的流置空,以避免内部再次释放,
|
||||
// 因为该流对象会在下面 stream_.close() 时被释放
|
||||
client_->conn = NULL;
|
||||
smtp_close(client_);
|
||||
}
|
||||
|
||||
// 当 socket 流对象打开着,则关闭之,同时将依附于其的 SSL 对象释放
|
||||
if (stream_.opened())
|
||||
stream_.close();
|
||||
}
|
||||
|
||||
smtp_client& smtp_client::set_ssl(polarssl_conf* ssl_conf)
|
||||
{
|
||||
ssl_conf_ = ssl_conf;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int smtp_client::get_code() const
|
||||
{
|
||||
return client_ == NULL ? -1 : client_->smtp_code;
|
||||
}
|
||||
|
||||
const char* smtp_client::get_status() const
|
||||
{
|
||||
return client_ == NULL ? "unknown" : client_->buf;
|
||||
}
|
||||
|
||||
bool smtp_client::send(const mail_message& message,
|
||||
const char* email /* = NULL */)
|
||||
{
|
||||
if (open() == false)
|
||||
return false;
|
||||
if (get_banner() == false)
|
||||
return false;
|
||||
if (greet() == false)
|
||||
return false;
|
||||
if (!auth_login(message.get_auth_user(), message.get_auth_pass()))
|
||||
return false;
|
||||
const rfc822_addr* from = message.get_from();
|
||||
if (from == NULL || from->addr == NULL)
|
||||
return false;
|
||||
if (mail_from(from->addr) == false)
|
||||
return false;
|
||||
if (to_recipients(message.get_recipients()) == false)
|
||||
return false;
|
||||
if (email != NULL)
|
||||
{
|
||||
if (send_email(email) == false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
email = message.get_email();
|
||||
if (email != NULL)
|
||||
{
|
||||
if (send_email(email) == false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool smtp_client::open()
|
||||
{
|
||||
if (stream_.opened())
|
||||
{
|
||||
acl_assert(client_ != NULL);
|
||||
acl_assert(client_->conn == stream_.get_vstream());
|
||||
return true;
|
||||
}
|
||||
|
||||
client_ = smtp_open(addr_, conn_timeout_, rw_timeout_, 1024);
|
||||
if (client_ == NULL)
|
||||
{
|
||||
logger_error("connect %s error: %s", addr_, last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
// 打开流对象
|
||||
stream_.open(client_->conn);
|
||||
|
||||
if (ssl_conf_)
|
||||
{
|
||||
polarssl_io* ssl = new polarssl_io(*ssl_conf_, false);
|
||||
if (stream_.setup_hook(ssl) == ssl)
|
||||
{
|
||||
logger_error("open ssl client error!");
|
||||
ssl->destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool smtp_client::get_banner()
|
||||
{
|
||||
return smtp_get_banner(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::greet()
|
||||
{
|
||||
return smtp_greet(client_, "localhost", ehlo_ ? 1 : 0)
|
||||
== 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::auth_login(const char* user, const char* pass)
|
||||
{
|
||||
if (user == NULL || *user == 0)
|
||||
{
|
||||
logger_error("user null");
|
||||
return false;
|
||||
}
|
||||
if (pass == NULL || *pass == 0)
|
||||
{
|
||||
logger_error("pass null");
|
||||
return false;
|
||||
}
|
||||
return smtp_auth(client_, user, pass) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::mail_from(const char* from)
|
||||
{
|
||||
if (from == NULL || *from == 0)
|
||||
{
|
||||
logger_error("from null");
|
||||
return false;
|
||||
}
|
||||
return smtp_mail(client_, from) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::rcpt_to(const char* to)
|
||||
{
|
||||
if (to == NULL || *to == 0)
|
||||
{
|
||||
logger_error("to null");
|
||||
return false;
|
||||
}
|
||||
return smtp_rcpt(client_, to) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::to_recipients(const std::vector<rfc822_addr*>& recipients)
|
||||
{
|
||||
std::vector<rfc822_addr*>::const_iterator cit;
|
||||
for (cit = recipients.begin(); cit != recipients.end(); ++cit)
|
||||
{
|
||||
if ((*cit)->addr && rcpt_to((*cit)->addr) != 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool smtp_client::data_begin()
|
||||
{
|
||||
return smtp_data(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::data_end()
|
||||
{
|
||||
return smtp_data_end(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::quit()
|
||||
{
|
||||
return smtp_quit(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::noop()
|
||||
{
|
||||
return smtp_noop(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::reset()
|
||||
{
|
||||
return smtp_rset(client_) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::write(const char* data, size_t len)
|
||||
{
|
||||
return smtp_send(client_, data, len) == 0 ? true : false;
|
||||
}
|
||||
|
||||
bool smtp_client::format(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
bool ret = vformat(fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool smtp_client::vformat(const char* fmt, va_list ap)
|
||||
{
|
||||
string buf;
|
||||
buf.vformat(fmt, ap);
|
||||
return write(buf.c_str(), buf.size());
|
||||
}
|
||||
|
||||
bool smtp_client::send_email(const char* filepath)
|
||||
{
|
||||
return smtp_send_file(client_, filepath) == 0 ? true : false;
|
||||
}
|
||||
|
||||
} // namespace acl
|
@ -180,4 +180,17 @@ bool locker::unlock()
|
||||
return ret;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
lock_guard::lock_guard(locker& lk)
|
||||
: lk_(lk)
|
||||
{
|
||||
acl_assert(lk_.lock());
|
||||
}
|
||||
|
||||
lock_guard::~lock_guard()
|
||||
{
|
||||
acl_assert(lk_.unlock());
|
||||
}
|
||||
|
||||
} // namespace acl
|
||||
|
@ -33,6 +33,8 @@ SMTP_CLIENT *smtp_open(const char *addr, int conn_timeout,
|
||||
|
||||
void smtp_close(SMTP_CLIENT *client)
|
||||
{
|
||||
/* 此变量有可能被外部释放置空 */
|
||||
if (client->conn)
|
||||
acl_vstream_close(client->conn);
|
||||
acl_myfree(client->buf);
|
||||
acl_myfree(client);
|
||||
|