00001
00022 #ifndef MESSAGEHANDLER_H
00023 #define MESSAGEHANDLER_H
00024
00025 #include <time.h>
00026
00027 #include <sigc++/signal_system.h>
00028
00029 #include <libicq2000/Contact.h>
00030 #include <libicq2000/events.h>
00031
00032 namespace ICQ2000 {
00033
00034 class ContactList;
00035 class ICQSubType;
00036 class UINICQSubType;
00037 class MessageEvent;
00038 class ICQMessageEvent;
00039
00046 class MessageHandler : public SigC::Object {
00047 private:
00048 ContactRef m_self_contact;
00049 ContactList *m_contact_list;
00050
00051 MessageEvent* ICQSubTypeToEvent(ICQSubType *st, ContactRef& contact, bool& adv);
00052 ICQMessageEvent* UINICQSubTypeToEvent(UINICQSubType *st, const ContactRef& contact);
00053
00054 ContactRef lookupUIN(unsigned int uin);
00055 ContactRef lookupEmail(const std::string& email, const std::string& alias);
00056 ContactRef lookupMobile(const std::string& m);
00057
00058 UINICQSubType* EventToUINICQSubType(MessageEvent *ev);
00059
00060 void SignalLog(LogEvent::LogType type, const std::string& msg);
00061
00062 public:
00063 MessageHandler(ContactRef self, ContactList *cl);
00064
00065
00066 bool handleIncoming(ICQSubType* icq, time_t t = 0);
00067
00068
00069 UINICQSubType* handleOutgoing(MessageEvent *ev);
00070
00071
00072 void handleIncomingACK(MessageEvent *ev, UINICQSubType* icq);
00073
00074 SigC::Signal1<void,MessageEvent*> messaged;
00075 SigC::Signal1<void,MessageEvent*> messageack;
00076 SigC::Signal1<void,ICQMessageEvent*> want_auto_resp;
00077 SigC::Signal1<void,LogEvent*> logger;
00078 };
00079 }
00080
00081 #endif