Breaking protocol with alpha2.... and it won't be the last one...
[quassel.git] / src / common / ircuser.cpp
index 223a02f..efa7541 100644 (file)
@@ -28,8 +28,7 @@
 #include <QTextCodec>
 #include <QDebug>
 
-IrcUser::IrcUser(const QString &hostmask, Network *network)
-  : SyncableObject(network),
+IrcUser::IrcUser(const QString &hostmask, Network *network) : SyncableObject(network),
     _initialized(false),
     _nick(nickFromMask(hostmask)),
     _user(userFromMask(hostmask)),
@@ -145,7 +144,7 @@ QString IrcUser::decodeString(const QByteArray &text) const {
   return ::decodeString(text, codecForDecoding());
 }
 
-QByteArray IrcUser::encodeString(const QString string) const {
+QByteArray IrcUser::encodeString(const QString &string) const {
   if(codecForEncoding()) {
     return codecForEncoding()->fromUnicode(string);
   }
@@ -227,12 +226,7 @@ void IrcUser::setNick(const QString &nick) {
 }
 
 void IrcUser::updateObjectName() {
-  QString newName = QString::number(network()->networkId().toInt()) + "/" + _nick;
-  QString oldName = objectName();
-  if(oldName != newName) {
-    setObjectName(newName);
-    emit renameObject(oldName, newName);
-  }
+  renameObject(QString::number(network()->networkId().toInt()) + "/" + _nick);
 }
 
 void IrcUser::updateHostmask(const QString &mask) {
@@ -265,6 +259,8 @@ void IrcUser::partChannel(IrcChannel *channel) {
     disconnect(channel, 0, this, 0);
     channel->part(this);
     emit channelParted(channel->name());
+    if(_channels.isEmpty())
+      deleteLater();
   }
 }