interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/metaobjects/ircbridge/ircbridge.hh

Go to the documentation of this file.
00001 #ifndef _IRCBRIDGE_HH_
00002 
00003 #include <vos/vos/vos.hh>
00004 #include <vos/metaobjects/ircbridge/ircdefs.hh>
00005 #include <vos/metaobjects/misc/talkative.hh>
00006 
00007 #ifndef IRCBRIDGE_EXPORTS
00008 IMPORT_METAOBJECT_FACTORIES(IrcBridge)
00009 #endif
00010 
00011 namespace VOS {
00012 class IrcClient;
00013 class IrcUser;
00014 
00015 class IRCBRIDGE_API IrcBridge : public MetaObject,
00016                            public ChildChangeListener,
00017                            public TalkListener,
00018                            public VUtil::ObjectExciseListener
00019 {
00020 private:
00021     boost::mutex clients_mutex;
00022     std::list< VUtil::vRef<IrcClient> > clients;
00023 
00024     boost::mutex users_mutex;
00025     std::map< std::string, VUtil::vRef<IrcUser> > users;
00026 
00027 public:
00028     IrcBridge(VOS::VobjectBase* base);
00029     virtual ~IrcBridge();
00030 
00031     virtual const std::string getVOSType();
00032 
00033     std::string ircserver;
00034     unsigned int ircport;
00035     std::string channel;
00036 
00037     VUtil::vRef<IrcUser> getIrcUser(const std::string& name, bool create = false);
00038     void renameUser(const std::string& oldname, const std::string& newname);
00039 
00040     static MetaObject* new_IrcBridge(VobjectBase* base, const std::string& type);
00041 
00042     void init(const char* ircserver, unsigned int port, const char* channel);
00043     void addIrcUsers(const char* u);
00044 
00045     void removeClient(IrcClient* ic);
00046 
00047     virtual void notifyChildInserted(VobjectEvent &e);
00048     virtual void notifyChildReplaced(VobjectEvent &e);
00049     virtual void notifyChildRemoved(VobjectEvent &e);
00050     virtual void notifyObjectExcise(VUtil::RefCounted* rc);
00051     virtual void notifyTalkMessage(TalkMessage& m);
00052 };
00053 
00054 
00055 class IRCBRIDGE_API IrcUser : public LocalTalkative,
00056                          public TalkListener
00057 {
00058 public:
00059     IrcUser(VobjectBase* base);
00060     virtual ~IrcUser();
00061 
00062     static MetaObject* new_IrcUser(VobjectBase* base, const std::string& type);
00063 
00064     virtual void notifyTalkMessage(TalkMessage& m);
00065 };
00066     }
00067 
00068 #endif