summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/groupwise/libgroupwise/eventtransfer.h
blob: ad325619ecafa40fed6fc5b0a86fdb329ef4d104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
    eventtransfer.h - Kopete Groupwise Protocol
    
    Copyright (c) 2004      SUSE Linux AG	 	 http://www.suse.com
    
    Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
 
    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef GW_EVENTTRANSFER_H
#define GW_EVENTTRANSFER_H

#include <tqcstring.h>
#include <tqdatetime.h>

#include "gwerror.h" 

#include "transfer.h"

namespace Event {
	
}

/**
 * Transfer representing an event, a message generated by the server in response to external stimulus
 * This class can contain varying data items depending on the type of event.  
 * You can query which data is present before trying to access it
 * @author Kopete Developers
 */
class EventTransfer : public Transfer
{
public:
	/** 
	 * Flags describing the possible contents of an event transfer
	 */
	enum Contents { EventType = 	0x00000001, 
					Source = 		0x00000002, 
					TimeStamp = 	0x00000004, 
					Guid = 			0x00000008,
					Flags = 		0x00000010,
					Message = 		0x00000020,
					Status = 		0x00000040,
					StatusText = 	0x00000080 };
	/**
	 * Constructor
	 * @param eventType the event code describing the event, see @refGroupWise::Event.
	 * @param source the user generating the event.
	 * @param timeStamp the time at which the event was received.
	 */
	EventTransfer( const TQ_UINT32 eventType, const TQString & source, TQDateTime timeStamp );
	~EventTransfer();
	/** 
	 * Access the bitmask that describes the transfer's contents.  Use @ref Contents to determine what it contains
	 */
	TQ_UINT32 contents();
	/**
	 * Convenience accessors to see what the transfer contains
	 */
	bool hasEventType();
	bool hasSource();
	bool hasTimeStamp();
	bool hasGuid();
	bool hasFlags();
	bool hasMessage();
	bool hasStatus();
	bool hasStatusText();
	
	/**
	 * Accessors for the transfer's contents
	 */
	TransferType type() { return Transfer::EventTransfer; }
	int eventType();
	TQString source();
	TQDateTime timeStamp();
	GroupWise::ConferenceGuid guid();
	TQ_UINT32 flags();
	TQString message();
	TQ_UINT16 status();
	TQString statusText();
	
	/**
	 * Mutators to set the transfer's contents
	 */
	void setGuid( const GroupWise::ConferenceGuid & guid );
	void setFlags( const TQ_UINT32 flags );
	void setMessage( const TQString & message );
	void setStatus( const TQ_UINT16 status );
	void setStatusText( const TQString & statusText);
	
private:
	TQ_UINT32 m_contentFlags;
	int m_eventType;
	TQString m_source;
	TQDateTime m_timeStamp;
	GroupWise::ConferenceGuid m_guid;
	TQ_UINT32 m_flags;
	TQString m_message;
	TQ_UINT16 m_status;
	TQString m_statusText;
};

#endif