00001 #ifndef __FL_IMAP_CONNECT_H__
00002 #define __FL_IMAP_CONNECT_H__
00003
00004 #include <efltk/Fl_Socket.h>
00005 #include <efltk/Fl_String.h>
00006 #include <efltk/Fl_String_List.h>
00007 #include <efltk/Fl_Data_Fields.h>
00008
00009 class Fl_IMAP_Connect : public Fl_Socket {
00010 Fl_String_List m_response;
00011 int m_ident;
00012 static const Fl_String empty_quotes;
00013 protected:
00014 Fl_String send_command(Fl_String cmd);
00015 bool get_response(Fl_String ident);
00016 void parse_search(Fl_String& result);
00017 void parse_message(Fl_Data_Fields& result,bool headers_only);
00018 void parse_folder_list();
00019 public:
00020 Fl_IMAP_Connect();
00021 ~Fl_IMAP_Connect();
00022
00023 void command(Fl_String cmd,const Fl_String& arg1="",const Fl_String& arg2="");
00024 const Fl_String_List& response() const { return m_response; }
00025
00026
00027 void cmd_capability() { command("capability"); }
00028 void cmd_noop() { command("noop"); }
00029 void cmd_logout() { command("logout"); }
00030
00031
00032 void cmd_login(Fl_String user,Fl_String password);
00033
00034
00035
00036 void cmd_select(Fl_String mail_box,int& total_msgs);
00037 void cmd_examine(Fl_String mail_box) { command("examine",mail_box); }
00038 void cmd_subscribe(Fl_String mail_box) { command("subscribe",mail_box); }
00039 void cmd_unsubscribe(Fl_String mail_box) { command("unsubscribe",mail_box); }
00040 void cmd_create(Fl_String mail_box) { command("create",mail_box); }
00041 void cmd_delete(Fl_String mail_box) { command("delete",mail_box); }
00042 void cmd_rename(Fl_String mail_box,Fl_String new_name) { command("rename ",mail_box,new_name); }
00043 void cmd_list(Fl_String mail_box_mask,bool decode=false);
00044
00045
00046
00047
00048 void cmd_close() { command("close"); }
00049 void cmd_expunge() { command("expunge"); }
00050 void cmd_search_all(Fl_String& result);
00051 void cmd_search_new(Fl_String& result);
00052 void cmd_fetch_headers(int msg_id,Fl_Data_Fields& result);
00053 void cmd_fetch_message(int msg_id,Fl_Data_Fields& result);
00054 };
00055
00056 #endif