23 #include "ircdocktabcontents.h"
24 #include "ui_ircdocktabcontents.h"
25 #include "gui/irc/ircignoresmanager.h"
26 #include "gui/irc/ircsounds.h"
27 #include "gui/irc/ircuserlistmodel.h"
28 #include "gui/commongui.h"
29 #include "irc/configuration/chatlogscfg.h"
30 #include "irc/configuration/ircconfig.h"
31 #include "irc/entities/ircnetworkentity.h"
32 #include "irc/ops/ircdelayedoperationignore.h"
33 #include "irc/chatlogrotate.h"
34 #include "irc/chatlogs.h"
35 #include "irc/ircchanneladapter.h"
36 #include "irc/ircdock.h"
37 #include "irc/ircglobal.h"
38 #include "irc/ircmessageclass.h"
39 #include "irc/ircnetworkadapter.h"
40 #include "irc/ircnicknamecompleter.h"
41 #include "irc/ircuserinfo.h"
42 #include "irc/ircuserlist.h"
43 #include "application.h"
50 #include <QStandardItemModel>
55 const int IRCDockTabContents::BLINK_TIMER_DELAY_MS = 650;
57 DClass<IRCDockTabContents> :
public Ui::IRCDockTabContents
61 QDateTime lastMessageDate;
81 QStringList textOutputContents;
82 ::IRCDockTabContents::UserListMenu* userListContextMenu;
104 QAction* openChatWindow;
112 IRCDockTabContents::IRCDockTabContents(
IRCDock* pParentIRCDock)
115 d->lastMessageDate = QDateTime::currentDateTime();
117 d->bBlinkTitle =
false;
118 d->bIsDestroying =
false;
119 d->lastMessageClass = NULL;
120 d->userListContextMenu = NULL;
121 this->pIrcAdapter = NULL;
123 this->pParentIRCDock = pParentIRCDock;
126 d->txtOutputWidget->setContextMenuPolicy(Qt::CustomContextMenu);
127 setupNewUserListModel();
131 d->lvUserList->setVisible(
false);
133 this->connect(d->btnSend, SIGNAL(clicked()), SLOT(sendMessage()));
134 this->connect(d->leCommandLine, SIGNAL(returnPressed()), SLOT(sendMessage()));
135 this->connect(gApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
136 SLOT(onFocusChanged(QWidget*, QWidget*)));
140 d->blinkTimer.setSingleShot(
false);
141 this->connect(&d->blinkTimer, SIGNAL( timeout() ),
142 SLOT( blinkTimerSlot() ) );
148 IRCDockTabContents::~IRCDockTabContents()
150 d->bIsDestroying =
true;
152 if (d->lastMessageClass != NULL)
154 delete d->lastMessageClass;
157 if (d->userListContextMenu != NULL)
159 delete d->userListContextMenu;
162 if (pIrcAdapter != NULL)
164 disconnect(pIrcAdapter, 0, 0, 0);
171 void IRCDockTabContents::adapterFocusRequest()
176 void IRCDockTabContents::adapterTerminating()
178 if (pIrcAdapter != NULL && !d->bIsDestroying)
181 disconnect(pIrcAdapter, 0, 0, 0);
188 void IRCDockTabContents::alertIfConfigured()
190 if (gIRCConfig.appearance.windowAlertOnImportantChatEvent)
192 QApplication::alert(gApp->mainWindowAsQWidget());
198 const static QString STYLE_SHEET_BASE_TEMPLATE =
199 "QListView, QTextEdit, QLineEdit { background: %1; color: %2; } ";
203 QString qtStyleSheet = STYLE_SHEET_BASE_TEMPLATE
204 .arg(appearance.backgroundColor)
205 .arg(appearance.defaultTextColor);
207 QColor colorSelectedText(appearance.userListSelectedTextColor);
208 QColor colorSelectedBackground(appearance.userListSelectedBackgroundColor);
209 qtStyleSheet += QString(
"QListView::item:selected { color: %1; background: %2; } ").arg(colorSelectedText.name(), colorSelectedBackground.name());
211 QColor colorHoverText = colorSelectedText.lighter();
212 QColor colorHoverBackground = colorSelectedBackground.lighter();
213 qtStyleSheet += QString(
"QListView::item:hover { color: %1; background: %2; } ").arg(colorHoverText.name(), colorHoverBackground.name());
215 QString channelActionClassName = IRCMessageClass::toStyleSheetClassName(IRCMessageClass::ChannelAction);
216 QString ctcpClassName = IRCMessageClass::toStyleSheetClassName(IRCMessageClass::Ctcp);
217 QString errorClassName = IRCMessageClass::toStyleSheetClassName(IRCMessageClass::Error);
218 QString networkActionClassName = IRCMessageClass::toStyleSheetClassName(IRCMessageClass::NetworkAction);
220 QString htmlStyleSheetMessageArea =
"";
221 htmlStyleSheetMessageArea +=
"span { white-space: pre; }";
222 htmlStyleSheetMessageArea += QString(
"a { color: %1; white-space: pre; } ").arg(appearance.urlColor);
223 htmlStyleSheetMessageArea += QString(
"." + channelActionClassName +
" { color: %1; } ").arg(appearance.channelActionColor);
224 htmlStyleSheetMessageArea += QString(
"." + ctcpClassName +
" { color: %1; } ").arg(appearance.ctcpColor);
225 htmlStyleSheetMessageArea += QString(
"." + errorClassName +
" { color: %1; } ").arg(appearance.errorColor);
226 htmlStyleSheetMessageArea += QString(
"." + networkActionClassName +
" { color: %1; } ").arg(appearance.networkActionColor);
228 d->lvUserList->setStyleSheet(qtStyleSheet);
229 d->lvUserList->setFont(appearance.userListFont);
231 d->leCommandLine->installEventFilter(
this);
232 d->leCommandLine->setStyleSheet(qtStyleSheet);
233 d->leCommandLine->setFont(appearance.mainFont);
235 d->txtOutputWidget->setStyleSheet(qtStyleSheet);
236 d->txtOutputWidget->setFont(appearance.mainFont);
238 d->txtOutputWidget->document()->setDefaultStyleSheet(htmlStyleSheetMessageArea);
239 d->txtOutputWidget->clear();
240 d->txtOutputWidget->insertHtml(d->textOutputContents.join(
""));
241 d->txtOutputWidget->moveCursor(QTextCursor::End);
244 void IRCDockTabContents::blinkTimerSlot()
246 setBlinkTitle(!d->bBlinkTitle);
249 void IRCDockTabContents::completeNickname()
252 if (d->nicknameCompleter->isReset())
254 result = d->nicknameCompleter->complete(d->leCommandLine->text(), d->leCommandLine->cursorPosition());
258 result = d->nicknameCompleter->cycleNext();
260 if (result.isValid())
263 d->leCommandLine->blockSignals(
true);
264 d->leCommandLine->setText(result.textLine);
265 d->leCommandLine->setCursorPosition(result.cursorPos);
266 d->leCommandLine->blockSignals(
false);
270 bool IRCDockTabContents::eventFilter(QObject *watched, QEvent *event)
272 if (watched == d->leCommandLine && event->type() == QEvent::KeyPress)
274 QKeyEvent *keyEvent =
static_cast<QKeyEvent*
>(event);
275 if (keyEvent->key() == Qt::Key_Tab)
284 QStandardItem* IRCDockTabContents::findUserListItem(
const QString& nickname)
286 QStandardItemModel* pModel = (QStandardItemModel*)d->lvUserList->model();
289 for (
int i = 0; i < pModel->rowCount(); ++i)
291 QStandardItem* pItem = pModel->item(i);
292 if (userInfo ==
IRCUserInfo(pItem->text(), network()))
301 IRCDockTabContents::UserListMenu& IRCDockTabContents::getUserListContextMenu()
303 if (d->userListContextMenu == NULL)
305 d->userListContextMenu =
new UserListMenu();
308 return *d->userListContextMenu;
314 d->blinkTimer.stop();
315 setBlinkTitle(
false);
317 d->leCommandLine->setFocus();
320 bool IRCDockTabContents::hasTabFocus()
const
322 return this->pParentIRCDock->hasTabFocus(
this);
325 QIcon IRCDockTabContents::icon()
const
327 if (pIrcAdapter == NULL)
334 case IRCAdapterBase::ChannelAdapter:
335 return QIcon(
":/icons/irc_channel.png");
337 case IRCAdapterBase::NetworkAdapter:
338 return QIcon(
":/flags/lan-small");
340 case IRCAdapterBase::PrivAdapter:
341 return QIcon(
":/icons/person.png");
348 void IRCDockTabContents::insertMessage(
const IRCMessageClass& messageClass,
const QString& htmlString)
350 if (d->lastMessageClass == NULL)
354 *d->lastMessageClass = messageClass;
356 d->textOutputContents << htmlString;
362 QTextCursor cursor = d->txtOutputWidget->textCursor();
363 cursor.movePosition(QTextCursor::End);
364 cursor.insertHtml(htmlString);
366 if (!d->btnPauseTextArea->isChecked())
368 d->txtOutputWidget->moveCursor(QTextCursor::End);
371 emit newMessagePrinted();
374 void IRCDockTabContents::markDate()
376 QDateTime previousMessageDate = d->lastMessageDate;
377 QDateTime nowDate = QDateTime::currentDateTime();
378 d->lastMessageDate = nowDate;
379 if (previousMessageDate.daysTo(nowDate) != 0)
381 receiveMessageWithClass(tr(
"<<<DATE>>> Date on this computer changes to %1").arg(
382 nowDate.toString()), IRCMessageClass::NetworkAction);
386 void IRCDockTabContents::myNicknameUsedSlot()
392 d->blinkTimer.start(BLINK_TIMER_DELAY_MS);
396 void IRCDockTabContents::nameAdded(
const IRCUserInfo& userInfo)
398 QStandardItemModel* pModel = (QStandardItemModel*)d->lvUserList->model();
399 QStandardItem* pItem =
new QStandardItem(userInfo.
prefixedName());
400 pItem->setData(userInfo.
cleanNickname(), IRCUserListModel::RoleCleanNickname);
403 for (
int i = 0; i < pModel->rowCount(); ++i)
405 QStandardItem* pExistingItem = pModel->item(i);
406 QString existingNickname = pExistingItem->text();
408 if (userInfo <=
IRCUserInfo(existingNickname, network()))
410 pModel->insertRow(i, pItem);
417 pModel->appendRow(pItem);
420 void IRCDockTabContents::nameListUpdated(
const IRCUserList& userList)
422 setupNewUserListModel();
424 for (
unsigned i = 0; i < userList.size(); ++i)
426 nameAdded(*userList[i]);
430 void IRCDockTabContents::nameRemoved(
const IRCUserInfo& userInfo)
432 QStandardItemModel* pModel = (QStandardItemModel*)d->lvUserList->model();
433 for (
int i = 0; i < pModel->rowCount(); ++i)
435 QStandardItem* pItem = pModel->item(i);
438 pModel->removeRow(i);
444 void IRCDockTabContents::nameUpdated(
const IRCUserInfo& userInfo)
446 nameRemoved(userInfo);
452 return ircAdapter()->
network();
457 return ircAdapter()->networkEntity();
464 pParentIRCDock->addIRCAdapter(pAdapter);
467 void IRCDockTabContents::onFocusChanged(QWidget *old, QWidget *now)
469 if (old == d->lvUserList && now != d->userListContextMenu)
471 d->lvUserList->clearSelection();
475 bool IRCDockTabContents::openLog()
479 if (!logs.mkLogDir(networkEntity()))
481 receiveMessageWithClass(tr(
"Failed to create chat log directory:\n'%1'").arg(
482 logs.networkDirPath(networkEntity())), IRCMessageClass::Error);
485 d->log.setFileName(
ChatLogs().logFilePath(networkEntity(), recipient()));
486 d->log.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
487 d->log.write(tr(
"<<<DATE>>> Chat log started on %1\n\n").arg(QDateTime::currentDateTime().toString()).toUtf8());
491 void IRCDockTabContents::rotateOldLog()
493 assert(!d->log.isOpen());
498 cfg.isRestoreChatFromLogs() ? cfg.oldLogsRemovalDaysThreshold() : -1);
499 logRotate.rotate(networkEntity(), recipient());
502 void IRCDockTabContents::printToSendersNetworksCurrentChatBox(
const QString &text,
const IRCMessageClass &msgClass)
508 tab->ircAdapter()->emitMessageWithClass(text, msgClass);
512 adapter->emitMessageWithClass(text, msgClass);
516 void IRCDockTabContents::receiveError(
const QString& error)
518 receiveMessageWithClass(tr(
"Error: %1").arg(error), IRCMessageClass::Error);
521 void IRCDockTabContents::receiveMessage(
const QString& message)
526 void IRCDockTabContents::receiveMessageWithClass(
const QString& message,
const IRCMessageClass& messageClass)
530 QString messageHtmlEscaped = message;
532 if (gIRCConfig.appearance.timestamps)
534 QString timestamp = Strings::timestamp(
"[hh:mm:ss] ") ;
536 messageHtmlEscaped = timestamp + messageHtmlEscaped;
540 messageHtmlEscaped = messageHtmlEscaped.replace(
"\n",
"\n" + timestamp);
546 messageHtmlEscaped +=
"\n";
548 writeLog(messageHtmlEscaped);
550 messageHtmlEscaped = wrapTextWithMetaTags(messageHtmlEscaped, messageClass);
553 if (pIrcAdapter->
adapterType() == IRCAdapterBase::PrivAdapter)
556 pParentIRCDock->sounds().
playIfAvailable(IRCSounds::PrivateMessageReceived);
561 d->blinkTimer.start(BLINK_TIMER_DELAY_MS);
565 this->insertMessage(messageClass, messageHtmlEscaped);
568 QString IRCDockTabContents::recipient()
const
570 return pIrcAdapter->recipient();
573 void IRCDockTabContents::resetNicknameCompletion()
575 d->nicknameCompleter->reset();
578 bool IRCDockTabContents::restoreLog()
581 QFile file(logs.logFilePath(networkEntity(), recipient()));
582 if (file.open(QIODevice::ReadOnly | QIODevice::Text))
584 QByteArray contents = file.readAll();
585 QStringList lines = QString::fromUtf8(contents, contents.size()).split(
"\n");
586 int line = lines.size() - 1000;
587 lines = lines.mid((line > 0) ? line : 0);
592 receiveMessageWithClass(tr(
"---- All lines above were loaded from log ----"),
593 IRCMessageClass::NetworkAction);
599 QString IRCDockTabContents::selectedNickname()
601 QModelIndexList selectedIndexes = d->lvUserList->selectionModel()->selectedRows();
603 if (!selectedIndexes.isEmpty())
605 int row = selectedIndexes[0].row();
606 QStandardItemModel* pModel = (QStandardItemModel*)d->lvUserList->model();
607 QStandardItem* pItem = pModel->item(row);
609 return pItem->text();
615 void IRCDockTabContents::sendCtcpPing(
const QString &nickname)
617 network()->sendCtcp(nickname, QString(
"PING %1").arg(QDateTime::currentMSecsSinceEpoch()));
620 void IRCDockTabContents::sendCtcpTime(
const QString &nickname)
622 network()->sendCtcp(nickname, QString(
"TIME"));
625 void IRCDockTabContents::sendCtcpVersion(
const QString &nickname)
627 network()->sendCtcp(nickname, QString(
"VERSION"));
630 void IRCDockTabContents::sendMessage()
632 QString message = d->leCommandLine->text();
633 d->leCommandLine->setText(
"");
635 if (!message.trimmed().isEmpty())
637 pIrcAdapter->sendMessage(message);
641 void IRCDockTabContents::sendWhois(
const QString &nickname)
643 network()->sendMessage(QString(
"/WHOIS %1").arg(nickname));
646 void IRCDockTabContents::setBlinkTitle(
bool b)
649 if (d->bBlinkTitle != b)
659 emit titleBlinkRequested();
665 assert(pIrcAdapter == NULL);
666 pIrcAdapter = pAdapter;
669 if (cfg.isRestoreChatFromLogs())
673 if (cfg.isStoreLogs())
678 connect(pIrcAdapter, SIGNAL( error(
const QString&) ), SLOT( receiveError(
const QString& ) ));
679 connect(pIrcAdapter, SIGNAL(
focusRequest() ), SLOT( adapterFocusRequest() ));
680 connect(pIrcAdapter, SIGNAL( message(
const QString&) ), SLOT( receiveMessage(
const QString& ) ));
681 connect(pIrcAdapter, SIGNAL( messageWithClass(
const QString&,
const IRCMessageClass&) ), SLOT( receiveMessageWithClass(
const QString&,
const IRCMessageClass&) ));
682 connect(pIrcAdapter, SIGNAL( terminating() ), SLOT( adapterTerminating() ) );
683 connect(pIrcAdapter, SIGNAL(
titleChange() ), SLOT( adapterTitleChange() ) );
684 connect(pIrcAdapter, SIGNAL( messageToNetworksCurrentChatBox(QString,
IRCMessageClass) ),
685 SLOT( printToSendersNetworksCurrentChatBox(QString,
IRCMessageClass) ) );
689 case IRCAdapterBase::NetworkAdapter:
696 case IRCAdapterBase::ChannelAdapter:
699 connect(pChannelAdapter, SIGNAL( myNicknameUsed() ), SLOT( myNicknameUsedSlot() ) );
700 connect(pChannelAdapter, SIGNAL( nameAdded(
const IRCUserInfo&) ), SLOT( nameAdded(
const IRCUserInfo&) ) );
701 connect(pChannelAdapter, SIGNAL( nameListUpdated(
const IRCUserList&) ), SLOT( nameListUpdated(
const IRCUserList&) ) );
702 connect(pChannelAdapter, SIGNAL( nameRemoved(
const IRCUserInfo&) ), SLOT( nameRemoved(
const IRCUserInfo&) ) );
703 connect(pChannelAdapter, SIGNAL( nameUpdated(
const IRCUserInfo&) ), SLOT( nameUpdated(
const IRCUserInfo&) ) );
705 d->lvUserList->setVisible(
true);
706 connect(d->lvUserList, SIGNAL( customContextMenuRequested(
const QPoint&) ),
707 SLOT( userListCustomContextMenuRequested(
const QPoint&) ) );
709 connect(d->lvUserList, SIGNAL( doubleClicked(
const QModelIndex&) ),
710 SLOT( userListDoubleClicked(
const QModelIndex&) ) );
712 d->lvUserList->setContextMenuPolicy(Qt::CustomContextMenu);
717 case IRCAdapterBase::PrivAdapter:
724 receiveError(
"Doomseeker error: Unknown IRCAdapterBase*");
730 void IRCDockTabContents::setupNewUserListModel()
732 d->lvUserList->setModel(
new QStandardItemModel(d->lvUserList));
733 d->nicknameCompleter->setModel(d->lvUserList->model());
736 void IRCDockTabContents::showChatContextMenu(
const QPoint &pos)
738 QMenu *menu = d->txtOutputWidget->createStandardContextMenu(pos);
739 if (ircAdapter()->adapterType() == IRCAdapterBase::PrivAdapter)
741 menu->addSeparator();
742 appendPrivChatContextMenuOptions(menu);
744 menu->addSeparator();
745 appendGeneralChatContextMenuOptions(menu);
746 menu->exec(d->txtOutputWidget->mapToGlobal(pos));
750 void IRCDockTabContents::appendGeneralChatContextMenuOptions(QMenu *menu)
752 QAction *manageIgnores = menu->addAction(tr(
"Manage ignores"));
753 this->connect(manageIgnores, SIGNAL(triggered()), SLOT(showIgnoresManager()));
756 void IRCDockTabContents::appendPrivChatContextMenuOptions(QMenu *menu)
758 appendPrivChatContextMenuAction(menu, tr(
"Whois"), PrivWhois);
759 appendPrivChatContextMenuAction(menu, tr(
"CTCP Ping"), PrivCtcpPing);
760 appendPrivChatContextMenuAction(menu, tr(
"CTCP Time"), PrivCtcpTime);
761 appendPrivChatContextMenuAction(menu, tr(
"CTCP Version"), PrivCtcpVersion);
762 appendPrivChatContextMenuAction(menu, tr(
"Ignore"), PrivIgnore);
765 void IRCDockTabContents::appendPrivChatContextMenuAction(QMenu *menu,
766 const QString &text, PrivChatMenu type)
768 QAction *action = menu->addAction(text);
769 action->setData(type);
770 this->connect(action, SIGNAL(triggered()), SLOT(onPrivChatActionTriggered()));
773 void IRCDockTabContents::onPrivChatActionTriggered()
775 QString nickname = ircAdapter()->recipient();
777 QAction *action =
static_cast<QAction*
>(sender());
778 switch (action->data().toInt())
781 sendWhois(cleanNickname);
784 sendCtcpPing(cleanNickname);
787 sendCtcpTime(cleanNickname);
789 case PrivCtcpVersion:
790 sendCtcpVersion(cleanNickname);
793 startIgnoreOperation(cleanNickname);
796 assert(0 &&
"Unsupported priv chat action");
797 qDebug() <<
"Unsupported priv chat action: " << action->data();
802 void IRCDockTabContents::showIgnoresManager()
805 connect(dialog, SIGNAL(accepted()), network(), SLOT(reloadNetworkEntityFromConfig()));
806 dialog->setAttribute(Qt::WA_DeleteOnClose);
810 void IRCDockTabContents::startIgnoreOperation(
const QString &nickname)
817 QString IRCDockTabContents::title()
const
819 return pIrcAdapter->
title();
822 QString IRCDockTabContents::titleColor()
const
824 if (d->lastMessageClass != NULL && !this->hasTabFocus())
834 color = d->lastMessageClass->colorFromConfig();
841 int rInverted = 0xff - c.red();
842 int gInverted = 0xff - c.green();
843 int bInverted = 0xff - c.blue();
845 QColor inverted(rInverted, gInverted, bInverted);
847 return inverted.name();
858 void IRCDockTabContents::userListCustomContextMenuRequested(
const QPoint& pos)
860 if (this->pIrcAdapter->
adapterType() != IRCAdapterBase::ChannelAdapter)
866 QString nickname = this->selectedNickname();
867 if (nickname.isEmpty())
875 const QString& channel = pAdapter->recipient();
877 UserListMenu& menu = this->getUserListContextMenu();
878 QPoint posGlobal = d->lvUserList->mapToGlobal(pos);
880 QAction* pAction = menu.exec(posGlobal);
887 if (pAction == menu.ban)
891 QString reason =
CommonGUI::askString(tr(
"Ban user"), tr(
"Input reason for banning user %1 from channel %2").arg(nickname, channel), &bOk);
894 pAdapter->
banUser(cleanNickname, reason);
897 else if (pAction == menu.ctcpTime)
899 sendCtcpTime(cleanNickname);
901 else if (pAction == menu.ctcpPing)
903 sendCtcpPing(cleanNickname);
905 else if (pAction == menu.ctcpVersion)
907 sendCtcpVersion(cleanNickname);
909 else if (pAction == menu.deop)
911 pAdapter->
setOp(cleanNickname,
false);
913 else if (pAction == menu.dehalfOp)
915 pAdapter->
setHalfOp(cleanNickname,
false);
917 else if (pAction == menu.devoice)
919 pAdapter->
setVoiced(cleanNickname,
false);
921 else if (pAction == menu.halfOp)
923 pAdapter->
setHalfOp(cleanNickname,
true);
925 else if (pAction == menu.ignore)
927 startIgnoreOperation(cleanNickname);
929 else if (pAction == menu.kick)
933 QString reason =
CommonGUI::askString(tr(
"Kick user"), tr(
"Input reason for kicking user %1 from channel %2").arg(nickname, channel), &bOk);
936 pAdapter->
kickUser(cleanNickname, reason);
939 else if (pAction == menu.op)
941 pAdapter->
setOp(cleanNickname,
true);
943 else if (pAction == menu.openChatWindow)
947 else if (pAction == menu.voice)
949 pAdapter->
setVoiced(cleanNickname,
true);
951 else if (pAction == menu.whois)
953 sendWhois(cleanNickname);
957 void IRCDockTabContents::userListDoubleClicked(
const QModelIndex& index)
959 if (this->pIrcAdapter->
adapterType() != IRCAdapterBase::ChannelAdapter)
965 QString nickname = this->selectedNickname();
966 if (nickname.isEmpty())
976 QString IRCDockTabContents::wrapTextWithMetaTags(
const QString &text,
979 QString result = text;
980 result.replace(
"<",
"<").replace(
">",
">");
983 QString className = messageClass.toStyleSheetClassName();
984 if (className.isEmpty())
986 result =
"<span>" + result +
"</span>";
990 result = (
"<span class='" + className +
"'>" + result +
"</span>");
995 bool IRCDockTabContents::writeLog(
const QString &text)
998 if (d->log.isOpen() && cfg.isStoreLogs())
1000 d->log.write(text.toUtf8());
1008 IRCDockTabContents::UserListMenu::UserListMenu()
1010 this->openChatWindow = this->addAction(tr(
"Open chat window"));
1011 this->addSeparator();
1012 this->whois = this->addAction(tr(
"Whois"));
1013 this->ctcpTime = this->addAction(tr(
"CTCP Time"));
1014 this->ctcpPing = this->addAction(tr(
"CTCP Ping"));
1015 this->ctcpVersion = this->addAction(tr(
"CTCP Version"));
1016 this->addSeparator();
1017 this->op = this->addAction(tr(
"Op"));
1018 this->deop = this->addAction(tr(
"Deop"));
1019 this->halfOp = this->addAction(tr(
"Half op"));
1020 this->dehalfOp = this->addAction(tr(
"De half op"));
1021 this->voice = this->addAction(tr(
"Voice"));
1022 this->devoice = this->addAction(tr(
"Devoice"));
1023 this->addSeparator();
1024 this->ignore = this->addAction(tr(
"Ignore"));
1025 this->kick = this->addAction(tr(
"Kick"));
1026 this->ban = this->addAction(tr(
"Ban"));
1028 this->bIsOperator =
false;
Interprets communication between the client and the IRC server.
Allows to perform operation on a list of users.
void setIRCAdapter(IRCAdapterBase *pAdapter)
Calling this multiple times on the same object will cause memory leaks.
Class type that is used for conversations within a channel.
Dockable widget designed for IRC communication.
void openNewAdapter(const QString &recipientName)
Opens a new chat adapter for specified recipient.
void kickUser(const QString &nickname, const QString &reason)
Kicks user from the channel.
void setHalfOp(const QString &nickname, bool bSet)
Sets half op mode for given user.
void grabFocus()
Called when tab becomes active.
Provides an unified communication interface between a client and IRC network entities.
QString cleanNickname() const
Returns nickname with no prefixes, contrary to the prefixedName() .
void setShowPatternPopup(bool b)
static QString wrapUrlsWithHtmlATags(const QString &str)
Detects all links within a given string and wraps them in <a href> tags.
QString prefixedName() const
Will generate prefix based on the user flags.
void chatWindowCloseRequest(IRCDockTabContents *)
Emitted when the IRCAdapterBase that is associated with this widget is no longer valid - possibly eve...
Dockable widget designed for IRC communication.
Handles chatting through IRC.
void banUser(const QString &nickname, const QString &reason)
Bans and kicks user from the channel.
IRCNetworkAdapter * network()
The idea of the adapter system is that each adapter is either a network or is a child of a network...
virtual QString title() const =0
Gets title for this adapter.
void newChatWindowIsOpened(IRCChatAdapter *pAdapter)
Captures signals from IRC Networks which indicate that a new chat window is being opened...
bool isSameNickname(const IRCUserInfo &otherUser) const
Check if this user and user specified as parameter are the same user.
void setRemovalAgeDaysThreshold(int age)
void titleChange(IRCDockTabContents *pCaller)
Emitted when the variable returned by IRCAdapterBase::title() might have changed and the application ...
virtual AdapterType adapterType() const =0
Gets adapter type for this adapter instance.
Normal has no representation in string, ie. it represents a global style for the widget.
void setVoiced(const QString &nickname, bool bSet)
Sets voice mode for given user.
void focusRequest(IRCDockTabContents *pCaller)
Emitted when network adapter for this dock emits its focusRequest() signal.
Holds information flags about given nickname.
void setOp(const QString &nickname, bool bSet)
Sets op mode for given user.
virtual IRCNetworkAdapter * network()=0
The idea of the adapter system is that each adapter is either a network or is a child of a network...
Data structure that describes and defines a connection to an IRC network or server.
void applyAppearanceSettings()
Applies current appearance settings from the IRC config.
static QString askString(const QString &title, const QString &label, bool *ok=NULL, const QString &defaultString="")
Calls QInputDialog::getText().
bool isAdapterRelated(const IRCAdapterBase *pAdapter) const
Checks if pAdapter equals this or is one of chat windows of this network.
void playIfAvailable(SoundType sound)
Plays given sound.