[telepathy-qt4/master] PendingChannel: Use ChannelFactory to create channels.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Wed May 27 07:40:31 PDT 2009


---
 TelepathyQt4/pending-channel.cpp |   29 +++--------------------------
 1 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/TelepathyQt4/pending-channel.cpp b/TelepathyQt4/pending-channel.cpp
index 5aac41b..285dc29 100644
--- a/TelepathyQt4/pending-channel.cpp
+++ b/TelepathyQt4/pending-channel.cpp
@@ -23,6 +23,7 @@
 
 #include "TelepathyQt4/_gen/pending-channel.moc.hpp"
 
+#include "TelepathyQt4/channel-factory.h"
 #include "TelepathyQt4/debug-internal.h"
 
 #include <TelepathyQt4/Channel>
@@ -255,32 +256,8 @@ ChannelPtr PendingChannel::channel() const
     }
 
     SharedPtr<Connection> conn(mPriv->connection);
-    if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT) {
-        mPriv->channel = ChannelPtr(dynamic_cast<Channel*>(
-                    TextChannel::create(conn,
-                        mPriv->objectPath.path(), mPriv->immutableProperties).data()));
-    }
-    else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA) {
-        mPriv->channel = ChannelPtr(dynamic_cast<Channel*>(
-                    StreamedMediaChannel::create(conn,
-                        mPriv->objectPath.path(), mPriv->immutableProperties).data()));
-    }
-    else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_ROOM_LIST) {
-        mPriv->channel = ChannelPtr(dynamic_cast<Channel*>(
-                    RoomList::create(conn,
-                        mPriv->objectPath.path(), mPriv->immutableProperties).data()));
-    }
-    // FIXME: update spec so we can do this properly
-    else if (channelType() == "org.freedesktop.Telepathy.Channel.Type.FileTransfer") {
-        mPriv->channel = ChannelPtr(dynamic_cast<Channel*>(
-                    FileTransfer::create(conn,
-                        mPriv->objectPath.path(), mPriv->immutableProperties).data()));
-    }
-    else {
-        // ContactList, old-style Tubes, or a future channel type
-        mPriv->channel = Channel::create(conn,
-                mPriv->objectPath.path(), mPriv->immutableProperties);
-    }
+    mPriv->channel = ChannelFactory::create(conn,
+            mPriv->objectPath.path(), mPriv->immutableProperties);
     return mPriv->channel;
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list