OSDN Git Service

Send mail: Combine to one email work.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / SVNProgressDlg.cpp
index e891669..9e5948e 100644 (file)
@@ -2709,21 +2709,38 @@ bool CGitProgressDlg::CmdSendMail(CString& sWindowTitle, bool& /*localoperation*
        //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
+       if(this->m_SendMailFlags&SENDMAIL_COMBINED)\r
        {\r
-               CPatch patch;\r
-               Notify(m_targetPathList[i],git_wc_notify_sendmail_start);\r
-               int ret=patch.Send((CString&)m_targetPathList[i].GetWinPathString(),this->m_SendMailTO,\r
-                                this->m_SendMailCC,this->m_SendMailFlags&SENDMAIL_ATTACHMENT);\r
-               if(ret)\r
+               CString error;\r
+               CTGitPath path;\r
+               Notify(path,git_wc_notify_sendmail_start);\r
+               CString err;\r
+               if(CPatch::Send(m_targetPathList,m_SendMailTO,m_SendMailCC,m_SendMailSubject,this->m_SendMailFlags&SENDMAIL_COMBINED,&err))\r
                {\r
-                       Notify(m_targetPathList[i],git_wc_notify_sendmail_error,ret,&patch.m_LastError);\r
+                       Notify(path,git_wc_notify_sendmail_error,ret,&err);\r
                        ret = false;\r
+               }else\r
+               {\r
+                       Notify(path,git_wc_notify_sendmail_done,ret);\r
+               }\r
+\r
+       }else\r
+       {\r
+               for(int i=0;i<m_targetPathList.GetCount();i++)\r
+               {\r
+                       CPatch patch;\r
+                       Notify(m_targetPathList[i],git_wc_notify_sendmail_start);\r
+                       int ret=patch.Send((CString&)m_targetPathList[i].GetWinPathString(),this->m_SendMailTO,\r
+                                        this->m_SendMailCC,this->m_SendMailFlags&SENDMAIL_ATTACHMENT);\r
+                       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
-               Notify(m_targetPathList[i],git_wc_notify_sendmail_done,ret);\r
-               if(m_bCancelled)\r
-                       return false;\r
        }\r
        return ret;\r
 }
\ No newline at end of file