Use el flag to properly detect MUCs and chatrooms
[conv-inbox] / src / el-home-applet.c
index ec3762d..26c4f14 100644 (file)
@@ -25,6 +25,7 @@
 #include <libintl.h>
 #include <hildon/hildon.h>
 #include <rtcom-eventlogger/eventlogger.h>
+#include <rtcom-eventlogger-plugins/chat.h>
 #include <sqlite3.h>
 #include <string.h>
 #include <gconf/gconf-client.h>
@@ -143,6 +144,7 @@ struct _ELHomeAppletPrivate
         gchar *remote_id;
         gchar *local_id;
         gchar *channel;
+        int flags;
         OssoABookContact *contact;
 
         gboolean time_fmt_24h;
@@ -991,6 +993,7 @@ show_event (ELHomeApplet *self, RTComElIter *it)
                                               "remote-ebook-uid", &priv->contact_id,
                                               "free-text", &priv->message,
                                               "channel", &priv->channel,
+                                              "flags", &priv->flags,
                                               NULL)) {
                         received = format_time (received_t, priv->time_fmt_24h);
 
@@ -1403,7 +1406,8 @@ open_conversation (ELHomeApplet *self)
         if (!account)
                 return;
 
-        if (!g_strcmp0 (account->protocol_name, "skype")) {
+        if ((priv->flags & RTCOM_EL_FLAG_CHAT_GROUP) &&
+            (priv->flags & RTCOM_EL_FLAG_CHAT_OPAQUE)) {
                 if (!priv->channel)
                         return;
 
@@ -1431,14 +1435,17 @@ open_conversation (ELHomeApplet *self)
                 MC_ACCOUNT_CRD_INIT (&request);
                 MC_ACCOUNT_CRD_SET (&request, channel_type, TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
 
-                if (priv->channel) {
+                if ((priv->flags & RTCOM_EL_FLAG_CHAT_ROOM) &&
+                    priv->channel) {
                         MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_ROOM);
                         MC_ACCOUNT_CRD_SET (&request, target_id, priv->channel);
                 }
-                else {
+                else if (priv->remote_id) {
                         MC_ACCOUNT_CRD_SET (&request, target_handle_type, TP_HANDLE_TYPE_CONTACT);
                         MC_ACCOUNT_CRD_SET (&request, target_id, priv->remote_id);
                 }
+                else
+                        return;
 
                 mc_account_channelrequest (account,
                                            &request,