OSDN Git Service

Prepare for release of 1.98f.
[ffftp/ffftp.git] / ftpproc.c
index 8639482..94ad8a2 100644 (file)
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -71,7 +71,7 @@ static INT_PTR CALLBACK MirrorNotifyCallBack(HWND hDlg, UINT iMessage, WPARAM wP
 static INT_PTR CALLBACK MirrorDispListCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static void CountMirrorFiles(HWND hDlg, TRANSPACKET *Pkt);\r
 static int AskMirrorNoTrn(char *Fname, int Mode);\r
-static int AskUpLoadFileAttr(char *Fname);\r
+static int AskUploadFileAttr(char *Fname);\r
 // 64ビット対応\r
 //static BOOL CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
 static INT_PTR CALLBACK UpDownAsDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);\r
@@ -140,14 +140,13 @@ static double FileSize;           /* ファイル総容量 */
 \r
 // ディレクトリ自動作成\r
 // ローカル側のパスから必要なフォルダを作成\r
-int MakeDirFromLocalPath(char* LocalFile)\r
+int MakeDirFromLocalPath(char* LocalFile, char* Old)\r
 {\r
        TRANSPACKET Pkt;\r
        char* pDelimiter;\r
        char* pNext;\r
        char* Cat;\r
        int Len;\r
-       char Tmp[FMAX_PATH+1];\r
        int Make;\r
        pDelimiter = LocalFile;\r
        Make = NO;\r
@@ -156,9 +155,7 @@ int MakeDirFromLocalPath(char* LocalFile)
                Len = pNext - LocalFile;\r
                strncpy(Pkt.LocalFile, LocalFile, Len);\r
                Pkt.LocalFile[Len] = '\0';\r
-               AskLocalCurDir(Tmp, FMAX_PATH);\r
-               SetYenTail(Tmp);\r
-               if(strncmp(LocalFile, Tmp, Len + 1) != 0)\r
+               if(strncmp(LocalFile, Old, Len + 1) != 0)\r
                {\r
                        Cat = Pkt.LocalFile + (pDelimiter - LocalFile);\r
                        if(FnameCnv == FNAME_LOWER)\r
@@ -178,11 +175,13 @@ int MakeDirFromLocalPath(char* LocalFile)
        return Make;\r
 }\r
 \r
-void DownLoadProc(int ChName, int ForceFile, int All)\r
+void DownloadProc(int ChName, int ForceFile, int All)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
        TRANSPACKET Pkt;\r
+       // ディレクトリ自動作成\r
+       char Tmp[FMAX_PATH+1];\r
 \r
        // 同時接続対応\r
        CancelFlg = NO;\r
@@ -286,6 +285,8 @@ void DownLoadProc(int ChName, int ForceFile, int All)
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                Pkt.KanaCnv = AskHostKanaCnv();\r
 \r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.LocalFile);\r
                                Pkt.Mode = CheckLocalFile(&Pkt);        /* Pkt.ExistSize がセットされる */\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
@@ -294,7 +295,7 @@ void DownLoadProc(int ChName, int ForceFile, int All)
 //                                     AddTransFileList(&Pkt);\r
                                {\r
                                        if(MakeAllDir == YES)\r
-                                               MakeDirFromLocalPath(Pkt.LocalFile);\r
+                                               MakeDirFromLocalPath(Pkt.LocalFile, Tmp);\r
                                        AddTransFileList(&Pkt);\r
                                }\r
                        }\r
@@ -313,6 +314,9 @@ void DownLoadProc(int ChName, int ForceFile, int All)
 //             strcpy(Pkt.Cmd, "GOQUIT");\r
 //             AddTransFileList(&Pkt);\r
 \r
+               // バグ対策\r
+               AddNullTransFileList();\r
+\r
                GoForwardTransWindow();\r
 //             KeepTransferDialog(NO);\r
 \r
@@ -331,9 +335,11 @@ void DownLoadProc(int ChName, int ForceFile, int All)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void DirectDownLoadProc(char *Fname)\r
+void DirectDownloadProc(char *Fname)\r
 {\r
        TRANSPACKET Pkt;\r
+       // ディレクトリ自動作成\r
+       char Tmp[FMAX_PATH+1];\r
 \r
        // 同時接続対応\r
        CancelFlg = NO;\r
@@ -399,9 +405,17 @@ void DirectDownLoadProc(char *Fname)
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
                                Pkt.KanaCnv = AskHostKanaCnv();\r
 \r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.LocalFile);\r
                                Pkt.Mode = CheckLocalFile(&Pkt);        /* Pkt.ExistSize がセットされる */\r
                                if((Pkt.Mode != EXIST_ABORT) && (Pkt.Mode != EXIST_IGNORE))\r
