Merge branch 'network-sync'
[quassel.git] / src / client / networkmodel.cpp
index 1a692ca..6b155a0 100644 (file)
@@ -325,10 +325,8 @@ void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel) {
   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 :)";
+  if(!ircChannel->ircUsers().isEmpty())
     join(ircChannel->ircUsers());
-  }
   
   emit dataChanged();
 }
@@ -426,8 +424,13 @@ void ChannelBufferItem::userModeChanged(IrcUser *ircUser) {
   int categoryId = UserCategoryItem::categoryFromModes(_ircChannel->userModes(ircUser));
   UserCategoryItem *categoryItem = qobject_cast<UserCategoryItem *>(childById(qHash(categoryId)));
     
-  if(categoryItem && categoryItem->childById(qHash(ircUser)))
-    return; // already in the right category;
+  if(categoryItem) {
+    if(categoryItem->childById(qHash(ircUser)))
+      return; // already in the right category;
+  } else {
+    categoryItem = new UserCategoryItem(categoryId, this);
+    newChild(categoryItem);
+  }
 
   // find the item that needs reparenting
   IrcUserItem *ircUserItem = 0;
@@ -572,8 +575,11 @@ QString IrcUserItem::toolTip(int column) const {
   Q_UNUSED(column);
   QStringList toolTip(QString("<b>%1</b>").arg(nickName()));
   if(_ircUser->userModes() != "") toolTip[0].append(QString(" (%1)").arg(_ircUser->userModes()));
-  if(_ircUser->isAway()) toolTip[0].append(" is away");
-  if(!_ircUser->awayMessage().isEmpty()) toolTip[0].append(QString(" (%1)").arg(_ircUser->awayMessage()));
+  if(_ircUser->isAway()) {
+    toolTip[0].append(" is away");
+    if(!_ircUser->awayMessage().isEmpty())
+      toolTip[0].append(QString(" (%1)").arg(_ircUser->awayMessage()));
+  }
   if(!_ircUser->realName().isEmpty()) toolTip.append(_ircUser->realName());
   if(!_ircUser->ircOperator().isEmpty()) toolTip.append(QString("%1 %2").arg(nickName()).arg(_ircUser->ircOperator()));
   if(!_ircUser->suserHost().isEmpty()) toolTip.append(_ircUser->suserHost());