]> git.0d.be Git - empathy.git/blob - libempathy/gossip-utils.h
[darcs-to-svn @ initial import]
[empathy.git] / libempathy / gossip-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2002-2005 Imendio AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GOSSIP_UTILS_H__
22 #define __GOSSIP_UTILS_H__
23
24 #include <glib.h>
25 #include <glib-object.h>
26
27 #include <libxml/parser.h>
28 #include <libxml/tree.h>
29
30 #include "gossip-contact.h"
31
32 G_BEGIN_DECLS
33
34 #define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
35
36 typedef enum {
37         GOSSIP_REGEX_AS_IS,
38         GOSSIP_REGEX_BROWSER,
39         GOSSIP_REGEX_EMAIL,
40         GOSSIP_REGEX_OTHER,
41         GOSSIP_REGEX_ALL,
42 } GossipRegExType;
43
44 /* Regular expressions */
45 gchar *      gossip_substring                      (const gchar     *str,
46                                                     gint             start,
47                                                     gint             end);
48 gint         gossip_regex_match                    (GossipRegExType  type,
49                                                     const gchar     *msg,
50                                                     GArray          *start,
51                                                     GArray          *end);
52
53 /* Strings */
54 gint         gossip_strcasecmp                     (const gchar     *s1,
55                                                     const gchar     *s2);
56 gint         gossip_strncasecmp                    (const gchar     *s1,
57                                                     const gchar     *s2,
58                                                     gsize            n);
59
60 /* XML */
61 gboolean     gossip_xml_validate                   (xmlDoc          *doc,
62                                                     const gchar     *dtd_filename);
63 xmlNodePtr   gossip_xml_node_get_child             (xmlNodePtr       node,
64                                                     const gchar     *child_name);
65 xmlChar *    gossip_xml_node_get_child_content     (xmlNodePtr       node,
66                                                     const gchar     *child_name);
67 xmlNodePtr   gossip_xml_node_find_child_prop_value (xmlNodePtr       node,
68                                                     const gchar     *prop_name,
69                                                     const gchar     *prop_value);
70
71
72 /* GValue/GType */
73 GType        gossip_dbus_type_to_g_type            (const gchar     *dbus_type_string);
74 const gchar *gossip_g_type_to_dbus_type            (GType            g_type);
75 gchar *      gossip_g_value_to_string              (const GValue    *value);
76 GValue *     gossip_string_to_g_value              (const gchar     *str,
77                                                     GType            type);
78 gboolean     gossip_g_value_equal                  (const GValue    *value1,
79                                                     const GValue    *value2);
80
81 guint        gossip_account_hash                    (gconstpointer   key);
82 gboolean     gossip_account_equal                   (gconstpointer   a,
83                                                      gconstpointer   b);
84 GossipContact * gossip_get_own_contact_from_contact (GossipContact  *contact);
85 G_END_DECLS
86
87 #endif /*  __GOSSIP_UTILS_H__ */