+                               // ディレクトリ自動作成\r
+//                                     AddTransFileList(&Pkt);\r
+                               {\r
+                                       if(MakeAllDir == YES)\r
+                                               MakeDirFromLocalPath(Pkt.LocalFile, Tmp);\r
                                        AddTransFileList(&Pkt);\r
+                               }\r
                        }\r
                }\r
 \r
@@ -416,6 +430,9 @@ void DirectDownLoadProc(char *Fname)
 //             strcpy(Pkt.Cmd, "GOQUIT");\r
 //             AddTransFileList(&Pkt);\r
 \r
+               // バグ対策\r
+               AddNullTransFileList();\r
+\r
                GoForwardTransWindow();\r
 //             KeepTransferDialog(NO);\r
 \r
@@ -434,7 +451,7 @@ void DirectDownLoadProc(char *Fname)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void InputDownLoadProc(void)\r
+void InputDownloadProc(void)\r
 {\r
        char Path[FMAX_PATH+1];\r
        int Tmp;\r
@@ -444,7 +461,7 @@ void InputDownLoadProc(void)
        strcpy(Path, "");\r
        if(InputDialogBox(downname_dlg, GetMainHwnd(), NULL, Path, FMAX_PATH, &Tmp, IDH_HELP_TOPIC_0000001) == YES)\r
        {\r
-               DirectDownLoadProc(Path);\r
+               DirectDownloadProc(Path);\r
        }\r
 \r
 //     EnableUserOpe();\r
@@ -686,6 +703,9 @@ void MirrorDownloadProc(int Notify)
                        else\r
                                EraseTmpTransFileList(&Base);\r
 \r
+                       // バグ対策\r
+                       AddNullTransFileList();\r
+\r
                        DeleteFileList(&LocalListBase);\r
                        DeleteFileList(&RemoteListBase);\r
 \r
@@ -940,7 +960,7 @@ static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM
 \r
 // ディレクトリ自動作成\r
 // リモート側のパスから必要なディレクトリを作成\r
-int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)\r
+int MakeDirFromRemotePath(char* RemoteFile, char* Old, int FirstAdd)\r
 {\r
        TRANSPACKET Pkt;\r
        TRANSPACKET Pkt1;\r
@@ -948,7 +968,6 @@ int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)
        char* pNext;\r
        char* Cat;\r
        int Len;\r
-       char Tmp[FMAX_PATH+1];\r
        int Make;\r
        pDelimiter = RemoteFile;\r
        Make = NO;\r
@@ -957,9 +976,7 @@ int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)
                Len = pNext - RemoteFile;\r
                strncpy(Pkt.RemoteFile, RemoteFile, Len);\r
                Pkt.RemoteFile[Len] = '\0';\r
-               AskRemoteCurDir(Tmp, FMAX_PATH);\r
-               SetSlashTail(Tmp);\r
-               if(strncmp(RemoteFile, Tmp, Len + 1) != 0)\r
+               if(strncmp(RemoteFile, Old, Len + 1) != 0)\r
                {\r
                        Cat = Pkt.RemoteFile + (pDelimiter - RemoteFile);\r
                        if(FnameCnv == FNAME_LOWER)\r
@@ -1004,7 +1021,7 @@ int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)
        return Make;\r
 }\r
 \r
-void UpLoadListProc(int ChName, int All)\r
+void UploadListProc(int ChName, int All)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
@@ -1143,7 +1160,7 @@ void UpLoadListProc(int ChName, int All)
                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                Pkt.Size = 0;\r
                                Pkt.Time = Pos->Time;\r
-                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                // UTF-8対応\r
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
@@ -1153,6 +1170,8 @@ void UpLoadListProc(int ChName, int All)
                                        CalcExtentSize(&Pkt, Pos->Size);\r
                                }\r
 #endif\r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.RemoteFile);\r
                                Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
@@ -1161,7 +1180,7 @@ void UpLoadListProc(int ChName, int All)
                                        // ディレクトリ自動作成\r
                                        if(MakeAllDir == YES)\r
                                        {\r
-                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)\r
+                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, Tmp, FirstAdd) == YES)\r
                                                        FirstAdd = NO;\r
                                        }\r
                                        if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
