254
259
void Server::doPreShellCommand()
256
QString command = getIdentity()->getShellCommand();
257
getStatusView()->appendServerMessage(i18n("Info"),"Running preconfigured command...");
259
connect(&m_preShellCommand,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(preShellCommandExited(int,QProcess::ExitStatus)));
260
connect(&m_preShellCommand,SIGNAL(error(QProcess::ProcessError)), this, SLOT(preShellCommandError(QProcess::ProcessError)));
262
const QStringList commandList = command.split(' ');
264
for (QStringList::ConstIterator it = commandList.begin(); it != commandList.end(); ++it)
265
m_preShellCommand << *it;
267
m_preShellCommand.start();
268
if (m_preShellCommand.state() == QProcess::NotRunning) preShellCommandExited(m_preShellCommand.exitCode(), m_preShellCommand.exitStatus());
262
QStringList command = KShell::splitArgs(getIdentity()->getShellCommand(), KShell::TildeExpand, &e);
263
if (e != KShell::NoError)
265
//FIXME The flow needs to be refactored, add a finally-like method that does the ready-to-connect stuff
266
// "The pre-connect shell command could not be understood!");
267
preShellCommandExited(m_preShellCommand.exitCode(), m_preShellCommand.exitStatus());
271
// FIXME add i18n, and in preShellCommandExited and preShellCommandError
272
getStatusView()->appendServerMessage(i18n("Info"), "Running pre-connect shell command...");
274
connect(&m_preShellCommand, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(preShellCommandExited(int,QProcess::ExitStatus)));
275
connect(&m_preShellCommand, SIGNAL(error(QProcess::ProcessError)), SLOT(preShellCommandError(QProcess::ProcessError)));
277
m_preShellCommand.setProgram(command);
278
m_preShellCommand.start();
279
// NOTE: isConnecting is tested in connectToIRCServer so there's no guard here
280
if (m_preShellCommand.state() == QProcess::NotRunning)
281
preShellCommandExited(m_preShellCommand.exitCode(), m_preShellCommand.exitStatus());
271
285
void Server::initTimers()
403
417
if (exitStatus == QProcess::NormalExit)
404
418
getStatusView()->appendServerMessage(i18n("Info"),"Process executed successfully!");
406
getStatusView()->appendServerMessage(i18n("Warning"),"There was a problem while executing the command!");
421
QString errorText = QLatin1String("There was a problem while executing the command: ") % m_preShellCommand.errorString();
422
getStatusView()->appendServerMessage(i18n("Warning"), errorText);
408
425
connectToIRCServer();
409
426
connectSignals();
416
getStatusView()->appendServerMessage(i18n("Warning"),"There was a problem while executing the command!");
433
QString errorText = QLatin1String("There was a problem while executing the command: ") % m_preShellCommand.errorString();
434
getStatusView()->appendServerMessage(i18n("Warning"), errorText);
418
436
connectToIRCServer();
419
437
connectSignals();
903
921
// Make a helper object to build ISON (notify) list and map offline nicks to addressbook.
904
922
// TODO: Give the object a kick to get it started?
923
Q_ASSERT(m_serverISON == 0);
905
924
m_serverISON = new ServerISON(this);
906
925
// get first notify very early
907
926
startNotifyTimer(1000);
1755
1774
ChannelNickPtr channelNick = getChannelNick(channelName, lcNickname);
1756
1775
if (!channelNick)
1758
// Get watch list from preferences.
1759
QString watchlist=getWatchListString();
1760
// Create a lower case nick list from the watch list.
1761
QStringList watchLowerList = watchlist.toLower().split(' ', QString::SkipEmptyParts);
1762
// If on the watch list, add channel and nick to unjoinedChannels list.
1763
if (watchLowerList.contains(lcNickname))
1777
// If the nick is on the watch list, add channel and nick to unjoinedChannels list.
1778
if (getWatchList().contains(lcNickname, Qt::CaseInsensitive))
1765
1780
channelNick = addNickToUnjoinedChannelsList(channelName, nickname);
1766
1781
channelNick->setMode(mode);