libtelepathy/inc/tp-chan.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /* tp-chan.h
       
     2  *
       
     3  * 
       
     4  * Copyright (C) 2005 Collabora Ltd.
       
     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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef TP_CHAN_H
       
    22 #define TP_CHAN_H
       
    23 
       
    24 #ifndef DBUS_API_SUBJECT_TO_CHANGE
       
    25 #define DBUS_API_SUBJECT_TO_CHANGE
       
    26 #endif
       
    27 
       
    28 
       
    29 #include "tp-chan-gen.h"
       
    30 #include "tp-interfaces.h"
       
    31 #include "tp-chan-signals-marshal.h"
       
    32 #include "tp-ifaces-signals-marshal.h"
       
    33 #include "tp-chan-ifaces-signal-setters.h"
       
    34 
       
    35 #include <dbus/dbus-glib.h>
       
    36 #include <dbus/dbus.h>
       
    37 
       
    38 
       
    39 #define TELEPATHY_CHAN_TYPE       (tp_chan_get_type ())
       
    40 
       
    41 #define TELEPATHY_CHAN(obj)       (G_TYPE_CHECK_INSTANCE_CAST \
       
    42 		                      ((obj), TELEPATHY_CHAN_TYPE, \
       
    43 				       TpChan))
       
    44 
       
    45 #define TELEPATHY_CHAN_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST \
       
    46 		                              ((klass), TELEPATHY_CHAN_TYPE, \
       
    47 					       TpChanClass))
       
    48 
       
    49 #define TELEPATHY_IS_CHAN(obj)    (G_TYPE_CHECK_INSTANCE_TYPE \
       
    50 		                      ((obj), TELEPATHY_CHAN_TYPE))
       
    51 
       
    52 #define TELEPATHY_IS_CHAN_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE \
       
    53 		                               ((klass), TELEPATHY_CHAN_TYPE))
       
    54 
       
    55 #define TELEPATHY_CHAN_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS \
       
    56 		                              ((obj), TELEPATHY_CHAN_TYPE, \
       
    57 						TpChanClass))
       
    58 
       
    59 #define TELEPATHY_CHAN_IFACE_QUARK (tp_get_chan_interface())
       
    60 #define TELEPATHY_CHAN_IFACE_CONTACTLIST_QUARK (tp_get_chan_contactlist_interface())
       
    61 #define TELEPATHY_CHAN_IFACE_CONTACTSEARCH_QUARK (tp_get_chan_contactsearch_interface())
       
    62 #define TELEPATHY_CHAN_IFACE_STREAMED_QUARK (tp_get_chan_streamed_interface())
       
    63 #define TELEPATHY_CHAN_IFACE_ROOMLIST_QUARK (tp_get_chan_roomlist_interface())
       
    64 #define TELEPATHY_CHAN_IFACE_TEXT_QUARK (tp_get_chan_text_interface())
       
    65 #define TELEPATHY_CHAN_IFACE_DTMF_QUARK (tp_get_chan_dtmf_interface())
       
    66 #define TELEPATHY_CHAN_IFACE_GROUP_QUARK (tp_get_chan_group_interface())
       
    67 #define TELEPATHY_CHAN_IFACE_HOLD_QUARK (tp_get_chan_hold_interface())
       
    68 #define TELEPATHY_CHAN_IFACE_PASSWORD_QUARK (tp_get_chan_password_interface())
       
    69 #define TELEPATHY_CHAN_IFACE_TRANSFER_QUARK (tp_get_chan_transfer_interface())
       
    70 
       
    71 /* The signal name for the synthesized Closed signal */
       
    72 #define TP_IFACE_CHAN_SIGNAL_CLOSED_SYNTHESIZED \
       
    73         "received::org-freedesktop-Telepathy-Channel-Closed"
       
    74 
       
    75 typedef struct _tp_chan TpChan;
       
    76 typedef struct _tp_chanclass TpChanClass;
       
    77 
       
    78 struct _tp_chan
       
    79 {
       
    80   DBusGProxy parent;
       
    81   gchar *type;
       
    82   guint handle_type;
       
    83   guint handle;
       
    84   GData *interface_list;
       
    85   gboolean first_run;
       
    86 };
       
    87 
       
    88 struct _tp_chanclass
       
    89 {
       
    90   DBusGProxyClass parent_class;
       
    91   GData *iface_signal_sigs;
       
    92 };
       
    93 
       
    94 GType tp_chan_get_type(void);
       
    95 
       
    96 /* Actual function definitions */
       
    97 
       
    98 
       
    99 /*
       
   100  * Creates a new channel object.
       
   101  *
       
   102  * @param connection: The D-BUS connection for this channel.
       
   103  * @param bus_name: The D-BUS bus name for this channel.
       
   104  * @param object_name: The name of the D-BUS path for this channel.
       
   105  * @param type: The type string for this channel.
       
   106  * @param handle_type: The type of this channel.
       
   107  * @param handle: The handle of this channel, will be filled by this call.
       
   108  * @return A new TpChan (channel) object, or NULL if unsuccesfull
       
   109  */
       
   110 #ifdef __cplusplus
       
   111 extern "C"
       
   112 {
       
   113 #endif
       
   114 #ifdef SYMBIAN
       
   115 IMPORT_C 
       
   116 #endif
       
   117 TpChan *tp_chan_new(DBusGConnection *connection, const gchar *bus_name,
       
   118 		    const gchar *object_path, const gchar *type,
       
   119                     guint handle_type, guint handle);
       
   120 #ifdef __cplusplus
       
   121 }
       
   122 #endif
       
   123 
       
   124 
       
   125 /* Create and store the D-BUS proxy objects for the interfaces provided
       
   126  * by this channel. Expects data provided by the GetInterfaces method.
       
   127  * 
       
   128  * @param self: The channel object whose interfaces will be stored.
       
   129  * @param interfaces: The array of strings containing the interface names
       
   130  *
       
   131  */
       
   132 
       
   133 
       
   134 void tp_chan_local_set_interfaces(TpChan *self, gchar **interfaces);
       
   135 
       
   136 
       
   137 /*
       
   138  * This function checks whether the channel has the specified
       
   139  * interface and returns a proxy object that can be used to call
       
   140  * its methods, if it exists. The supported interfaces are listed
       
   141  * in the beginning of this header as macros.
       
   142  *
       
   143  * @param self The channel object that is queried for the interface
       
   144  *             proxy object
       
   145  * @param iface_quark GQuark corresponding to the interface name
       
   146  *        string.
       
   147  * @return A DBusGProxy object for the interface, or NULL if not found
       
   148  */
       
   149 #ifdef __cplusplus
       
   150 extern "C"
       
   151 {
       
   152 #endif
       
   153 #ifdef SYMBIAN
       
   154 IMPORT_C 
       
   155 #endif 
       
   156 DBusGProxy *tp_chan_get_interface(TpChan *self, GQuark iface_quark);
       
   157 
       
   158 #ifdef __cplusplus
       
   159 }
       
   160 #endif
       
   161 
       
   162 
       
   163 GQuark tp_get_chan_interface(void);
       
   164 GQuark tp_get_chan_contactlist_interface(void);
       
   165 
       
   166 #ifdef __cplusplus
       
   167 extern "C"
       
   168 {
       
   169 #endif
       
   170 #ifdef SYMBIAN
       
   171 IMPORT_C 
       
   172 #endif 
       
   173 GQuark tp_get_chan_contactsearch_interface(void);
       
   174 #ifdef __cplusplus
       
   175 }
       
   176 #endif
       
   177 GQuark tp_get_chan_streamed_interface(void);
       
   178 GQuark tp_get_chan_roomlist_interface(void);
       
   179 
       
   180 #ifdef __cplusplus
       
   181 extern "C"
       
   182 {
       
   183 #endif
       
   184 #ifdef SYMBIAN
       
   185 IMPORT_C 
       
   186 #endif 
       
   187 GQuark tp_get_chan_group_interface(void);
       
   188 #ifdef __cplusplus
       
   189 }
       
   190 #endif
       
   191 
       
   192 
       
   193 #ifdef __cplusplus
       
   194 extern "C"
       
   195 {
       
   196 #endif
       
   197 #ifdef SYMBIAN
       
   198 IMPORT_C 
       
   199 #endif 
       
   200 GQuark tp_get_chan_text_interface(void);
       
   201 GQuark tp_get_chan_dtmf_interface(void);
       
   202 GQuark tp_get_chan_hold_interface(void);
       
   203 GQuark tp_get_chan_password_interface(void);
       
   204 GQuark tp_get_chan_transfer_interface(void);
       
   205 #ifdef __cplusplus
       
   206 }
       
   207 #endif
       
   208 #endif
       
   209