File: mw_srvc_conf.h

package info (click to toggle)
meanwhile 1.0.2-9
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 2,808 kB
  • ctags: 3,721
  • sloc: ansic: 13,873; sh: 8,360; makefile: 153
file content (209 lines) | stat: -rw-r--r-- 6,625 bytes parent folder | download | duplicates (3)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

/*
  Meanwhile - Unofficial Lotus Sametime Community Client Library
  Copyright (C) 2004  Christopher (siege) O'Brien
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.
  
  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _MW_SRVC_CONF_H
#define _MW_SRVC_CONF_H


#include <glib.h>
#include "mw_common.h"


#ifdef __cplusplus
extern "C" {
#endif


/** Type identifier for the conference service */
#define mwService_CONFERENCE  0x80000010


enum mwConferenceState {
  mwConference_NEW,      /**< new outgoing conference */
  mwConference_PENDING,  /**< outgoing conference pending creation */
  mwConference_INVITED,  /**< invited to incoming conference */
  mwConference_OPEN,     /**< conference open and active */
  mwConference_CLOSING,  /**< conference is closing */
  mwConference_ERROR,    /**< conference is closing due to error */
  mwConference_UNKNOWN,  /**< unable to determine conference state */
};


/** @struct mwServiceConference
    Instance of the multi-user conference service */
struct mwServiceConference;


/** @struct mwConference
    A multi-user chat */
struct mwConference;


/** Handler structure used to provide callbacks for an instance of the
    conferencing service */
struct mwConferenceHandler {

  /** triggered when we receive a conference invitation. Call
      mwConference_accept to accept the invitation and join the
      conference, or mwConference_close to reject the invitation.

      @param conf     the newly created conference
      @param inviter  the indentity of the user who sent the invitation
      @param invite   the invitation text
   */
  void (*on_invited)(struct mwConference *conf,
		     struct mwLoginInfo *inviter, const char *invite);

  /** triggered when we enter the conference. Provides the initial
      conference membership list as a GList of mwLoginInfo structures

      @param conf     the conference just joined
      @param members  mwLoginInfo list of existing conference members
  */
  void (*conf_opened)(struct mwConference *conf, GList *members);

  /** triggered when a conference is closed. This is typically when
      we've left it */
  void (*conf_closed)(struct mwConference *, guint32 reason);

  /** triggered when someone joins the conference */
  void (*on_peer_joined)(struct mwConference *, struct mwLoginInfo *);

  /** triggered when someone leaves the conference */
  void (*on_peer_parted)(struct mwConference *, struct mwLoginInfo *);

  /** triggered when someone says something */
  void (*on_text)(struct mwConference *conf,
		  struct mwLoginInfo *who, const char *what);

  /** typing notification */
  void (*on_typing)(struct mwConference *conf,
		    struct mwLoginInfo *who, gboolean typing);

  /** optional. called from mwService_free */
  void (*clear)(struct mwServiceConference *srvc);
};


/** Allocate a new conferencing service, attaching the given handler
    @param sess     owning session
    @param handler  handler providing call-back functions for the service
 */
struct mwServiceConference *
mwServiceConference_new(struct mwSession *sess,
			struct mwConferenceHandler *handler);


/** @returns the conference handler for the service */
struct mwConferenceHandler *
mwServiceConference_getHandler(struct mwServiceConference *srvc);


/** a mwConference list of the conferences in this service. The GList
    will need to be destroyed with g_list_free after use */
GList *mwServiceConference_getConferences(struct mwServiceConference *srvc);


/** Allocate a new conference, in state NEW with the given title.
    @see mwConference_create */
struct mwConference *mwConference_new(struct mwServiceConference *srvc,
				      const char *title);


/** @returns the owning service of a conference */
struct mwServiceConference *mwConference_getService(struct mwConference *conf);


/** @returns unique conference name */
const char *mwConference_getName(struct mwConference *conf);


/** @returns conference title */
const char *mwConference_getTitle(struct mwConference *conf);


/** a mwIdBlock list of the members of the conference. The GList will
    need to be free'd after use */
GList *mwConference_getMembers(struct mwConference *conf);


/** Initiate a conference. Conference must be in state NEW. If no name
    or title for the conference has been set, they will be
    generated. Conference will be placed into state PENDING. */
int mwConference_open(struct mwConference *conf);


/** Leave and close an existing conference, or reject an invitation.
    Triggers mwServiceConfHandler::conf_closed and free's the
    conference.
 */
int mwConference_destroy(struct mwConference *conf,
			 guint32 reason, const char *text);


#define mwConference_reject(c,r,t) \
  mwConference_destroy((c),(r),(t))


/** accept a conference invitation. Conference must be in the state
    INVITED. */
int mwConference_accept(struct mwConference *conf);


/** invite another user to an ACTIVE conference
    @param conf  conference
    @param who   user to invite
    @param text  invitation message
 */
int mwConference_invite(struct mwConference *conf,
			struct mwIdBlock *who, const char *text);


/** send a text message over an open conference */
int mwConference_sendText(struct mwConference *conf, const char *text);


/** send typing notification over an open conference */
int mwConference_sendTyping(struct mwConference *conf, gboolean typing);


/** associate arbitrary client data and an optional cleanup function
    with a conference. If there is already client data with a clear
    function, it will not be called. */
void mwConference_setClientData(struct mwConference *conf,
				gpointer data, GDestroyNotify clear);


/** reference associated client data */
gpointer mwConference_getClientData(struct mwConference *conf);


/** remove associated client data if any, and call the cleanup
    function on the data as necessary */
void mwConference_removeClientData(struct mwConference *conf);


#ifdef __cplusplus
}
#endif
				    

#endif /* _MW_SRVC_CONF_H */