Fix for publish/subscribe error
[vicar] / src / vicar-telepathy / src / connection.cpp
index 236ded5..c4dbfb4 100644 (file)
@@ -441,6 +441,18 @@ QDBusObjectPath Connection::processChannel(const QVariantMap &request){
         return channel_path;
     }
 
+    //Only allow requests with handle type as contact
+    QVariant vTargetHandleType = request.value("org.freedesktop.Telepathy.Channel.TargetHandleType");
+    uint intTargetHandleType = vTargetHandleType.toUInt();
+    if (intTargetHandleType != HandleContact)
+    {
+        QString strMessage = "VICaR - Supports handles of type Contact only. Recieved handle type ";
+        strMessage.append(vTargetHandleType.toString());
+
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       strMessage);
+    }
+
     /*
         Send an error reply to Tp Client (Mission Control) to force it to close the active channel.
         Once it recieves the reply, the client does not bother what we return.