#include <libosso-abook/osso-abook-account-manager.h>
#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/dbus.h>
+#include <rtcom-telepathy-glib/extensions.h>
#define EL_HOME_APPLET_GET_PRIVATE(obj) ( \
G_TYPE_INSTANCE_GET_PRIVATE (obj, \
gchar *contact_id;
gchar *remote_id;
gchar *local_id;
+ gchar *group_uid;
OssoABookContact *contact;
};
g_free (priv->remote_id);
priv->remote_id = NULL;
}
+ if (priv->group_uid) {
+ g_free (priv->group_uid);
+ priv->group_uid = NULL;
+ }
if (priv->contact) {
g_object_unref (priv->contact);
priv->remote_id = NULL;
}
}
+ rtcom_el_iter_dup_string (it, "group-uid", &priv->group_uid);
#if 0
service = rtcom_el_iter_get_service (it);
if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_SMS"))
{
ELHomeAppletPrivate *priv = self->priv;
McAccount *account;
- McAccountChannelrequestData request;
+ const gchar *persistent_id = NULL;
- if (!(priv->remote_id && priv->local_id))
+ if (!((priv->remote_id || priv->group_uid) && priv->local_id))
return;
account = osso_abook_account_manager_lookup_by_name (NULL,
if (!account)
return;
- MC_ACCOUNT_CRD_INIT (&request);
- MC_ACCOUNT_CRD_SET (&request, channel_type, TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
- MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_CONTACT);
- MC_ACCOUNT_CRD_SET (&request, target_id, priv->remote_id);
-
- mc_account_channelrequest (
- account,
- &request,
- time (NULL),
- NULL, /* handler */
- MC_ACCOUNT_CR_FLAG_USE_EXISTING,
- NULL, NULL, NULL, NULL);
+ if (priv->group_uid &&
+ g_str_has_prefix (priv->group_uid, "group:")) {
+ persistent_id = strchr (priv->group_uid, '-');
+ if (persistent_id)
+ persistent_id++;
+ }
+
+ if (persistent_id && persistent_id[0] != '\0') {
+ GHashTable *properties = tp_asv_new
+ (TP_IFACE_CHANNEL ".ChannelType", G_TYPE_STRING,
+ TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_IFACE_CHANNEL ".TargetHandleType", G_TYPE_UINT,
+ TP_HANDLE_TYPE_NONE,
+ RTCOM_TP_IFACE_CHANNEL_INTERFACE_PERSISTENT ".PersistentID",
+ G_TYPE_STRING, persistent_id,
+ NULL);
+
+ mc_account_channelrequest_ht (account,
+ properties,
+ time (NULL),
+ NULL,
+ MC_ACCOUNT_CR_FLAG_USE_EXISTING,
+ NULL, NULL, NULL, NULL);
+
+ g_hash_table_unref (properties);
+ }
+ else if (priv->remote_id) {
+ McAccountChannelrequestData request;
+
+ MC_ACCOUNT_CRD_INIT (&request);
+ MC_ACCOUNT_CRD_SET (&request, channel_type, TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
+ MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_CONTACT);
+ MC_ACCOUNT_CRD_SET (&request, target_id, priv->remote_id);
+
+ mc_account_channelrequest (account,
+ &request,
+ time (NULL),
+ NULL,
+ MC_ACCOUNT_CR_FLAG_USE_EXISTING,
+ NULL, NULL, NULL, NULL);
+ }
}
static gboolean