Dennis Syrovatsky | 139d783 | 2005-11-02 05:36:05 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2005 TightVNC Team. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | * |
| 18 | * TightVNC distribution homepage on the Web: http://www.tightvnc.com/ |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | // -=- FileTransfer.cxx |
| 23 | |
| 24 | #include <vncviewer/FileTransfer.h> |
| 25 | |
| 26 | using namespace rfb; |
| 27 | using namespace rfb::win32; |
| 28 | |
| 29 | FileTransfer::FileTransfer() |
| 30 | { |
Dennis Syrovatsky | 4ab4185 | 2005-11-07 09:52:36 +0000 | [diff] [blame] | 31 | m_bFTDlgShown = false; |
Dennis Syrovatsky | 5c76117 | 2005-11-09 04:19:05 +0000 | [diff] [blame] | 32 | m_bInitialized = false; |
| 33 | |
Dennis Syrovatsky | 4ab4185 | 2005-11-07 09:52:36 +0000 | [diff] [blame] | 34 | m_pFTDialog = new FTDialog(GetModuleHandle(0), this); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 35 | |
| 36 | m_pReader = NULL; |
| 37 | m_pWriter = NULL; |
Dennis Syrovatsky | 139d783 | 2005-11-02 05:36:05 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | FileTransfer::~FileTransfer() |
| 41 | { |
Dennis Syrovatsky | 4ab4185 | 2005-11-07 09:52:36 +0000 | [diff] [blame] | 42 | if (m_pFTDialog != NULL) { |
| 43 | delete m_pFTDialog; |
| 44 | m_pFTDialog = NULL; |
| 45 | } |
| 46 | } |
Dennis Syrovatsky | 139d783 | 2005-11-02 05:36:05 +0000 | [diff] [blame] | 47 | |
Dennis Syrovatsky | 5c76117 | 2005-11-09 04:19:05 +0000 | [diff] [blame] | 48 | bool |
| 49 | FileTransfer::initialize(rdr::InStream *pIS, rdr::OutStream *pOS) |
| 50 | { |
| 51 | if (m_bInitialized) return false; |
| 52 | |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 53 | m_pReader = new FTMsgReader(pIS); |
| 54 | m_pWriter = new FTMsgWriter(pOS); |
Dennis Syrovatsky | 5c76117 | 2005-11-09 04:19:05 +0000 | [diff] [blame] | 55 | |
| 56 | m_bInitialized = true; |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | bool |
Dennis Syrovatsky | b595e03 | 2005-11-09 06:24:25 +0000 | [diff] [blame] | 61 | FileTransfer::show() |
Dennis Syrovatsky | 4ab4185 | 2005-11-07 09:52:36 +0000 | [diff] [blame] | 62 | { |
Dennis Syrovatsky | da17d21 | 2005-11-09 05:58:30 +0000 | [diff] [blame] | 63 | if (!m_bInitialized) return false; |
| 64 | |
Dennis Syrovatsky | 4ab4185 | 2005-11-07 09:52:36 +0000 | [diff] [blame] | 65 | m_bFTDlgShown = m_pFTDialog->createFTDialog(); |
Dennis Syrovatsky | 5c76117 | 2005-11-09 04:19:05 +0000 | [diff] [blame] | 66 | return m_bFTDlgShown; |
Dennis Syrovatsky | 139d783 | 2005-11-02 05:36:05 +0000 | [diff] [blame] | 67 | } |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 68 | |
| 69 | bool |
| 70 | FileTransfer::processFTMsg(int type) |
| 71 | { |
| 72 | if (m_bInitialized) return false; |
| 73 | |
| 74 | switch (type) |
| 75 | { |
| 76 | case msgTypeFileListData: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 77 | return procFileListDataMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 78 | case msgTypeFileDownloadData: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 79 | return procFileDownloadDataMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 80 | case msgTypeFileUploadCancel: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 81 | return procFileUploadCancelMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 82 | case msgTypeFileDownloadFailed: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 83 | return procFileDownloadFailedMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 84 | case msgTypeFileDirSizeData: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 85 | return procFileDirSizeDataMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 86 | case msgTypeFileLastRequestFailed: |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 87 | return procFileLastRqstFailedMsg(); |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 88 | default: |
| 89 | return false; |
| 90 | } |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 91 | } |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 92 | |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 93 | bool |
| 94 | FileTransfer::procFileListDataMsg() |
| 95 | { |
Dennis Syrovatsky | 63943a3 | 2005-11-10 06:24:56 +0000 | [diff] [blame] | 96 | return false; |
Dennis Syrovatsky | c08f042 | 2005-11-10 06:36:46 +0000 | [diff] [blame^] | 97 | } |
| 98 | |
| 99 | bool |
| 100 | FileTransfer::procFileDownloadDataMsg() |
| 101 | { |
| 102 | return false; |
| 103 | } |
| 104 | |
| 105 | bool |
| 106 | FileTransfer::procFileUploadCancelMsg() |
| 107 | { |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | bool |
| 112 | FileTransfer::procFileDownloadFailedMsg() |
| 113 | { |
| 114 | return false; |
| 115 | } |
| 116 | |
| 117 | bool |
| 118 | FileTransfer::procFileDirSizeDataMsg() |
| 119 | { |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | bool |
| 124 | FileTransfer::procFileLastRqstFailedMsg() |
| 125 | { |
| 126 | return false; |
| 127 | } |