00001 // 00002 // Remote.h 00003 // 00004 // Copyright (c) Shareaza Development Team, 2002-2005. 00005 // This file is part of SHAREAZA (www.shareaza.com) 00006 // 00007 // Shareaza is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // Shareaza is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Shareaza; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 00022 #pragma once 00023 00024 #include "Buffer.h" 00025 #include "Transfer.h" 00026 00027 class CMatchFile; 00028 00029 00030 class CRemote : public CTransfer 00031 { 00032 // Construction 00033 public: 00034 CRemote(CConnection* pConnection); 00035 ~CRemote(); 00036 00037 // Attributes 00038 protected: 00039 CString m_sHandshake; 00040 CString m_sRedirect; 00041 CString m_sHeader; 00042 CString m_sResponse; 00043 CBuffer m_pResponse; 00044 CMapStringToString m_pKeys; 00045 static CList<int> m_pCookies; 00046 00047 // Operations 00048 public: 00049 virtual BOOL OnRun(); 00050 virtual void OnDropped(BOOL bError); 00051 virtual BOOL OnRead(); 00052 virtual BOOL OnHeadersComplete(); 00053 protected: 00054 CString GetKey(LPCTSTR pszName); 00055 BOOL CheckCookie(); 00056 void Prepare(LPCTSTR pszPrefix = NULL); 00057 void Add(LPCTSTR pszKey, LPCTSTR pszValue); 00058 void Output(LPCTSTR pszName); 00059 00060 // Page Handlers 00061 protected: 00062 void PageSwitch(CString& strPath); 00063 void PageLogin(); 00064 void PageHome(); 00065 void PageSearch(); 00066 void PageNewSearch(); 00067 void PageDownloads(); 00068 void PageNewDownload(); 00069 void PageUploads(); 00070 void PageNetwork(); 00071 void PageBanner(CString& strPath); 00072 void PageImage(CString& strPath); 00073 00074 // Utilities 00075 protected: 00076 void PageSearchHeaderColumn(int nColumnID, LPCTSTR pszCaption, LPCTSTR pszAlign); 00077 void PageSearchRowColumn(int nColumnID, CMatchFile* pFile, LPCTSTR pszValue, LPCTSTR pszAlign = _T("center")); 00078 void PageNetworkNetwork(int nID, BOOL* pbConnect, LPCTSTR pszName); 00079 };