return ret_val;
}
-/* Stolen from telepathy-glib */
-gboolean
-empathy_strdiff (const gchar *left, const gchar *right)
-{
- if ((NULL == left) != (NULL == right))
- return TRUE;
-
- else if (left == right)
- return FALSE;
-
- else
- return (0 != strcmp (left, right));
-}
-
-/* Stolen from telepathy-glib */
-static inline gboolean
-_esc_ident_bad (gchar c, gboolean is_first)
-{
- return ((c < 'a' || c > 'z') &&
- (c < 'A' || c > 'Z') &&
- (c < '0' || c > '9' || is_first));
-}
-
-/* Stolen from telepathy-glib */
-gchar *
-empathy_escape_as_identifier (const gchar *name)
-{
- gboolean bad = FALSE;
- size_t len = 0;
- GString *op;
- const gchar *ptr, *first_ok;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- for (ptr = name; *ptr; ptr++)
- {
- if (_esc_ident_bad (*ptr, ptr == name))
- {
- bad = TRUE;
- len += 3;
- }
- else
- len++;
- }
-
- /* fast path if it's clean */
- if (!bad)
- return g_strdup (name);
-
- /* If strictly less than ptr, first_ok is the first uncopied safe character.
- */
- first_ok = name;
- op = g_string_sized_new (len);
- for (ptr = name; *ptr; ptr++)
- {
- if (_esc_ident_bad (*ptr, ptr == name))
- {
- /* copy preceding safe characters if any */
- if (first_ok < ptr)
- {
- g_string_append_len (op, first_ok, ptr - first_ok);
- }
- /* escape the unsafe character */
- g_string_append_printf (op, "_%02x", (unsigned char)(*ptr));
- /* restart after it */
- first_ok = ptr + 1;
- }
- }
- /* copy trailing safe characters if any */
- if (first_ok < ptr)
- {
- g_string_append_len (op, first_ok, ptr - first_ok);
- }
- return g_string_free (op, FALSE);
-}
-
gboolean
empathy_xml_validate (xmlDoc *doc,
const gchar *dtd_filename)
xmlDtd *dtd;
gboolean ret;
- path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
+ path = g_build_filename (UNINSTALLED_DTD_DIR, dtd_filename, NULL);
+ if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+ g_free (path);
+ path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
+ }
+ empathy_debug (DEBUG_DOMAIN, "Loading dtd file %s", path);
/* The list of valid chars is taken from libxml. */
escaped = xmlURIEscapeStr (path, ":@&=+$,/?;");
-
g_free (path);
memset (&cvp, 0, sizeof (cvp));
GArray *handles;
gchar **names;
gchar *name;
- GError *error;
+ GError *error = NULL;
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
g_return_val_if_fail (handle != 0, NULL);
const gchar *bus_name;
TpChan *new_chan;
EmpathyTpGroup *group;
- GError *error;
+ GError *error = NULL;
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
#endif
}
+void
+empathy_chat_with_contact (EmpathyContact *contact)
+{
+ MissionControl *mc;
+
+ mc = empathy_mission_control_new ();
+ mission_control_request_channel (mc,
+ empathy_contact_get_account (contact),
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+ empathy_contact_get_handle (contact),
+ TP_HANDLE_TYPE_CONTACT,
+ NULL, NULL);
+ g_object_unref (mc);
+}
+
+void
+empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id)
+{
+ MissionControl *mc;
+
+ mc = empathy_mission_control_new ();
+ mission_control_request_channel_with_string_handle (mc,
+ account,
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+ contact_id,
+ TP_HANDLE_TYPE_CONTACT,
+ NULL, NULL);
+ g_object_unref (mc);
+}
+