]> git.0d.be Git - empathy.git/blob - libempathy/empathy-utils.h
Fix disconnection of AccountStatusChanged signal.
[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 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 G_BEGIN_DECLS
41
42 #define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
43
44 typedef enum {
45         EMPATHY_REGEX_AS_IS,
46         EMPATHY_REGEX_BROWSER,
47         EMPATHY_REGEX_EMAIL,
48         EMPATHY_REGEX_OTHER,
49         EMPATHY_REGEX_ALL,
50 } EmpathyRegExType;
51
52 /* Regular expressions */
53 gchar *      empathy_substring                      (const gchar     *str,
54                                                     gint             start,
55                                                     gint             end);
56 gint         empathy_regex_match                    (EmpathyRegExType  type,
57                                                     const gchar     *msg,
58                                                     GArray          *start,
59                                                     GArray          *end);
60
61 /* Strings */
62 gint         empathy_strcasecmp                     (const gchar     *s1,
63                                                     const gchar     *s2);
64 gint         empathy_strncasecmp                    (const gchar     *s1,
65                                                     const gchar     *s2,
66                                                     gsize            n);
67
68 /* XML */
69 gboolean     empathy_xml_validate                   (xmlDoc          *doc,
70                                                     const gchar     *dtd_filename);
71 xmlNodePtr   empathy_xml_node_get_child             (xmlNodePtr       node,
72                                                     const gchar     *child_name);
73 xmlChar *    empathy_xml_node_get_child_content     (xmlNodePtr       node,
74                                                     const gchar     *child_name);
75 xmlNodePtr   empathy_xml_node_find_child_prop_value (xmlNodePtr       node,
76                                                     const gchar     *prop_name,
77                                                     const gchar     *prop_value);
78
79 /* Others */
80 guint        empathy_account_hash                   (gconstpointer    key);
81 gboolean     empathy_account_equal                  (gconstpointer    a,
82                                                     gconstpointer    b);
83 MissionControl *empathy_mission_control_new         (void);
84 void         empathy_call_with_contact              (EmpathyContact  *contact);
85 void         empathy_call_with_contact_id           (McAccount       *account,
86                                                      const gchar     *contact_id);
87 void         empathy_chat_with_contact              (EmpathyContact  *contact);
88 void         empathy_chat_with_contact_id           (McAccount       *account,
89                                                      const gchar     *contact_id);
90 const gchar * empathy_presence_get_default_message  (McPresence       presence);
91 const gchar * empathy_presence_to_str               (McPresence       presence);
92 McPresence    empathy_presence_from_str             (const gchar     *str);
93 gchar *       empathy_file_lookup                   (const gchar     *filename,
94                                                      const gchar     *subdir);
95
96 typedef gboolean (*EmpathyRunUntilReadyFunc)        (GObject         *object,
97                                                      gpointer         user_data);
98 void          empathy_run_until_ready               (gpointer         object);
99 void          empathy_run_until_ready_full          (gpointer         object,
100                                                      const gchar     *signal,
101                                                      EmpathyRunUntilReadyFunc  func,
102                                                      gpointer         user_data,
103                                                      GMainLoop      **loop);
104 McAccount *  empathy_channel_get_account            (TpChannel       *channel);
105 gpointer      empathy_connect_to_account_status_changed (MissionControl *mc,
106                                                          GCallback       handler,
107                                                          gpointer        user_data,
108                                                          GClosureNotify  free_func);
109 void          empathy_disconnect_account_status_changed (gpointer        token);
110
111 G_END_DECLS
112
113 #endif /*  __EMPATHY_UTILS_H__ */