10969
|
1
|
|
2 /*
|
|
3 Meanwhile - Unofficial Lotus Sametime Community Client Library
|
|
4 Copyright (C) 2004 Christopher (siege) O'Brien
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Library General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Library General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Library General Public
|
|
17 License along with this library; if not, write to the Free
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21 #ifndef _MW_SRVC_CONF_H
|
|
22 #define _MW_SRVC_CONF_H
|
|
23
|
|
24
|
|
25 #include <glib/glist.h>
|
|
26 #include "mw_common.h"
|
|
27
|
|
28
|
|
29 /** Type identifier for the conference service */
|
|
30 #define SERVICE_CONFERENCE 0x80000010
|
|
31
|
|
32
|
|
33 enum mwConferenceState {
|
|
34 mwConference_NEW, /**< new outgoing conference */
|
|
35 mwConference_PENDING, /**< outgoing conference pending creation */
|
|
36 mwConference_INVITED, /**< invited to incoming conference */
|
|
37 mwConference_OPEN, /**< conference open and active */
|
|
38 mwConference_CLOSING, /**< conference is closing */
|
|
39 mwConference_ERROR, /**< conference is closing due to error */
|
|
40 mwConference_UNKNOWN, /**< unable to determine conference state */
|
|
41 };
|
|
42
|
|
43
|
|
44 /** @struct mwServiceConference
|
|
45 Instance of the multi-user conference service */
|
|
46 struct mwServiceConference;
|
|
47
|
|
48
|
|
49 /** @struct mwConference
|
|
50 A multi-user chat */
|
|
51 struct mwConference;
|
|
52
|
|
53
|
|
54 /** Handler structure used to provide callbacks for an instance of the
|
|
55 conferencing service */
|
|
56 struct mwConferenceHandler {
|
|
57
|
|
58 /** triggered when we receive a conference invitation. Call
|
|
59 mwConference_accept to accept the invitation and join the
|
|
60 conference, or mwConference_close to reject the invitation.
|
|
61
|
|
62 @param conf the newly created conference
|
|
63 @param inviter the indentity of the user who sent the invitation
|
|
64 @param invite the invitation text
|
|
65 */
|
|
66 void (*on_invited)(struct mwConference *conf,
|
|
67 struct mwLoginInfo *inviter, const char *invite);
|
|
68
|
|
69 /** triggered when we enter the conference. Provides the initial
|
|
70 conference membership list as a GList of mwLoginInfo structures
|
|
71
|
|
72 @param conf the conference just joined
|
|
73 @param members mwLoginInfo list of existing conference members
|
|
74 */
|
|
75 void (*conf_opened)(struct mwConference *conf, GList *members);
|
|
76
|
|
77 /** triggered when a conference is closed. This is typically when
|
|
78 we've left it */
|
|
79 void (*conf_closed)(struct mwConference *, guint32 reason);
|
|
80
|
|
81 /** triggered when someone joins the conference */
|
|
82 void (*on_peer_joined)(struct mwConference *, struct mwLoginInfo *);
|
|
83
|
|
84 /** triggered when someone leaves the conference */
|
|
85 void (*on_peer_parted)(struct mwConference *, struct mwLoginInfo *);
|
|
86
|
|
87 /** triggered when someone says something */
|
|
88 void (*on_text)(struct mwConference *conf,
|
|
89 struct mwLoginInfo *who, const char *what);
|
|
90
|
|
91 /** typing notification */
|
|
92 void (*on_typing)(struct mwConference *conf,
|
|
93 struct mwLoginInfo *who, gboolean typing);
|
|
94
|
|
95 /** optional. called from mwService_free */
|
|
96 void (*clear)(struct mwServiceConference *srvc);
|
|
97 };
|
|
98
|
|
99
|
|
100 /** Allocate a new conferencing service, attaching the given handler
|
|
101 @param sess owning session
|
|
102 @param handler handler providing call-back functions for the service
|
|
103 */
|
|
104 struct mwServiceConference *
|
|
105 mwServiceConference_new(struct mwSession *sess,
|
|
106 struct mwConferenceHandler *handler);
|
|
107
|
|
108
|
|
109 /** @returns the conference handler for the service */
|
|
110 struct mwConferenceHandler *
|
|
111 mwServiceConference_getHandler(struct mwServiceConference *srvc);
|
|
112
|
|
113
|
|
114 /** a mwConference list of the conferences in this service. The GList
|
|
115 will need to be destroyed with g_list_free after use */
|
|
116 GList *mwServiceConference_getConferences(struct mwServiceConference *srvc);
|
|
117
|
|
118
|
|
119 /** Allocate a new conference, in state NEW with the given title.
|
|
120 @see mwConference_create */
|
|
121 struct mwConference *mwConference_new(struct mwServiceConference *srvc,
|
|
122 const char *title);
|
|
123
|
|
124
|
|
125 /** @returns the owning service of a conference */
|
|
126 struct mwServiceConference *mwConference_getService(struct mwConference *conf);
|
|
127
|
|
128
|
|
129 /** @returns unique conference name */
|
|
130 const char *mwConference_getName(struct mwConference *conf);
|
|
131
|
|
132
|
|
133 /** @returns conference title */
|
|
134 const char *mwConference_getTitle(struct mwConference *conf);
|
|
135
|
|
136
|
|
137 /** a mwIdBlock list of the members of the conference. The GList will
|
|
138 need to be free'd after use */
|
|
139 GList *mwConference_getMembers(struct mwConference *conf);
|
|
140
|
|
141
|
|
142 /** Initiate a conference. Conference must be in state NEW. If no name
|
|
143 or title for the conference has been set, they will be
|
|
144 generated. Conference will be placed into state PENDING. */
|
|
145 int mwConference_open(struct mwConference *conf);
|
|
146
|
|
147
|
|
148 /** Leave and close an existing conference, or reject an invitation.
|
|
149 Triggers mwServiceConfHandler::conf_closed and free's the
|
|
150 conference.
|
|
151 */
|
|
152 int mwConference_destroy(struct mwConference *conf,
|
|
153 guint32 reason, const char *text);
|
|
154
|
|
155
|
|
156 #define mwConference_reject(c,r,t) \
|
|
157 mwConference_destroy((c),(r),(t))
|
|
158
|
|
159
|
|
160 /** accept a conference invitation. Conference must be in the state
|
|
161 INVITED. */
|
|
162 int mwConference_accept(struct mwConference *conf);
|
|
163
|
|
164
|
|
165 /** invite another user to an ACTIVE conference
|
|
166 @param who user to invite
|
|
167 @param text invitation message
|
|
168 */
|
|
169 int mwConference_invite(struct mwConference *conf,
|
|
170 struct mwIdBlock *who, const char *text);
|
|
171
|
|
172
|
|
173 /** send a text message over an open conference */
|
|
174 int mwConference_sendText(struct mwConference *conf, const char *text);
|
|
175
|
|
176
|
|
177 /** send typing notification over an open conference */
|
|
178 int mwConference_sendTyping(struct mwConference *conf, gboolean typing);
|
|
179
|
|
180
|
|
181 /** associate arbitrary client data and an optional cleanup function
|
|
182 with a conference. If there is already client data with a clear
|
|
183 function, it will not be called. */
|
|
184 void mwConference_setClientData(struct mwConference *conf,
|
|
185 gpointer data, GDestroyNotify clear);
|
|
186
|
|
187
|
|
188 /** reference associated client data */
|
|
189 gpointer mwConference_getClientData(struct mwConference *conf);
|
|
190
|
|
191
|
|
192 /** remove associated client data if any, and call the cleanup
|
|
193 function on the data as necessary */
|
|
194 void mwConference_removeClientData(struct mwConference *conf);
|
|
195
|
|
196
|
|
197 #endif
|
|
198
|