ports/net-im/tapioca-qt/files/patch-connection.cpp-2023

95 lines
2.8 KiB
Text

--- ../src/connection.cpp.orig 2007-05-23 20:20:42.000000000 +0200
+++ ../src/connection.cpp 2008-02-10 15:57:31.000000000 +0100
@@ -139,6 +139,7 @@
QObject::connect(d->conn, SIGNAL(StatusChanged(uint,uint)), this, SLOT(onStatusChanged(uint,uint)));
updateOpenChannels();
+ if (d->status == Connected) { d->loadInterfaces(); }
}
/*
@@ -196,16 +197,14 @@
Channel *channel = 0;
QString objPath;
- d->mutex.lock();
+ QMutexLocker lock(&(d->mutex));
if (type == Channel::Text) {
- qDebug() << "Creating a text channel.";
objPath = requestChannel("org.freedesktop.Telepathy.Channel.Type.Text", contact->handle(),
suppress_handler);
if (!objPath.isEmpty())
channel = new TextChannel(this, serviceName(), objPath, contact, this);
}
else if (type == Channel::Stream) {
- qDebug() << "Creating a stream channel.";
objPath = requestChannel("org.freedesktop.Telepathy.Channel.Type.StreamedMedia", contact->handle(),
suppress_handler);
if (!objPath.isEmpty())
@@ -218,8 +217,6 @@
this, SLOT(onChannelDestroyed()));
}
- d->mutex.unlock();
-
return channel;
}
@@ -251,9 +248,10 @@
ContactList *Connection::contactList()
{
if (d->status == Connection::Disconnected)
- return 0;
+ { return 0; }
- if (!d->cl) {
+ if (!d->cl)
+ {
d->cl = new ContactList(d->conn,
d->iAvatar,
d->iPresence,
@@ -273,7 +271,8 @@
if (!d->uContact) {
if (!d->selfHandle) {
/* Updated selfHandle */
- d->selfHandle = d->handleFactory->createHandle(Handle::Contact, d->conn->GetSelfHandle());
+ uint my_handle = d->conn->GetSelfHandle();
+ d->selfHandle = d->handleFactory->createHandle(Handle::Contact, my_handle);
Q_ASSERT (d->selfHandle != 0);
}
@@ -332,14 +331,12 @@
{
Channel *channel = 0;
- d->mutex.lock();
+ QMutexLocker lock(&(d->mutex));
if ((d->channels.contains(objPath.path())) ||
((channelType != "org.freedesktop.Telepathy.Channel.Type.Text") &&
- (channelType != "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"))) {
- d->mutex.unlock();
- return NULL;
- }
+ (channelType != "org.freedesktop.Telepathy.Channel.Type.StreamedMedia")))
+ { return NULL; }
Contact *contact = contactList()->contact(handleId);
@@ -348,7 +345,6 @@
contact = d->cl->addContact(handle);
if (!contact) {
qDebug() << "error creating a contact.";
- d->mutex.unlock();
return NULL;
}
}
@@ -364,8 +360,6 @@
this, SLOT(onChannelDestroyed()));
}
- d->mutex.unlock();
-
return channel;
}