@@ -1193,6 +1212,9 @@ void UpLoadListProc(int ChName, int All)
 //             strcpy(Pkt.Cmd, "GOQUIT");\r
 //             AddTransFileList(&Pkt);\r
 \r
+               // バグ対策\r
+               AddNullTransFileList();\r
+\r
                GoForwardTransWindow();\r
 \r
                EnableUserOpe();\r
@@ -1210,7 +1232,7 @@ void UpLoadListProc(int ChName, int All)
 *              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
-void UpLoadDragProc(WPARAM wParam)\r
+void UploadDragProc(WPARAM wParam)\r
 {\r
        FILELIST *FileListBase;\r
        FILELIST *Pos;\r
@@ -1316,7 +1338,7 @@ void UpLoadDragProc(WPARAM wParam)
                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                Pkt.Size = 0;\r
                                Pkt.Time = Pos->Time;\r
-                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                // UTF-8対応\r
                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
@@ -1327,6 +1349,8 @@ void UpLoadDragProc(WPARAM wParam)
                                        CalcExtentSize(&Pkt, Pos->Size);\r
                                }\r
 #endif\r
+                               // ディレクトリ自動作成\r
+                               strcpy(Tmp, Pkt.RemoteFile);\r
                                Pkt.Mode = CheckRemoteFile(&Pkt, RemoteList);\r
                                if(Pkt.Mode == EXIST_ABORT)\r
                                        break;\r
@@ -1335,7 +1359,7 @@ void UpLoadDragProc(WPARAM wParam)
                                        // ディレクトリ自動作成\r
                                        if(MakeAllDir == YES)\r
                                        {\r
-                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)\r
+                                               if(MakeDirFromRemotePath(Pkt.RemoteFile, Tmp, FirstAdd) == YES)\r
                                                        FirstAdd = NO;\r
                                        }\r
                                        if((FirstAdd == YES) && (AskNoFullPathMode() == YES))\r
@@ -1367,6 +1391,9 @@ void UpLoadDragProc(WPARAM wParam)
 //             strcpy(Pkt.Cmd, "GOQUIT");\r
 //             AddTransFileList(&Pkt);\r
 \r
+               // バグ対策\r
+               AddNullTransFileList();\r
+\r
                GoForwardTransWindow();\r
 \r
                EnableUserOpe();\r
@@ -1600,7 +1627,7 @@ void MirrorUploadProc(int Notify)
                                                Pkt.Type = AskTransferTypeAssoc(Pkt.LocalFile, AskTransferType());\r
                                                Pkt.Size = 0;\r
                                                Pkt.Time = LocalPos->Time;\r
-                                               Pkt.Attr = AskUpLoadFileAttr(Pkt.RemoteFile);\r
+                                               Pkt.Attr = AskUploadFileAttr(Pkt.RemoteFile);\r
                                                Pkt.KanjiCode = AskHostKanjiCode();\r
                                                // UTF-8対応\r
                                                Pkt.KanjiCodeDesired = AskLocalKanjiCode();\r
@@ -1642,6 +1669,9 @@ void MirrorUploadProc(int Notify)
                        else\r
                                EraseTmpTransFileList(&Base);\r
 \r
+                       // バグ対策\r
+                       AddNullTransFileList();\r
+\r
                        DeleteFileList(&LocalListBase);\r
                        DeleteFileList(&RemoteListBase);\r
 \r
@@ -1973,7 +2003,7 @@ static int AskMirrorNoTrn(char *Fname, int Mode)
 *              int 属性 (-1=設定なし)\r
 *----------------------------------------------------------------------------*/\r
 \r
-static int AskUpLoadFileAttr(char *Fname)\r
+static int AskUploadFileAttr(char *Fname)\r
 {\r
        int Ret;\r
        int Sts;\r
@@ -3663,7 +3693,7 @@ void NoopProc(void)
        CancelCheckWork = NO;\r
        if(AskConnecting() == YES && AskUserOpeDisabled() == NO)\r
        {\r
-               if(AskReuseCmdSkt() == NO || AskShareProh() == YES)\r
+               if(AskReuseCmdSkt() == NO || AskShareProh() == YES || AskTransferNow() == NO)\r
                {\r
                        DisableUserOpe();\r
                        DoDirListCmdSkt("", "", 999, &CancelCheckWork);\r