56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#ifndef _NNTP_NNTPTHREAD_HPP_
|
|
#define _NNTP_NNTPTHREAD_HPP_
|
|
#ifndef _NNTP_NNTPCLIENT_HPP_
|
|
#include <nntp/nntp.hpp>
|
|
#endif
|
|
#ifndef _NNTP_GROUPITEM_HPP_
|
|
#include <nntp/grpitem.hpp>
|
|
#endif
|
|
#ifndef _THREAD_MESSAGETHREAD_HPP_
|
|
#include <thread/mthread.hpp>
|
|
#endif
|
|
#ifndef _THREAD_THREADMESSAGE_HPP_
|
|
#include <thread/thmsg.hpp>
|
|
#endif
|
|
#ifndef _COMMON_ARRAY_HPP_
|
|
#include <common/array.hpp>
|
|
#endif
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
|
|
class NNTPThread : private MessageThread, public NNTPClient
|
|
{
|
|
public:
|
|
enum HandlerType{MsgPreOpen=0,MsgOpen=1,MsgPostOpen=2};
|
|
NNTPThread(void);
|
|
virtual ~NNTPThread();
|
|
WORD open(const String &serverName);
|
|
WORD open(const String &serverName,const String &userName,const String &password);
|
|
void insertHandler(ThreadCallbackPointer pThreadCallback,HandlerType typeHandler);
|
|
void removeHandler(HandlerType typeHandler);
|
|
BOOL isBlocking(void)const;
|
|
private:
|
|
NNTPThread(const NNTPThread &someNNTPThread);
|
|
void isBlocking(BOOL isBlocking);
|
|
void handleOpen(const String &serverName,const String &userName,const String &password);
|
|
DWORD callHandler(ThreadMessage &someThreadMessage,HandlerType typeHandler);
|
|
DWORD threadHandler(ThreadMessage &someThreadMessage);
|
|
|
|
ThreadCallback<NNTPThread> mThreadHandler;
|
|
Array<ThreadCallbackPointer> mEventHandlers;
|
|
BOOL mIsBlocking;
|
|
};
|
|
|
|
inline
|
|
BOOL NNTPThread::isBlocking(void)const
|
|
{
|
|
return mIsBlocking;
|
|
}
|
|
|
|
inline
|
|
void NNTPThread::isBlocking(BOOL isBlocking)
|
|
{
|
|
mIsBlocking=isBlocking;
|
|
}
|
|
#endif |