the following assert should no longer trigger: ASSERT: "success" in file ../../src...
[quassel.git] / src / client / networkmodel.cpp
index 12e51e5..ba9d0c8 100644 (file)
@@ -143,6 +143,13 @@ void BufferItem::attachIrcChannel(IrcChannel *ircChannel) {
          this, SLOT(userModeChanged(IrcUser *)));
   connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)),
          this, SLOT(userModeChanged(IrcUser *)));
+
+  if(!ircChannel->ircUsers().isEmpty()) {
+    qWarning() << "Channel" << ircChannel->name() << "has already users which is quite surprising :)";
+    foreach(IrcUser *ircUser, ircChannel->ircUsers()) {
+      join(ircUser);
+    }
+  }
   
   emit dataChanged();
 }
@@ -228,7 +235,8 @@ void BufferItem::removeUserFromCategory(IrcUser *ircUser) {
   }
 
   
-  if(!success || success) {
+  if(!success) {
+    qDebug() << "didn't find User:" << ircUser << (quint64)ircUser;
     qDebug() << "==== Childlist for Item:" << this << id() << bufferName() << "====";
     for(int i = 0; i < childCount(); i++) {
       categoryItem = qobject_cast<UserCategoryItem *>(child(i));
@@ -283,8 +291,16 @@ quint64 NetworkItem::id() const {
   return _networkId.toInt();
 }
 
+void NetworkItem::setActive(bool connected) {
+  Q_UNUSED(connected);
+  emit dataChanged();
+}
+
 bool NetworkItem::isActive() const {
-  return _network;
+  if(_network)
+    return _network->isConnected();
+  else
+    return false;
 }
 
 QString NetworkItem::networkName() const {
@@ -320,6 +336,9 @@ void NetworkItem::attachNetwork(Network *network) {
          this, SLOT(setCurrentServer(QString)));
   connect(network, SIGNAL(ircChannelAdded(QString)),
          this, SLOT(attachIrcChannel(QString)));
+  connect(network, SIGNAL(connectedSet(bool)),
+         this, SLOT(setActive(bool)));
+  
   // FIXME: connect this and that...
 
   emit dataChanged();