projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modernize: Use nullptr
[quassel.git]
/
src
/
client
/
coreconnection.cpp
diff --git
a/src/client/coreconnection.cpp
b/src/client/coreconnection.cpp
index
b0c4feb
..
90e0289
100644
(file)
--- a/
src/client/coreconnection.cpp
+++ b/
src/client/coreconnection.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
6
by the Quassel Project *
+ * Copyright (C) 2005-201
8
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-36,7
+36,7
@@
CoreConnection::CoreConnection(QObject *parent)
: QObject(parent),
CoreConnection::CoreConnection(QObject *parent)
: QObject(parent),
- _authHandler(
0
),
+ _authHandler(
nullptr
),
_state(Disconnected),
_wantReconnect(false),
_wasReconnect(false),
_state(Disconnected),
_wantReconnect(false),
_wasReconnect(false),
@@
-184,6
+184,15
@@
void CoreConnection::onlineStateChanged(bool isOnline)
}
}
+QPointer<Peer> CoreConnection::peer() const
+{
+ if (_peer) {
+ return _peer;
+ }
+ return _authHandler ? _authHandler->peer() : nullptr;
+}
+
+
bool CoreConnection::isEncrypted() const
{
return _peer && _peer->isSecure();
bool CoreConnection::isEncrypted() const
{
return _peer && _peer->isSecure();
@@
-277,17
+286,17
@@
void CoreConnection::resetConnection(bool wantReconnect)
_wantReconnect = wantReconnect;
if (_authHandler) {
_wantReconnect = wantReconnect;
if (_authHandler) {
- disconnect(_authHandler,
0, this, 0
);
+ disconnect(_authHandler,
nullptr, this, nullptr
);
_authHandler->close();
_authHandler->deleteLater();
_authHandler->close();
_authHandler->deleteLater();
- _authHandler =
0
;
+ _authHandler =
nullptr
;
}
if (_peer) {
}
if (_peer) {
- disconnect(_peer,
0, this, 0
);
+ disconnect(_peer,
nullptr, this, nullptr
);
// peer belongs to the sigproxy and thus gets deleted by it
_peer->close();
// peer belongs to the sigproxy and thus gets deleted by it
_peer->close();
- _peer =
0
;
+ _peer =
nullptr
;
}
_netsToSync.clear();
}
_netsToSync.clear();
@@
-372,14
+381,13
@@
void CoreConnection::connectToCurrentAccount()
qWarning() << "Cannot connect to internal core in client-only mode!";
return;
}
qWarning() << "Cannot connect to internal core in client-only mode!";
return;
}
- emit startInternalCore();
InternalPeer *peer = new InternalPeer();
_peer = peer;
Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
InternalPeer *peer = new InternalPeer();
_peer = peer;
Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
+ emit connectionMsg(tr("Initializing..."));
emit connectToInternalCore(peer);
setState(Connected);
emit connectToInternalCore(peer);
setState(Connected);
-
return;
}
return;
}
@@
-445,9
+453,9
@@
void CoreConnection::onHandshakeComplete(RemotePeer *peer, const Protocol::Sessi
{
updateProgress(100, 100);
{
updateProgress(100, 100);
- disconnect(_authHandler,
0, this, 0
);
+ disconnect(_authHandler,
nullptr, this, nullptr
);
_authHandler->deleteLater();
_authHandler->deleteLater();
- _authHandler =
0
;
+ _authHandler =
nullptr
;
_peer = peer;
connect(peer, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
_peer = peer;
connect(peer, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
@@
-463,9
+471,6
@@
void CoreConnection::onHandshakeComplete(RemotePeer *peer, const Protocol::Sessi
void CoreConnection::internalSessionStateReceived(const Protocol::SessionState &sessionState)
{
updateProgress(100, 100);
void CoreConnection::internalSessionStateReceived(const Protocol::SessionState &sessionState)
{
updateProgress(100, 100);
-
- Client::setCoreFeatures(Quassel::features()); // mono connection...
-
setState(Synchronizing);
syncToCore(sessionState);
}
setState(Synchronizing);
syncToCore(sessionState);
}
@@
-513,7
+518,7
@@
void CoreConnection::networkInitDone()
{
QObject *net = sender();
Q_ASSERT(net);
{
QObject *net = sender();
Q_ASSERT(net);
- disconnect(net,
0, this, 0
);
+ disconnect(net,
nullptr, this, nullptr
);
_netsToSync.remove(net);
updateProgress(_numNetsToSync - _netsToSync.count(), _numNetsToSync);
checkSyncState();
_netsToSync.remove(net);
updateProgress(_numNetsToSync - _netsToSync.count(), _numNetsToSync);
checkSyncState();