Back to index

im-sdk  12.3.91
IIIMP_IMState.hh
Go to the documentation of this file.
00001 #ifndef IIIMP_IMSTATE_HH_
00002 #define IIIMP_IMSTATE_HH_
00003 #include <iiimp.h>
00004 #include "basictype.hh"
00005 #include "IMState.hh"
00006 #include "IMHotkeyPrimitive.hh"
00007 #include "IMHotkey.hh"
00008 #include "lexmlconf.h"
00009 
00010 class IIIMProtocol;
00011 class IIIMPTrans;
00012 class IIIMP_IMState : public IMState
00013 {
00014   public:
00015   typedef pair<u16string, string> UserHostPair;
00016   typedef std::multimap<UserHostPair, IIIMP_IMState *> UserIMStateMap;
00017 
00018   private:
00019     static UserIMStateMap user_imstate_map;
00020     IIIMPTrans *pimt;
00021     bool parse_user_name(
00022        const u16string& uname,
00023        u16string& username,
00024        u16string& password,
00025        string& hostname
00026     );
00027     bool send_protocol_version(
00028        int client_proto_version
00029     );
00030     virtual bool message_proc(
00031        void *message
00032     );
00033     virtual void destroy();
00034 
00035   public:
00036     static IIIMP_IMState *get_imstate_from_desktop(
00037         iml_desktop_t *desktop
00038     );
00039     bool send_trigger_keys();
00040     bool send_hotkeys(const u16string& curr_input_lang, HotKeyList *hlist);
00041     bool switch_hotkey_profile();
00042     void create(IIIMP_IMState *pims);
00043     bool send(
00044        IIIMP_message* pmes,
00045        bool deletep = false
00046     );
00047     IIIMPTrans* get_iiimptrans()
00048     { return pimt; }
00049     IIIMP_IMState(
00050        IIIMP_IMState &x,
00051        int proto_version
00052     ) : IMState(x, proto_version)
00053     {
00054        pimt = x.pimt;
00055     }
00056     IIIMP_IMState(
00057        IIIMProtocol *pimp,
00058        IIIMPTrans *pimt,
00059        int proto_version
00060     );
00061     friend int update_supported_langlist_for_le(
00062         iml_desktop_t *desktop,
00063         IMLEName *lename,
00064         IMLocale *locales,
00065         int nLocales
00066     );
00067     friend int switch_le_profile(
00068         iml_desktop_t *desktop,
00069         IMLEName *lename
00070     );
00071 };
00072 
00073 class IIIMP_IMState_Session;
00074 // In this state, the IM user is correctly identified by IM_CONNECT.
00075 // And waiting the client's request.
00076 class IIIMP_IMState_Identified : public IIIMP_IMState
00077 {
00078     void exit_from_identified();
00079     IIIMP_imattribute *create_object_descriptors();
00080     IIIMP_language *create_language_list(
00081        const IMLangList *plangs
00082     );
00083     IIIMP_imeinfo *create_imeinfo_list(
00084        const IMImeInfoList *pimeinfos
00085     );
00086     IIIMP_imattribute *create_input_method_descriptors();
00087     bool set_data_to_client();
00088     IIIMP_imattribute* get_imattribute(
00089        IIIMP_card16 id
00090     );
00091     virtual bool message_proc(
00092        void *message
00093     );
00094 
00095   public:
00096     IIIMP_IMState_Identified(
00097        IIIMP_IMState *pimt,
00098        IMHandler *pimh,
00099        int proto_version
00100     );
00101     friend int update_supported_langlist_for_le(
00102         IMLEName *lename,
00103         IMLocale *locales,
00104         int nLocales
00105     );
00106     friend int switch_le_profile(
00107         IMLEName *lename
00108     );
00109 };
00110 
00111 // In this state, the IM receives a request from the client, but
00112 // still continue the session.  Note that transfering it to
00113 // IIIMP_IMState_Identified involves to send the corresponding
00114 // reply message.
00115 class IIIMP_IMState_Session : public IIIMP_IMState
00116 {
00117     virtual bool message_proc(
00118        void *message
00119     );
00120 
00121   public:
00122     IIIMP_IMState_Session(
00123        IIIMP_IMState_Identified *pimt
00124     );
00125 };
00126 
00127 #endif /* not IIIMP_IMSTATE_HH_ */
00128 
00129 /* Local Variables: */
00130 /* c-file-style: "iiim-project" */
00131 /* End: */