1 |
/* ============================================================================ |
2 |
* Douglas Thrift's Web Contact License |
3 |
* |
4 |
* Copyright (C) 2002, Douglas Thrift. All Rights Reserved. |
5 |
* |
6 |
* Redistribution and use in source and binary forms, with or without |
7 |
* modification, are permitted provided that the following conditions are met: |
8 |
* |
9 |
* 1. Redistributions of source code must retain the above copyright notice, |
10 |
* this list of conditions and the following disclaimer. |
11 |
* |
12 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
13 |
* this list of conditions and the following disclaimer in the documentation |
14 |
* and/or other materials provided with the distribution. |
15 |
* |
16 |
* 3. The end-user documentation included with the redistribution, if any, must |
17 |
* include the following acknowledgment: |
18 |
* |
19 |
* "This product includes software developed by Douglas Thrift |
20 |
* (http://computers.douglasthrift.net/webcontact.html)." |
21 |
* |
22 |
* Alternately, this acknowledgment may appear in the software itself, if |
23 |
* and wherever such third-party acknowledgments normally appear. |
24 |
* |
25 |
* 4. The names "Douglas Thrift" and "Douglas Thrift's Web Contact" must not be |
26 |
* used to endorse or promote products derived from this software without |
27 |
* specific prior written permission. For written permission, please visit |
28 |
* http://www.douglasthrift.net/contact.html for contact information. |
29 |
* |
30 |
* 5. Products derived from this software may not be called "Douglas Thrift's |
31 |
* Web Contact", nor may "Douglas Thrift's Web Contact" appear in their |
32 |
* name, without prior written permission. |
33 |
* |
34 |
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
35 |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
36 |
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
37 |
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
38 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
39 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
40 |
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
41 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
42 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
43 |
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
44 |
* ============================================================================ |
45 |
*/ |
46 |
// Windows XP FAQ Poll |
47 |
// |
48 |
// Douglas Thrift |
49 |
// |
50 |
// IMAPHandler.h |
51 |
|
52 |
#ifndef _IMAPHandler_h_ |
53 |
#define _IMAPHandler_h_ |
54 |
|
55 |
#include "WinXPFAQPoll.h" |
56 |
#include <jni.h> |
57 |
|
58 |
class IMAPHandler |
59 |
{ |
60 |
private: |
61 |
char* jarPath; |
62 |
JavaVMOption options[1]; |
63 |
JNIEnv* env; |
64 |
JavaVM* jvm; |
65 |
JavaVMInitArgs vm_args; |
66 |
long status; |
67 |
jclass cls; |
68 |
jmethodID mid; |
69 |
jobject obj; |
70 |
void setJarPath(); |
71 |
string imap(char* imap); |
72 |
string imap(char* imap, const string& args); |
73 |
string imap(char* imap, const string& args, const string& message); |
74 |
public: |
75 |
IMAPHandler(const string& host, unsigned port); |
76 |
~IMAPHandler(); |
77 |
string capability() { return imap("capability"); } |
78 |
string noop() { return imap("noop"); } |
79 |
string logout() { return imap("logout"); } |
80 |
string login(const string& args) { return imap("login", args); } |
81 |
string select(const string& args) { return imap("select", args); } |
82 |
string examine(const string& args) { return imap("examine", args); } |
83 |
string create(const string& args) { return imap("create", args); } |
84 |
string delete_(const string& args) { return imap("delete", args); } |
85 |
string rename(const string& args) { return imap("rename", args); } |
86 |
string subscribe(const string& args) { return imap("subscribe", args); } |
87 |
string unsubscribe(const string& args) { return imap("unsubscribe", args); } |
88 |
string list(const string& args) { return imap("list", args); } |
89 |
string lsub(const string& args) { return imap("lsub", args); } |
90 |
string status_(const string& args) { return imap("status", args); } |
91 |
string append(const string& args, const string& message) |
92 |
{ |
93 |
return imap("append", args, message); |
94 |
} |
95 |
string check() { return imap("check"); } |
96 |
string close() { return imap("close"); } |
97 |
string expunge() { return imap("expunge"); } |
98 |
string search(const string& args) { return imap("search", args); } |
99 |
string fetch(const string& args) { return imap("fetch", args); } |
100 |
string store(const string& args) { return imap("store", args); } |
101 |
string copy(const string& args) { return imap("copy", args); } |
102 |
string uid(const string& args) { return imap("uid", args); } |
103 |
bool successful(); |
104 |
}; |
105 |
|
106 |
#endif // _IMAPHandler_h_ |