]> git.0d.be Git - empathy.git/blob - libempathy/empathy-utils.h
Add empathy_tp_chat_get_connection() to direct access the channel's connection.
[empathy.git] / libempathy / empathy-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2003-2007 Imendio AB
4  * Copyright (C) 2007-2008 Collabora Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  * Authors: Richard Hult <richard@imendio.com>
22  *          Martyn Russell <martyn@imendio.com>
23  *          Xavier Claessens <xclaesse@gmail.com>
24  */
25
26 #ifndef __EMPATHY_UTILS_H__
27 #define __EMPATHY_UTILS_H__
28
29 #include <glib.h>
30 #include <glib-object.h>
31
32 #include <libxml/parser.h>
33 #include <libxml/tree.h>
34
35 #include <libmissioncontrol/mc-account.h>
36 #include <libmissioncontrol/mission-control.h>
37
38 #include "empathy-contact.h"
39
40 #define EMPATHY_GET_PRIV(obj,type) ((type##Priv*) ((type*)obj)->priv)
41 #define EMP_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
42
43 G_BEGIN_DECLS
44
45 void         empathy_init                           (void);
46 /* Strings */
47 gchar *      empathy_substring                      (const gchar     *str,
48                                                     gint             start,
49                                                     gint             end);
50 gint         empathy_strcasecmp                     (const gchar     *s1,
51                                                     const gchar     *s2);
52 gint         empathy_strncasecmp                    (const gchar     *s1,
53                                                     const gchar     *s2,
54                                                     gsize            n);
55
56 /* XML */
57 gboolean     empathy_xml_validate                   (xmlDoc          *doc,
58                                                     const gchar     *dtd_filename);
59 xmlNodePtr   empathy_xml_node_get_child             (xmlNodePtr       node,
60                                                     const gchar     *child_name);
61 xmlChar *    empathy_xml_node_get_child_content     (xmlNodePtr       node,
62                                                     const gchar     *child_name);
63 xmlNodePtr   empathy_xml_node_find_child_prop_value (xmlNodePtr       node,
64                                                     const gchar     *prop_name,
65                                                     const gchar     *prop_value);
66
67 /* Others */
68 guint        empathy_account_hash                   (gconstpointer    key);
69 gboolean     empathy_account_equal                  (gconstpointer    a,
70                                                     gconstpointer    b);
71 MissionControl *empathy_mission_control_dup_singleton (void);
72 const gchar * empathy_presence_get_default_message  (McPresence       presence);
73 const gchar * empathy_presence_to_str               (McPresence       presence);
74 McPresence    empathy_presence_from_str             (const gchar     *str);
75 gchar *       empathy_file_lookup                   (const gchar     *filename,
76                                                      const gchar     *subdir);
77
78 typedef gboolean (*EmpathyRunUntilReadyFunc)        (GObject         *object,
79                                                      gpointer         user_data);
80 void          empathy_run_until_ready               (gpointer         object);
81 void          empathy_run_until_ready_full          (gpointer         object,
82                                                      const gchar     *signal,
83                                                      EmpathyRunUntilReadyFunc  func,
84                                                      gpointer         user_data,
85                                                      GMainLoop      **loop);
86 McAccount *  empathy_channel_get_account            (TpChannel       *channel);
87 gboolean     empathy_proxy_equal                    (gconstpointer    a,
88                                                      gconstpointer    b);
89 guint        empathy_proxy_hash                     (gconstpointer    key);
90 gboolean     empathy_check_available_state          (void);
91
92 G_END_DECLS
93
94 #endif /*  __EMPATHY_UTILS_H__ */