211
path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
211
path = g_build_filename (UNINSTALLED_DTD_DIR, dtd_filename, NULL);
212
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
214
path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
216
empathy_debug (DEBUG_DOMAIN, "Loading dtd file %s", path);
213
218
/* The list of valid chars is taken from libxml. */
214
219
escaped = xmlURIEscapeStr (path, ":@&=+$,/?;");
218
222
memset (&cvp, 0, sizeof (cvp));
396
empathy_call_contact (EmpathyContact *contact)
403
const gchar *bus_name;
405
EmpathyTpGroup *group;
406
GError *error = NULL;
408
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
410
/* StreamedMedia channels must have handle=0 and handle_type=none.
411
* To call a contact we have to add him in the group interface of the
412
* channel. MissionControl will detect the channel creation and
413
* dispatch it to the VoIP chandler automatically. */
415
mc = empathy_mission_control_new ();
416
account = empathy_contact_get_account (contact);
417
tp_conn = mission_control_get_connection (mc, account, NULL);
418
/* FIXME: Should be async */
419
if (!tp_conn_request_channel (DBUS_G_PROXY (tp_conn),
420
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
426
empathy_debug (DEBUG_DOMAIN,
427
"Couldn't request channel: %s",
428
error ? error->message : "No error given");
429
g_clear_error (&error);
431
g_object_unref (tp_conn);
435
bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn));
436
new_chan = tp_chan_new (tp_get_bus (),
439
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
443
group = empathy_tp_group_new (account, new_chan);
444
empathy_tp_group_add_member (group, contact, "");
446
g_object_unref (group);
448
g_object_unref (tp_conn);
449
g_object_unref (new_chan);
450
g_free (object_path);
400
empathy_call_with_contact (EmpathyContact *contact)
405
mc = empathy_mission_control_new ();
406
mission_control_request_channel (mc,
407
empathy_contact_get_account (contact),
408
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
409
empathy_contact_get_handle (contact),
410
TP_HANDLE_TYPE_CONTACT,
417
empathy_call_with_contact_id (McAccount *account, const gchar *contact_id)
422
mc = empathy_mission_control_new ();
423
mission_control_request_channel_with_string_handle (mc,
425
TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
427
TP_HANDLE_TYPE_CONTACT,
481
460
g_object_unref (mc);
464
empathy_presence_get_default_message (McPresence presence)
467
case MC_PRESENCE_AVAILABLE:
468
return _("Available");
469
case MC_PRESENCE_DO_NOT_DISTURB:
471
case MC_PRESENCE_AWAY:
472
case MC_PRESENCE_EXTENDED_AWAY:
474
case MC_PRESENCE_HIDDEN:
476
case MC_PRESENCE_OFFLINE:
477
case MC_PRESENCE_UNSET:
480
g_assert_not_reached ();
487
empathy_presence_to_str (McPresence presence)
490
case MC_PRESENCE_AVAILABLE:
492
case MC_PRESENCE_DO_NOT_DISTURB:
494
case MC_PRESENCE_AWAY:
496
case MC_PRESENCE_EXTENDED_AWAY:
498
case MC_PRESENCE_HIDDEN:
500
case MC_PRESENCE_OFFLINE:
502
case MC_PRESENCE_UNSET:
505
g_assert_not_reached ();
512
empathy_presence_from_str (const gchar *str)
514
if (strcmp (str, "available") == 0) {
515
return MC_PRESENCE_AVAILABLE;
516
} else if ((strcmp (str, "dnd") == 0) || (strcmp (str, "busy") == 0)) {
517
return MC_PRESENCE_DO_NOT_DISTURB;
518
} else if ((strcmp (str, "away") == 0) || (strcmp (str, "brb") == 0)) {
519
return MC_PRESENCE_AWAY;
520
} else if ((strcmp (str, "xa") == 0) || (strcmp (str, "ext_away") == 0)) {
521
return MC_PRESENCE_EXTENDED_AWAY;
522
} else if (strcmp (str, "hidden") == 0) {
523
return MC_PRESENCE_HIDDEN;
524
} else if (strcmp (str, "offline") == 0) {
525
return MC_PRESENCE_OFFLINE;
526
} else if (strcmp (str, "unset") == 0) {
527
return MC_PRESENCE_UNSET;
530
return MC_PRESENCE_AVAILABLE;