OSDN Git Service

Fix Email patch body show subject problem
authorFrank Li <lznuaa@gmail.com>
Fri, 17 Apr 2009 15:03:33 +0000 (23:03 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 17 Apr 2009 15:03:33 +0000 (23:03 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/Patch.cpp
src/TortoiseProc/Patch.h
src/TortoiseProc/SVNProgressDlg.cpp

index f9a06f8..70d6ae5 100644 (file)
@@ -103,26 +103,43 @@ int CPatch::Parser(CString &pathfile)
                return -1;\r
        \r
        int i=0;\r
-       while(PatchFile.ReadString(str))\r
-       {\r
+#if 0\r
+       while(i<4)\r
+       {   PatchFile.ReadString(str);\r
                if(i==1)\r
                        this->m_Author=str.Right( str.GetLength() - 6 );\r
                if(i==2)\r
                        this->m_Date = str.Right( str.GetLength() - 6 );\r
                if(i==3)\r
                        this->m_Subject = str.Right( str.GetLength() - 8 );\r
-               if(i==4)\r
-                       break;\r
+               \r
                i++;            \r
        }\r
 \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
+       LONGLONG offset=PatchFile.GetPosition();\r
+#endif\r
+       PatchFile.Read(m_Body.GetBufferSetLength(PatchFile.GetLength()),PatchFile.GetLength());\r
        PatchFile.Close();\r
 \r
-       g_Git.StringAppend(&m_strBody,&m_Body[0],CP_ACP);\r
+       int start=0;\r
+       CStringA one;\r
+       one=m_Body.Tokenize("\n",start);\r
+\r
+       one=m_Body.Tokenize("\n",start);\r
+       if(one.GetLength()>6)\r
+               g_Git.StringAppend(&m_Author,(BYTE*)one.GetBuffer()+6,CP_ACP,one.GetLength()-6);\r
+\r
+       one=m_Body.Tokenize("\n",start);\r
+       if(one.GetLength()>6)\r
+               g_Git.StringAppend(&m_Date,(BYTE*)one.GetBuffer()+6,CP_ACP,one.GetLength()-6);\r
+\r
+       one=m_Body.Tokenize("\n",start);\r
+       if(one.GetLength()>8)\r
+               g_Git.StringAppend(&m_Subject,(BYTE*)one.GetBuffer()+8,CP_ACP,one.GetLength()-8);\r
+\r
+       //one=m_Body.Tokenize("\n",start);\r
+       \r
+       g_Git.StringAppend(&m_strBody,(BYTE*)m_Body.GetBuffer()+start+1,CP_ACP,m_Body.GetLength()-start-1);\r
        \r
        return 0;\r
 }\r
index 769ff49..b2571e5 100644 (file)
@@ -24,7 +24,7 @@ public:
        CString m_Date;\r
        CString m_Subject;\r
        CString m_PathFile;\r
-       std::vector<BYTE> m_Body;\r
+       CStringA m_Body;\r
        CString m_strBody;\r
        void ConvertToArray(CString &to, CStringArray &Array);\r
 };\r
index febe50b..e891669 100644 (file)
@@ -2708,6 +2708,7 @@ bool CGitProgressDlg::CmdSendMail(CString& sWindowTitle, bool& /*localoperation*
        SetWindowText(sWindowTitle);\r
        //SetBackgroundImage(IDI_ADD_BKG);\r
        ReportCmd(CString(MAKEINTRESOURCE(IDS_PROGRS_CMD_SENDMAIL)));\r
+       bool ret=true;\r
 \r
        for(int i=0;i<m_targetPathList.GetCount();i++)\r
        {\r
@@ -2718,8 +2719,11 @@ bool CGitProgressDlg::CmdSendMail(CString& sWindowTitle, bool& /*localoperation*
                if(ret)\r
                {\r
                        Notify(m_targetPathList[i],git_wc_notify_sendmail_error,ret,&patch.m_LastError);\r
+                       ret = false;\r
                }\r
                Notify(m_targetPathList[i],git_wc_notify_sendmail_done,ret);\r
+               if(m_bCancelled)\r
+                       return false;\r
        }\r
-       return true;\r
+       return ret;\r
 }
\ No newline at end of file