|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 #ifndef __nsftpdirlistingdconv__h__ |
|
6 #define __nsftpdirlistingdconv__h__ |
|
7 |
|
8 #include "nsIStreamConverter.h" |
|
9 #include "nsString.h" |
|
10 |
|
11 class nsIURI; |
|
12 |
|
13 #define NS_FTPDIRLISTINGCONVERTER_CID \ |
|
14 { /* 14C0E880-623E-11d3-A178-0050041CAF44 */ \ |
|
15 0x14c0e880, \ |
|
16 0x623e, \ |
|
17 0x11d3, \ |
|
18 {0xa1, 0x78, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \ |
|
19 } |
|
20 |
|
21 class nsFTPDirListingConv : public nsIStreamConverter { |
|
22 public: |
|
23 // nsISupports methods |
|
24 NS_DECL_ISUPPORTS |
|
25 |
|
26 // nsIStreamConverter methods |
|
27 NS_DECL_NSISTREAMCONVERTER |
|
28 |
|
29 // nsIStreamListener methods |
|
30 NS_DECL_NSISTREAMLISTENER |
|
31 |
|
32 // nsIRequestObserver methods |
|
33 NS_DECL_NSIREQUESTOBSERVER |
|
34 |
|
35 // nsFTPDirListingConv methods |
|
36 nsFTPDirListingConv(); |
|
37 virtual ~nsFTPDirListingConv(); |
|
38 nsresult Init(); |
|
39 |
|
40 private: |
|
41 // Get the application/http-index-format headers |
|
42 nsresult GetHeaders(nsACString& str, nsIURI* uri); |
|
43 char* DigestBufferLines(char *aBuffer, nsCString &aString); |
|
44 |
|
45 // member data |
|
46 nsCString mBuffer; // buffered data. |
|
47 bool mSentHeading; // have we sent 100, 101, 200, and 300 lines yet? |
|
48 |
|
49 nsIStreamListener *mFinalListener; // this guy gets the converted data via his OnDataAvailable() |
|
50 }; |
|
51 |
|
52 #endif /* __nsftpdirlistingdconv__h__ */ |