Fix group chat opening
authorArtem Garmash <artemgarmash@gmail.com>
Sun, 18 Apr 2010 22:03:13 +0000 (01:03 +0300)
committerArtem Garmash <artem.garmash@nokia.com>
Sun, 27 Jun 2010 19:13:48 +0000 (22:13 +0300)
src/el-home-applet.c

index 77c3c4c..ec3762d 100644 (file)
@@ -142,7 +142,7 @@ struct _ELHomeAppletPrivate
         gchar *contact_id;
         gchar *remote_id;
         gchar *local_id;
         gchar *contact_id;
         gchar *remote_id;
         gchar *local_id;
-        gchar *group_uid;
+        gchar *channel;
         OssoABookContact *contact;
 
         gboolean time_fmt_24h;
         OssoABookContact *contact;
 
         gboolean time_fmt_24h;
@@ -822,9 +822,9 @@ clean_state (ELHomeApplet *self)
                 g_free (priv->remote_id);
                 priv->remote_id = NULL;
         }
                 g_free (priv->remote_id);
                 priv->remote_id = NULL;
         }
-        if (priv->group_uid) {
-                g_free (priv->group_uid);
-                priv->group_uid = NULL;
+        if (priv->channel) {
+                g_free (priv->channel);
+                priv->channel = NULL;
         }
 }
 
         }
 }
 
@@ -990,7 +990,7 @@ show_event (ELHomeApplet *self, RTComElIter *it)
                                               "remote-name", &remote,
                                               "remote-ebook-uid", &priv->contact_id,
                                               "free-text", &priv->message,
                                               "remote-name", &remote,
                                               "remote-ebook-uid", &priv->contact_id,
                                               "free-text", &priv->message,
-                                              "group-uid", &priv->group_uid,
+                                              "channel", &priv->channel,
                                               NULL)) {
                         received = format_time (received_t, priv->time_fmt_24h);
 
                                               NULL)) {
                         received = format_time (received_t, priv->time_fmt_24h);
 
@@ -1394,9 +1394,8 @@ open_conversation (ELHomeApplet *self)
 {
         ELHomeAppletPrivate *priv = self->priv;
         McAccount *account;
 {
         ELHomeAppletPrivate *priv = self->priv;
         McAccount *account;
-        const gchar *persistent_id = NULL;
 
 
-        if (!((priv->remote_id || priv->group_uid) && priv->local_id))
+        if (!((priv->remote_id || priv->channel) && priv->local_id))
                 return;
 
         account = osso_abook_account_manager_lookup_by_name (NULL,
                 return;
 
         account = osso_abook_account_manager_lookup_by_name (NULL,
@@ -1404,21 +1403,17 @@ open_conversation (ELHomeApplet *self)
         if (!account)
                 return;
 
         if (!account)
                 return;
 
-        if (priv->group_uid &&
-            g_str_has_prefix (priv->group_uid, "group:")) {
-                persistent_id = strchr (priv->group_uid, '-');
-                if (persistent_id)
-                        persistent_id++;
-        }
+        if (!g_strcmp0 (account->protocol_name, "skype")) {
+                if (!priv->channel)
+                        return;
 
 
-        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",
                 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,
+                         G_TYPE_STRING, priv->channel,
                          NULL);
 
                 mc_account_channelrequest_ht (account,
                          NULL);
 
                 mc_account_channelrequest_ht (account,
@@ -1430,13 +1425,20 @@ open_conversation (ELHomeApplet *self)
 
                 g_hash_table_unref (properties);
         }
 
                 g_hash_table_unref (properties);
         }
-        else if (priv->remote_id) {
+        else {
                 McAccountChannelrequestData request;
 
                 MC_ACCOUNT_CRD_INIT (&request);
                 MC_ACCOUNT_CRD_SET (&request, channel_type, TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
                 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);
+
+                if (priv->channel) {
+                        MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_ROOM);
+                        MC_ACCOUNT_CRD_SET (&request, target_id, priv->channel);
+                }
+                else {
+                        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,
 
                 mc_account_channelrequest (account,
                                            &request,