messagesession.h

00001 /*
00002   Copyright (c) 2005-2006 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef MESSAGESESSION_H__
00015 #define MESSAGESESSION_H__
00016 
00017 #include "messagehandler.h"
00018 #include "jid.h"
00019 
00020 #include <string>
00021 
00022 namespace gloox
00023 {
00024 
00025   class ClientBase;
00026   class Tag;
00027   class MessageFilter;
00028 
00139   class GLOOX_API MessageSession : public MessageHandler
00140   {
00141 
00142     friend class MessageEventFilter;
00143     friend class ChatStateFilter;
00144     friend class InBandBytestream;
00145 
00146     public:
00161       MessageSession( ClientBase *parent, const JID& jid, bool wantUpgrade = true );
00162 
00169       virtual ~MessageSession();
00170 
00175       const JID& target() const { return m_target; };
00176 
00182       const std::string& threadID() const { return m_thread; };
00183 
00190       void registerMessageHandler( MessageHandler *mh );
00191 
00196       void removeMessageHandler();
00197 
00204       void send( const std::string& message, const std::string& subject = "" );
00205 
00211       void registerMessageFilter( MessageFilter *mf );
00212 
00217       void removeMessageFilter( MessageFilter *mf );
00218 
00219       // reimplemented from MessageHandler
00220       virtual void handleMessage( Stanza *stanza );
00221 
00222     protected:
00229       virtual void send( Tag *tag );
00230 
00231     private:
00232       void setResource( const std::string& resource );
00233 
00234       typedef std::list<MessageFilter*> MessageFilterList;
00235 
00236       MessageFilterList m_messageFilterList;
00237       ClientBase *m_parent;
00238       JID m_target;
00239       MessageHandler *m_messageHandler;
00240       std::string m_thread;
00241       bool m_wantUpgrade;
00242 
00243   };
00244 
00245 }
00246 
00247 #endif // MESSAGESESSION_H__

Generated on Tue May 1 14:20:20 2007 for gloox by  doxygen 1.5.1