1 /* TpProtocol
2  *
3  * Copyright © 2010 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #if defined (TP_DISABLE_SINGLE_INCLUDE) && !defined (_TP_IN_META_HEADER) && !defined (_TP_COMPILATION)
21 #error "Only <telepathy-glib/telepathy-glib.h> and <telepathy-glib/telepathy-glib-dbus.h> can be included directly."
22 #endif
23 
24 #ifndef TP_PROTOCOL_H
25 #define TP_PROTOCOL_H
26 
27 #include <glib-object.h>
28 
29 #include <telepathy-glib/capabilities.h>
30 #include <telepathy-glib/connection.h>
31 #include <telepathy-glib/defs.h>
32 #include <telepathy-glib/proxy.h>
33 
34 G_BEGIN_DECLS
35 
36 typedef struct _TpConnectionManagerParam TpConnectionManagerParam;
37 
38 struct _TpConnectionManagerParam
39 {
40   /*<private>*/
41   gchar *_TP_SEAL (name);
42   gchar *_TP_SEAL (dbus_signature);
43   GValue _TP_SEAL (default_value);
44   guint _TP_SEAL (flags);
45   gpointer _TP_SEAL (priv);
46 };
47 
48 typedef struct _TpProtocol TpProtocol;
49 typedef struct _TpProtocolClass TpProtocolClass;
50 typedef struct _TpProtocolPrivate TpProtocolPrivate;
51 typedef struct _TpProtocolClassPrivate TpProtocolClassPrivate;
52 
53 GType tp_protocol_get_type (void) G_GNUC_CONST;
54 
55 #define TP_TYPE_PROTOCOL \
56   (tp_protocol_get_type ())
57 #define TP_PROTOCOL(obj) \
58   (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_PROTOCOL, \
59                                TpProtocol))
60 #define TP_PROTOCOL_CLASS(klass) \
61   (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_PROTOCOL, \
62                             TpProtocolClass))
63 #define TP_IS_PROTOCOL(obj) \
64   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_PROTOCOL))
65 #define TP_IS_PROTOCOL_CLASS(klass) \
66   (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_PROTOCOL))
67 #define TP_PROTOCOL_GET_CLASS(obj) \
68   (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_PROTOCOL, \
69                               TpProtocolClass))
70 
71 struct _TpProtocol
72 {
73   /*<private>*/
74   TpProxy parent;
75   TpProtocolPrivate *priv;
76 };
77 
78 void tp_protocol_init_known_interfaces (void);
79 
80 TpProtocol *tp_protocol_new (TpDBusDaemon *dbus, const gchar *cm_name,
81     const gchar *protocol_name, const GHashTable *immutable_properties,
82     GError **error);
83 
84 _TP_AVAILABLE_IN_0_24
85 TpProtocol * tp_protocol_new_vardict (TpDBusDaemon *dbus,
86     const gchar *cm_name,
87     const gchar *protocol_name,
88     GVariant *immutable_properties,
89     GError **error);
90 
91 const gchar *tp_protocol_get_name (TpProtocol *self);
92 
93 _TP_AVAILABLE_IN_0_20
94 const gchar *tp_protocol_get_cm_name (TpProtocol *self);
95 
96 #define TP_PROTOCOL_FEATURE_PARAMETERS \
97   (tp_protocol_get_feature_quark_parameters ())
98 GQuark tp_protocol_get_feature_quark_parameters (void) G_GNUC_CONST;
99 
100 const TpConnectionManagerParam *tp_protocol_get_param (TpProtocol *self,
101     const gchar *param);
102 _TP_AVAILABLE_IN_0_18
103 TpConnectionManagerParam *tp_protocol_dup_param (TpProtocol *self,
104     const gchar *param);
105 gboolean tp_protocol_has_param (TpProtocol *self,
106     const gchar *param);
107 gboolean tp_protocol_can_register (TpProtocol *self);
108 GStrv tp_protocol_dup_param_names (TpProtocol *self) G_GNUC_WARN_UNUSED_RESULT;
109 _TP_AVAILABLE_IN_0_18
110 GList *tp_protocol_dup_params (TpProtocol *self) G_GNUC_WARN_UNUSED_RESULT;
111 
112 _TP_AVAILABLE_IN_0_24
113 GVariant * tp_protocol_dup_immutable_properties (TpProtocol *self);
114 
115 #ifndef TP_DISABLE_DEPRECATED
116 _TP_DEPRECATED_IN_0_20_FOR(tp_protocol_dup_params)
117 _TP_AVAILABLE_IN_0_18
118 const TpConnectionManagerParam *tp_protocol_borrow_params (TpProtocol *self)
119   G_GNUC_WARN_UNUSED_RESULT;
120 #endif
121 
122 const gchar * const *
123 /* gtk-doc sucks */
124 tp_protocol_get_authentication_types (TpProtocol *self);
125 
126 _TP_AVAILABLE_IN_0_24
127 const gchar * const *
128 /* ... */
129 tp_protocol_get_addressable_vcard_fields (TpProtocol *self);
130 
131 _TP_AVAILABLE_IN_0_24
132 const gchar * const *
133 /* ... */
134 tp_protocol_get_addressable_uri_schemes (TpProtocol *self);
135 
136 _TP_AVAILABLE_IN_0_24
137 GList *tp_protocol_dup_presence_statuses (TpProtocol *self)
138   G_GNUC_WARN_UNUSED_RESULT;
139 
140 #define TP_PROTOCOL_FEATURE_CORE \
141   (tp_protocol_get_feature_quark_core ())
142 GQuark tp_protocol_get_feature_quark_core (void) G_GNUC_CONST;
143 
144 const gchar *tp_protocol_get_vcard_field (TpProtocol *self);
145 const gchar *tp_protocol_get_english_name (TpProtocol *self);
146 const gchar *tp_protocol_get_icon_name (TpProtocol *self);
147 TpCapabilities *tp_protocol_get_capabilities (TpProtocol *self);
148 
149 _TP_AVAILABLE_IN_0_16
150 TpAvatarRequirements * tp_protocol_get_avatar_requirements (TpProtocol *self);
151 
152 _TP_AVAILABLE_IN_0_24
153 void tp_protocol_normalize_contact_async (TpProtocol *self,
154     const gchar *contact,
155     GCancellable *cancellable,
156     GAsyncReadyCallback callback,
157     gpointer user_data);
158 
159 _TP_AVAILABLE_IN_0_24
160 gchar *tp_protocol_normalize_contact_finish (TpProtocol *self,
161     GAsyncResult *result,
162     GError **error);
163 
164 _TP_AVAILABLE_IN_0_24
165 void tp_protocol_identify_account_async (TpProtocol *self,
166     GVariant *vardict,
167     GCancellable *cancellable,
168     GAsyncReadyCallback callback,
169     gpointer user_data);
170 
171 _TP_AVAILABLE_IN_0_24
172 gchar *tp_protocol_identify_account_finish (TpProtocol *self,
173     GAsyncResult *result,
174     GError **error);
175 
176 _TP_AVAILABLE_IN_0_24
177 void tp_protocol_normalize_contact_uri_async (TpProtocol *self,
178     const gchar *uri,
179     GCancellable *cancellable,
180     GAsyncReadyCallback callback,
181     gpointer user_data);
182 
183 _TP_AVAILABLE_IN_0_24
184 gchar *tp_protocol_normalize_contact_uri_finish (TpProtocol *self,
185     GAsyncResult *result,
186     GError **error);
187 
188 _TP_AVAILABLE_IN_0_24
189 void tp_protocol_normalize_vcard_address_async (TpProtocol *self,
190     const gchar *field,
191     const gchar *value,
192     GCancellable *cancellable,
193     GAsyncReadyCallback callback,
194     gpointer user_data);
195 
196 _TP_AVAILABLE_IN_0_24
197 gchar *tp_protocol_normalize_vcard_address_finish (TpProtocol *self,
198     GAsyncResult *result,
199     GError **error);
200 
201 G_END_DECLS
202 
203 #include <telepathy-glib/_gen/tp-cli-protocol.h>
204 
205 #endif
206