#include <libosso-abook/osso-abook-temporary-contact-dialog.h>
#include <libosso-abook/osso-abook-account-manager.h>
+#include <telepathy-glib/interfaces.h>
+
#define EL_HOME_APPLET_GET_PRIVATE(obj) ( \
G_TYPE_INSTANCE_GET_PRIVATE (obj, \
EL_TYPE_HOME_APPLET, ELHomeAppletPrivate))
g_warning (G_STRFUNC);
gchar *remote = NULL;
gchar *received = NULL;
- const gchar *icon_name = NULL;
+ /* const gchar *icon_name = NULL; */
if (it && rtcom_el_iter_first (it)) {
rtcom_el_iter_dup_string (it, "free-text", &priv->message);
if (priv->message) {
- const gchar *service;
+ /* const gchar *service; */
time_t received_t;
rtcom_el_iter_get_int (it, "id", &priv->event_id);
if (rtcom_el_iter_get_int (it, "start-time", (gint*)&received_t))
received = format_time (received_t);
- rtcom_el_iter_dup_string (it, "remote-uid", &priv->remote_id);
- if (!rtcom_el_iter_dup_string (it, "remote-name", &remote))
- remote = g_strdup (priv->remote_id);
-
- rtcom_el_iter_dup_string (it, "remote-ebook-uid", &priv->contact_id);
- rtcom_el_iter_dup_string (it, "local-uid", &priv->local_id);
- g_warning ("abook uid %s", priv->contact_id);
+ if (rtcom_el_iter_dup_string (it, "remote-uid", &priv->remote_id)) {
+ if (priv->remote_id && priv->remote_id[0]) {
+ if (!rtcom_el_iter_dup_string (it, "remote-name", &remote))
+ remote = g_strdup (priv->remote_id);
+
+ rtcom_el_iter_dup_string (it, "remote-ebook-uid", &priv->contact_id);
+ rtcom_el_iter_dup_string (it, "local-uid", &priv->local_id);
+ g_warning ("abook uid %s", priv->contact_id);
+ }
+ else if (priv->remote_id) {
+ g_free (priv->remote_id);
+ priv->remote_id = NULL;
+ }
+ }
+#if 0
service = rtcom_el_iter_get_service (it);
if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_SMS"))
icon_name = "chat_unread_sms";
else if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_CHAT"))
icon_name = "chat_unread_chat";
+#endif
}
}
else {
}
}
+static void
+open_conversation (ELHomeApplet *self)
+{
+ ELHomeAppletPrivate *priv = self->priv;
+ McAccount *account;
+ McAccountChannelrequestData request;
+
+ if (!(priv->remote_id && priv->local_id))
+ return;
+
+ account = osso_abook_account_manager_lookup_by_name (NULL,
+ priv->local_id);
+ 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);
+}
+
static gboolean
read_new_event (ELHomeApplet *self)
{
}
else {
#ifndef DEBUG_LAYOUT
- mark_as_read (self);
+ /* mark_as_read (self); */
+ open_conversation (self);
#endif
}