OSDN Git Service

Send Attachment successfully
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Patch.cpp
index accea84..7bebda9 100644 (file)
@@ -5,6 +5,7 @@
 #include "unicodeutils.h"\r
 #include "hwsmtp.h"\r
 #include "Windns.h"\r
+#include "Git.h"\r
 \r
 CPatch::CPatch()\r
 {\r
@@ -17,6 +18,17 @@ CPatch::~CPatch()
 \r
 }\r
 \r
+void CPatch::ConvertToArray(CString &to,CStringArray &Array)\r
+{\r
+       int start=0;\r
+       while(start>=0)\r
+       {\r
+               CString str=to.Tokenize(_T(";"),start);\r
+               if(!str.IsEmpty())\r
+                       Array.Add(str);\r
+       }\r
+}\r
+\r
 int CPatch::Send(CString &pathfile,CString &TO,CString &CC,bool bAttachment)\r
 {\r
        CSmtp mail;\r
@@ -46,8 +58,16 @@ int CPatch::Send(CString &pathfile,CString &TO,CString &CC,bool bAttachment)
        GetNameAddress(this->m_Author,name,address);\r
 \r
 \r
+       CStringArray attchments,CCArray;\r
+       if(bAttachment)\r
+       {\r
+               attchments.Add(pathfile);\r
+       }\r
+       \r
+       ConvertToArray(CC,CCArray);\r
+\r
        SendEmail(FALSE,pDnsRecord->Data.MX.pNameExchange,\r
-               NULL,NULL,FALSE,address,TO,this->m_Author,TO,this->m_Subject,_T("Test"));\r
+               NULL,NULL,FALSE,address,TO,this->m_Author,TO,this->m_Subject,m_strBody,0,&attchments,&CCArray);\r
                                        \r
        DnsRecordListFree(pDnsRecord,DnsFreeRecordList);\r
 \r
@@ -116,9 +136,13 @@ int CPatch::Parser(CString &pathfile)
 \r
        m_Body.resize(PatchFile.GetLength() - PatchFile.GetPosition());\r
        PatchFile.Read(&m_Body.at(0),PatchFile.GetLength() - PatchFile.GetPosition());\r
+       m_Body.push_back(0);\r
 \r
        PatchFile.Close();\r
 \r
+       g_Git.StringAppend(&m_strBody,&m_Body[0],CP_ACP);\r
+       \r
+\r
 }\r
 \r
 void CPatch::GetNameAddress(CString &in, CString &name,CString &address)\r