23 #include "ircdelayedoperationignore.h" 25 #include "irc/configuration/chatnetworkscfg.h" 26 #include "irc/entities/ircnetworkentity.h" 27 #include "irc/entities/ircuserprefix.h" 28 #include "irc/ircnetworkconnectioninfo.h" 29 #include "irc/ircnetworkadapter.h" 30 #include "irc/ircresponseparser.h" 31 #include "patternlist.h" 32 #include <QInputDialog> 34 DClass<IRCDelayedOperationIgnore>
37 bool showPatternPopup;
40 QWidget *parentWidget;
42 QString cleanNickname()
const 47 QString networkDescription()
const 60 d->showPatternPopup =
false;
62 d->nickname = nickname;
63 d->parentWidget = parent;
64 this->connect(d->network->responseParser(),
65 SIGNAL(whoIsUser(QString, QString, QString, QString)),
66 SLOT(onWhoIsUser(QString, QString, QString, QString)));
69 IRCDelayedOperationIgnore::~IRCDelayedOperationIgnore()
73 void IRCDelayedOperationIgnore::start()
75 d->network->sendMessage(QString(
"/whois %1").arg(d->cleanNickname()));
78 void IRCDelayedOperationIgnore::onWhoIsUser(
const QString& nickname,
const QString& user,
79 const QString& hostName,
const QString& realName)
81 QString ignorePattern =
"*!*@" + hostName;
82 if (d->showPatternPopup)
84 QString label = tr(
"Ignore user %1 (username=%2) on network %3:").arg(
85 nickname, user, d->networkDescription());
86 ignorePattern = QInputDialog::getText(d->parentWidget, tr(
"IRC - Ignore user"),
87 label, QLineEdit::Normal, ignorePattern);
89 if (!ignorePattern.trimmed().isEmpty())
94 patterns << QRegExp(ignorePattern, Qt::CaseInsensitive, QRegExp::Wildcard);
95 network.setIgnoredUsers(patterns);
97 d->network->setNetworkEntity(network);
104 d->showPatternPopup = b;
Interprets communication between the client and the IRC server.
void setShowPatternPopup(bool b)
const QString & description() const
A short, human-readable description for the network. (Preferably a single word).
IRCNetworkEntity networkEntity
Information about the network to which we will connect.
bool replaceNetwork(const QString &oldDescription, const IRCNetworkEntity &newNetwork, QWidget *errorDisplayParentWidget)
Replace network definition in config and move around log files.
const IRCUserPrefix & userPrefixes() const
All allowed modes with their nickname prefixes for this network.
Data structure that describes and defines a connection to an IRC network or server.