i18n: update bug tracker URL in script
[siplcs.git] / src / telepathy / telepathy-main.c
blob4d93cef72d111d2819d6929f6cca27055dbd8c50
1 /**
2 * @file telepathy-main.c
4 * pidgin-sipe
6 * Copyright (C) 2012 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
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include <glib-object.h>
28 #include <telepathy-glib/base-connection-manager.h>
29 #include <telepathy-glib/run.h>
30 #include <telepathy-glib/telepathy-glib.h>
32 #include "sipe-backend.h"
33 #include "sipe-common.h"
34 #include "sipe-core.h"
36 #include "telepathy-private.h"
38 G_BEGIN_DECLS
40 * Connection manager class - data structures
42 typedef struct _SipeConnectionManagerClass {
43 TpBaseConnectionManagerClass parent_class;
44 } SipeConnectionManagerClass;
46 typedef struct _SipeConnectionManager {
47 TpBaseConnectionManager parent;
48 } SipeConnectionManager;
51 * Connection manager class - type macros
53 static GType sipe_connection_manager_get_type(void) G_GNUC_CONST;
54 #define SIPE_TYPE_CONNECTION_MANAGER \
55 (sipe_connection_manager_get_type())
56 #define SIPE_CONNECTION_MANAGER(obj) \
57 (G_TYPE_CHECK_INSTANCE_CAST((obj), SIPE_TYPE_CONNECTION_MANAGER, \
58 SipeConnectionManager))
59 G_END_DECLS
62 * Connection manager class - type definition
64 G_DEFINE_TYPE(SipeConnectionManager,
65 sipe_connection_manager,
66 TP_TYPE_BASE_CONNECTION_MANAGER)
69 * Connection manager class - instance methods
71 static void sipe_connection_manager_constructed(GObject *object)
73 SipeConnectionManager *self = SIPE_CONNECTION_MANAGER(object);
74 TpBaseConnectionManager *base = (TpBaseConnectionManager *) self;
76 SIPE_DEBUG_INFO_NOFORMAT("SipeConnectionManager::constructed");
78 /* always chain up to the parent constructor first */
79 G_OBJECT_CLASS(sipe_connection_manager_parent_class)->constructed(object);
81 sipe_telepathy_protocol_init(base);
85 * Connection manager class - type implementation
87 static void sipe_connection_manager_class_init(SipeConnectionManagerClass *klass)
89 GObjectClass *object_class = G_OBJECT_CLASS(klass);
90 TpBaseConnectionManagerClass *base_class = (TpBaseConnectionManagerClass *)klass;
92 SIPE_DEBUG_INFO_NOFORMAT("SipeConnectionManager::class_init");
94 object_class->constructed = sipe_connection_manager_constructed;
96 base_class->new_connection = NULL;
97 base_class->cm_dbus_name = SIPE_TELEPATHY_DOMAIN;
98 base_class->protocol_params = NULL;
101 static void sipe_connection_manager_init(SIPE_UNUSED_PARAMETER SipeConnectionManager *self)
103 SIPE_DEBUG_INFO_NOFORMAT("SipeConnectionManager::init");
108 * Entry point
110 static TpBaseConnectionManager *construct_cm(void)
112 return((TpBaseConnectionManager *)
113 g_object_new(SIPE_TYPE_CONNECTION_MANAGER, NULL));
116 int main(int argc, char *argv[])
118 int rc;
120 g_type_init();
121 sipe_telepathy_debug_init();
122 sipe_core_init(LOCALEDIR);
124 SIPE_DEBUG_INFO("main: initializing - version %s", PACKAGE_VERSION);
126 rc = tp_run_connection_manager(SIPE_TELEPATHY_DOMAIN,
127 PACKAGE_VERSION,
128 construct_cm,
129 argc,
130 argv);
132 sipe_core_destroy();
133 sipe_telepathy_debug_finalize();
134 return(rc);
137 gchar *sipe_backend_version(void)
140 * @TODO: this is the version of telepathy-glib we have compiled this
141 * code against, not the version of "telepathy" which is
142 * currently running. How to get this? Is it even possible?
144 * requires telepathy-glib >= 0.19
145 return(g_strdup_printf("telepathy-glib/%d.%d.%d",
146 TP_MAJOR_VERSION, TP_MINOR_VERSION, TP_MICRO_VERSION));
148 return(g_strdup("Telepathy"));
152 Local Variables:
153 mode: c
154 c-file-style: "bsd"
155 indent-tabs-mode: t
156 tab-width: 8
157 End: