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_PLACE_H
22 #define _MW_SRVC_PLACE_H
23 
24 
25 #include <glib.h>
26 #include "mw_common.h"
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
34 /** Type identifier for the place service */
35 #define mwService_PLACE  0x80000022
36 
37 
38 /** @struct mwServicePlace */
39 struct mwServicePlace;
40 
41 
42 /** @struct mwPlace */
43 struct mwPlace;
44 
45 
46 struct mwPlaceHandler {
47   void (*opened)(struct mwPlace *place);
48   void (*closed)(struct mwPlace *place, guint32 code);
49 
50   void (*peerJoined)(struct mwPlace *place,
51 		     const struct mwIdBlock *peer);
52 
53   void (*peerParted)(struct mwPlace *place,
54 		     const struct mwIdBlock *peer);
55 
56   void (*peerSetAttribute)(struct mwPlace *place,
57 			   const struct mwIdBlock *peer,
58 			   guint32 attr, struct mwOpaque *o);
59 
60   void (*peerUnsetAttribute)(struct mwPlace *place,
61 			     const struct mwIdBlock *peer,
62 			     guint32 attr);
63 
64   void (*message)(struct mwPlace *place,
65 		  const struct mwIdBlock *who,
66 		  const char *msg);
67 
68   void (*clear)(struct mwServicePlace *srvc);
69 };
70 
71 
72 enum mwPlacePeerAttribute {
73   mwPlacePeer_TYPING = 0x00000008,
74 };
75 
76 
77 struct mwServicePlace *
78 mwServicePlace_new(struct mwSession *session,
79 		   struct mwPlaceHandler *handler);
80 
81 
82 struct mwPlaceHandler *
83 mwServicePlace_getHandler(struct mwServicePlace *srvc);
84 
85 
86 const GList *mwServicePlace_getPlaces(struct mwServicePlace *srvc);
87 
88 
89 struct mwPlace *mwPlace_new(struct mwServicePlace *srvc,
90 			    const char *name, const char *title);
91 
92 
93 struct mwServicePlace *mwPlace_getService(struct mwPlace *place);
94 
95 
96 const char *mwPlace_getName(struct mwPlace *place);
97 
98 
99 const char *mwPlace_getTitle(struct mwPlace *place);
100 
101 
102 int mwPlace_open(struct mwPlace *place);
103 
104 
105 int mwPlace_destroy(struct mwPlace *place, guint32 code);
106 
107 
108 /** returns a GList* of struct mwIdBlock*. The GList will need to be
109     freed after use, the mwIdBlock structures should not be modified
110     or freed */
111 GList *mwPlace_getMembers(struct mwPlace *place);
112 
113 
114 int mwPlace_sendText(struct mwPlace *place, const char *msg);
115 
116 
117 /** send a legacy invitation for this place to a user. The user will
118     receive an apparent invitation from a Conference (rather than a
119     Place) */
120 int mwPlace_legacyInvite(struct mwPlace *place,
121 			 struct mwIdBlock *idb,
122 			 const char *message);
123 
124 
125 int mwPlace_setAttribute(struct mwPlace *place, guint32 attrib,
126 			 struct mwOpaque *data);
127 
128 
129 int mwPlace_unsetAttribute(struct mwPlace *place, guint32 attrib);
130 
131 
132 void mwPlace_setClientData(struct mwPlace *place,
133 			   gpointer data, GDestroyNotify clean);
134 
135 
136 gpointer mwPlace_getClientData(struct mwPlace *place);
137 
138 
139 void mwPlace_removeClientData(struct mwPlace *place);
140 
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 
147 #endif /* _MW_SRVC_PLACE_H */
148 
149