412 chatText->moveCursor(QTextCursor::End); |
412 chatText->moveCursor(QTextCursor::End); |
413 } |
413 } |
414 |
414 |
415 void HWChatWidget::nickAdded(const QString& nick, bool notifyNick) |
415 void HWChatWidget::nickAdded(const QString& nick, bool notifyNick) |
416 { |
416 { |
417 chatEditLine->addNickname(nick); |
417 bool isIgnored = ignoreList.contains(nick, Qt::CaseInsensitive); |
418 |
418 QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), isIgnored); |
419 QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), ignoreList.contains(nick, Qt::CaseInsensitive)); |
|
420 updateNickItem(item); |
419 updateNickItem(item); |
421 chatNicks->addItem(item); |
420 chatNicks->addItem(item); |
422 |
421 |
|
422 if (!isIgnored) |
|
423 chatEditLine->addNickname(nick); |
|
424 |
423 emit nickCountUpdate(chatNicks->count()); |
425 emit nickCountUpdate(chatNicks->count()); |
424 |
426 |
425 if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { |
427 if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { |
426 Mix_PlayChannel(-1, sound[rand()%4], 0); |
428 Mix_PlayChannel(-1, sound[rand()%4], 0); |
427 } |
429 } |
479 return; |
482 return; |
480 |
483 |
481 if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him |
484 if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him |
482 { |
485 { |
483 ignoreList.removeAll(curritem->text().toLower()); |
486 ignoreList.removeAll(curritem->text().toLower()); |
|
487 chatEditLine->addNickname(curritem->text()); |
484 onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your ignore list").arg('\x03').arg(curritem->text())); |
488 onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your ignore list").arg('\x03').arg(curritem->text())); |
485 } |
489 } |
486 else // not on list - add |
490 else // not on list - add |
487 { |
491 { |
488 // don't consider ignored people friends |
492 // don't consider ignored people friends |
492 // scroll down on first ignore added so that people see where that nick went to |
496 // scroll down on first ignore added so that people see where that nick went to |
493 if (ignoreList.isEmpty()) |
497 if (ignoreList.isEmpty()) |
494 chatNicks->scrollToBottom(); |
498 chatNicks->scrollToBottom(); |
495 |
499 |
496 ignoreList << curritem->text().toLower(); |
500 ignoreList << curritem->text().toLower(); |
|
501 chatEditLine->removeNickname(curritem->text()); |
497 onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text())); |
502 onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text())); |
498 } |
503 } |
499 updateNickItem(curritem); // update icon/sort order/etc |
504 updateNickItem(curritem); // update icon/sort order/etc |
500 chatNicks->sortItems(); |
505 chatNicks->sortItems(); |
501 chatNickSelected(0); // update context menu |
506 chatNickSelected(0); // update context menu |