X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=cf1aedaafe90b98dbb7332ed5ea78098e563b7ff;hp=6133e4334d1cd25d661fce48429d1a8f894ada65;hb=8582c2ad5708a1972c85bea1cf8d81ad3ece4814;hpb=f12d6496251729f7d21f4fbcb0814dec7fba4b75 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 6133e433..cf1aedaa 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -28,7 +28,6 @@ #include #include -INIT_SYNCABLE_OBJECT(IrcUser) IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(network), _initialized(false), _nick(nickFromMask(hostmask)), @@ -44,8 +43,8 @@ IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(net _whoisServiceReply(), _encrypted(false), _network(network), - _codecForEncoding(0), - _codecForDecoding(0) + _codecForEncoding(nullptr), + _codecForDecoding(nullptr) { updateObjectName(); _lastAwayMessageTime.setTimeSpec(Qt::UTC); @@ -53,11 +52,6 @@ IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(net } -IrcUser::~IrcUser() -{ -} - - // ==================== // PUBLIC: // ==================== @@ -161,7 +155,7 @@ void IrcUser::setAccount(const QString &account) } -void IrcUser::setAway(const bool &away) +void IrcUser::setAway(bool away) { if (away != _away) { _away = away; @@ -221,17 +215,16 @@ void IrcUser::setIrcOperator(const QString &ircOperator) // This function is only ever called by SYNC calls from legacy cores (pre-0.13). // Therefore, no SYNC call is needed here. -void IrcUser::setLastAwayMessage(const int &lastAwayMessage) +void IrcUser::setLastAwayMessage(int lastAwayMessage) { - QDateTime lastAwayMessageTime = QDateTime(); - lastAwayMessageTime.setTimeSpec(Qt::UTC); #if QT_VERSION >= 0x050800 - lastAwayMessageTime.fromSecsSinceEpoch(lastAwayMessage); + QDateTime lastAwayMessageTime = QDateTime::fromSecsSinceEpoch(lastAwayMessage); #else // toSecsSinceEpoch() was added in Qt 5.8. Manually downconvert to seconds for now. // See https://doc.qt.io/qt-5/qdatetime.html#toMSecsSinceEpoch - lastAwayMessageTime.fromMSecsSinceEpoch(lastAwayMessage * 1000); + QDateTime lastAwayMessageTime = QDateTime::fromMSecsSinceEpoch(lastAwayMessage * 1000); #endif + lastAwayMessageTime.setTimeSpec(Qt::UTC); setLastAwayMessageTime(lastAwayMessageTime); } @@ -330,7 +323,7 @@ void IrcUser::partChannel(IrcChannel *channel) { if (_channels.contains(channel)) { _channels.remove(channel); - disconnect(channel, 0, this, 0); + disconnect(channel, nullptr, this, nullptr); channel->part(this); QString channelName = channel->name(); SYNC_OTHER(partChannel, ARG(channelName)) @@ -343,7 +336,7 @@ void IrcUser::partChannel(IrcChannel *channel) void IrcUser::partChannel(const QString &channelname) { IrcChannel *channel = network()->ircChannel(channelname); - if (channel == 0) { + if (channel == nullptr) { qWarning() << "IrcUser::partChannel(): received part for unknown Channel" << channelname; } else { @@ -357,7 +350,7 @@ void IrcUser::quit() QList channels = _channels.toList(); _channels.clear(); foreach(IrcChannel *channel, channels) { - disconnect(channel, 0, this, 0); + disconnect(channel, nullptr, this, nullptr); channel->part(this); } network()->removeIrcUser(this); @@ -369,7 +362,7 @@ void IrcUser::quit() void IrcUser::channelDestroyed() { // private slot! - IrcChannel *channel = static_cast(sender()); + auto *channel = static_cast(sender()); if (_channels.contains(channel)) { _channels.remove(channel); if (_channels.isEmpty() && !network()->isMe(this))