4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef DBUS_API_SUBJECT_TO_CHANGE
24 #define DBUS_API_SUBJECT_TO_CHANGE
27 #include <dbus/dbus-glib.h>
31 #include "dbus-purple.h"
32 #include "purple-client.h"
34 static DBusGConnection
*bus
;
35 static DBusGProxy
*purple_proxy
;
37 static GList
*garray_int_to_glist(GArray
*array
)
42 for (i
= 0; i
< array
->len
; i
++)
43 list
= g_list_append(list
, GINT_TO_POINTER(g_array_index(array
,gint
,i
)));
45 g_array_free(array
, TRUE
);
49 static GSList
*garray_int_to_gslist(GArray
*array
)
54 for (i
= 0; i
< array
->len
; i
++)
55 list
= g_slist_append(list
, GINT_TO_POINTER(g_array_index(array
,gint
,i
)));
57 g_array_free(array
, TRUE
);
61 #include "purple-client-bindings.ch"
63 static void lose(const char *fmt
, ...) G_GNUC_NORETURN
G_GNUC_PRINTF (1, 2);
64 static void lose_gerror(const char *prefix
, GError
*error
) G_GNUC_NORETURN
;
67 lose(const char *str
, ...)
73 vfprintf(stderr
, str
, args
);
82 lose_gerror(const char *prefix
, GError
*error
)
84 lose("%s: %s", prefix
, error
->message
);
87 void purple_init(void)
91 bus
= dbus_g_bus_get (DBUS_BUS_SESSION
, &error
);
93 lose_gerror ("Couldn't connect to session bus", error
);
95 purple_proxy
= dbus_g_proxy_new_for_name (bus
,
98 PURPLE_DBUS_INTERFACE
);
101 lose_gerror ("Couldn't connect to the Purple Service", error
);