Make Quassel not crash on color codes > 15 (Sput)
[quassel.git] / src / client / networkmodel.cpp
index 7320820..ff44942 100644 (file)
@@ -74,7 +74,7 @@ bool BufferItem::isActive() const {
   if(bufferType() == ChannelType)
     return _ircChannel;
   else
-    return true;
+    return qobject_cast<NetworkItem *>(parent())->isActive();
 }
 
 BufferItem::ActivityLevel BufferItem::activity() const {
@@ -215,15 +215,10 @@ QString NetworkItem::currentServer() const {
 }
 
 int NetworkItem::nickCount() const {
-  BufferItem *bufferItem;
-  int count = 0;
-  for(int i = 0; i < childCount(); i++) {
-    bufferItem = qobject_cast<BufferItem *>(child(i));
-    if(!bufferItem)
-      continue;
-    count += bufferItem->nickCount();
-  }
-  return count;
+  if(_network)
+    return _network->ircUsers().count();
+  else
+    return 0;
 }
 
 void NetworkItem::attachNetwork(Network *network) {
@@ -239,6 +234,8 @@ void NetworkItem::attachNetwork(Network *network) {
   connect(network, SIGNAL(ircChannelAdded(QString)),
          this, SLOT(attachIrcChannel(QString)));
   // FIXME: connect this and that...
+
+  emit dataChanged();
 }
 
 void NetworkItem::attachIrcChannel(const QString &channelName) {