Debian Codegraph @

plugins/collab/core/account/xp/SessionEvent.h

raw
1 /* Copyright (C) 2006 by Marc Maurer <[email protected]>
2 * Copyright (C) 2007 One Laptop Per Child
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #ifndef __SESSIONEVENT_H__
21 #define __SESSIONEVENT_H__
22
23 #include "Event.h"
24 #include <session/xp/AbiCollab.h>
25 #include <packet/xp/AbiCollab_Packet.h>
26
27 class StartSessionEvent : public Event
28 {
29 public:
30 DECLARE_PACKET(StartSessionEvent);
31 };
32
33 class GetSessionsEvent : public Event
34 {
35 public:
36 DECLARE_PACKET(GetSessionsEvent);
37 };
38
39 class GetSessionsResponseEvent : public Event
40 {
41 public:
42 DECLARE_PACKET(GetSessionsResponseEvent);
43 std::map<UT_UTF8String,UT_UTF8String> m_Sessions; // contains session/name pairs
44 };
45
46 class JoinSessionEvent : public Event
47 {
48 public:
49 DECLARE_PACKET(JoinSessionEvent);
50 JoinSessionEvent() : m_sSessionId("") {}
51 JoinSessionEvent(const UT_UTF8String& sessionId)
52 : m_sSessionId(sessionId)
53 {
54 UT_ASSERT(m_sSessionId != "");
55 }
56
57 virtual std::string toStr() const;
58
59 const UT_UTF8String& getSessionId() const
60 { return m_sSessionId; }
61
62 private:
63 UT_UTF8String m_sSessionId;
64 };
65
66 class JoinSessionRequestEvent : public JoinSessionEvent {
67 public:
68 DECLARE_PACKET(JoinSessionRequestEvent);
69 JoinSessionRequestEvent() {}
70 JoinSessionRequestEvent(const UT_UTF8String& sessionId)
71 : JoinSessionEvent(sessionId) {}
72 };
73
74 class JoinSessionRequestResponseEvent : public Event
75 {
76 public:
77 DECLARE_PACKET(JoinSessionRequestResponseEvent);
78 JoinSessionRequestResponseEvent() : m_sDocumentName(""), m_sDocumentId(""), m_sSessionId(""), m_iAuthorId(-1) {}
79 JoinSessionRequestResponseEvent(const UT_UTF8String& sessionId, UT_sint32 iAuthorId)
80 : m_iRev(0)
81 , m_sDocumentName("")
82 , m_sDocumentId("")
83 , m_sSessionId(sessionId)
84 , m_iAuthorId(iAuthorId)
85 {
86 UT_ASSERT(m_sSessionId != "");
87 }
88
89 const UT_UTF8String& getSessionId() const
90 { return m_sSessionId; }
91
92 UT_sint32 getAuthorId() const
93 { return m_iAuthorId; }
94
95 virtual std::string toStr() const;
96
97 std::string m_sZABW;
98 UT_sint32 m_iRev;
99 UT_UTF8String m_sDocumentName;
100 UT_UTF8String m_sDocumentId;
101
102 private:
103 UT_UTF8String m_sSessionId;
104 UT_sint32 m_iAuthorId;
105 };
106
107 class DisjoinSessionEvent : public Event
108 {
109 public:
110 DECLARE_PACKET(DisjoinSessionEvent);
111 DisjoinSessionEvent() : m_sSessionId("") {}
112 DisjoinSessionEvent(const UT_UTF8String& sessionId)
113 : m_sSessionId(sessionId)
114 {
115 UT_ASSERT(m_sSessionId != "");
116 }
117
118 virtual std::string toStr() const;
119
120 const UT_UTF8String& getSessionId() const
121 { return m_sSessionId; }
122
123 private:
124 UT_UTF8String m_sSessionId;
125 };
126
127 class CloseSessionEvent : public Event
128 {
129 public:
130 DECLARE_PACKET(CloseSessionEvent);
131 CloseSessionEvent() : m_sSessionId("") {}
132 CloseSessionEvent(const UT_UTF8String& sessionId)
133 : m_sSessionId(sessionId)
134 {
135 UT_ASSERT(m_sSessionId != "");
136 }
137
138 virtual std::string toStr() const;
139
140 const UT_UTF8String& getSessionId() const
141 { return m_sSessionId; }
142
143 private:
144 UT_UTF8String m_sSessionId;
145 };
146
147 #endif /* __SESSIONEVENT_H__ */