2 * @file telepathy-tls.c
6 * Copyright (C) 2013 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * TLS certificate accept/reject user interaction
25 #include <glib-object.h>
26 #include <telepathy-glib/svc-channel.h>
27 #include <telepathy-glib/telepathy-glib.h>
29 #include "sipe-backend.h"
30 #include "sipe-common.h"
32 #include "telepathy-private.h"
36 * TLS Manager class - data structures
38 typedef struct _SipeTLSManagerClass
{
39 GObjectClass parent_class
;
40 } SipeTLSManagerClass
;
42 typedef struct _SipeTLSManager
{
49 * TLS Manager class - type macros
51 static GType
sipe_tls_manager_get_type(void);
52 #define SIPE_TYPE_TLS_MANAGER \
53 (sipe_tls_manager_get_type())
54 #define SIPE_TLS_MANAGER(obj) \
55 (G_TYPE_CHECK_INSTANCE_CAST((obj), SIPE_TYPE_TLS_MANAGER, \
61 * TLS Manager class - type definition
63 static void channel_manager_iface_init(gpointer
, gpointer
);
64 G_DEFINE_TYPE_WITH_CODE(SipeTLSManager
,
67 G_IMPLEMENT_INTERFACE(TP_TYPE_CHANNEL_MANAGER
,
68 channel_manager_iface_init
);
72 * TLS Manager class - instance methods
74 static void sipe_tls_manager_constructed(GObject
*object
)
76 SipeTLSManager
*self
= SIPE_TLS_MANAGER(object
);
77 void (*chain_up
)(GObject
*) = G_OBJECT_CLASS(sipe_tls_manager_parent_class
)->constructed
;
86 static void sipe_tls_manager_dispose(GObject
*object
)
88 SipeTLSManager
*self
= SIPE_TLS_MANAGER(object
);
89 void (*chain_up
)(GObject
*) = G_OBJECT_CLASS(sipe_tls_manager_parent_class
)->constructed
;
91 tp_clear_object(&self
->connection
);
98 * TLS Manager class - type implementation
100 static void sipe_tls_manager_class_init(SipeTLSManagerClass
*klass
)
102 GObjectClass
*object_class
= G_OBJECT_CLASS(klass
);
104 SIPE_DEBUG_INFO_NOFORMAT("SipeTLSManager::class_init");
106 object_class
->constructed
= sipe_tls_manager_constructed
;
107 object_class
->dispose
= sipe_tls_manager_dispose
;
110 static void sipe_tls_manager_init(SIPE_UNUSED_PARAMETER SipeTLSManager
*self
)
112 SIPE_DEBUG_INFO_NOFORMAT("SipeTLSManager::init");
116 * TLS Manager class - interface implementation
120 static void foreach_channel(TpChannelManager
*manager
,
121 TpExportableChannelFunc func
,
124 SipeTLSManager
*self
= SIPE_TLS_MANAGER(manager
);
126 SIPE_DEBUG_INFO_NOFORMAT("SipeTLSManager::foreach_channel");
134 static void channel_manager_iface_init(gpointer g_iface
,
135 SIPE_UNUSED_PARAMETER gpointer iface_data
)
137 TpChannelManagerIface
*iface
= g_iface
;
139 #define IMPLEMENT(x, y) iface->x = y
140 IMPLEMENT(foreach_channel
, foreach_channel
);
141 /* These channels are not requestable. */
142 IMPLEMENT(type_foreach_channel_class
, NULL
);
143 IMPLEMENT(create_channel
, NULL
);
144 IMPLEMENT(request_channel
, NULL
);
145 IMPLEMENT(ensure_channel
, NULL
);
149 /* create new TLS manager object */
150 GObject
*sipe_telepathy_tls_new(TpBaseConnection
*connection
)
152 SipeTLSManager
*self
= g_object_new(SIPE_TYPE_TLS_MANAGER
, NULL
);
153 self
->connection
= g_object_ref(connection
);
154 return(G_OBJECT(self
));