summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircservertab.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircservertab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 2a34c0b..5ca7a29 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,13 +1,14 @@
#include <qtextstream.h>
#include <qwhatsthis.h>
#include "ircservertab.h"
bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) {
- return (text.find("ping") != -1 && text.find( tab->server()->nick() != -1));
+ return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) ||
+ (text.find("ping") != -1 && text.find( tab->server()->nick() != -1));
}
IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
m_server = server;
m_session = new IRCSession(&m_server);
@@ -27,26 +28,32 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab()));
connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus()));
QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
m_layout->add(m_field);
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
- m_field->setFocus();
connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
settingsChanged();
+
+ m_field->setFocus();
+ m_field->setActiveWindow();
+
}
void IRCServerTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
}
void IRCServerTab::appendText(QString text) {
/* not using append because it creates layout problems */
- QString txt = m_textview->text() + text + "\n";
+ QString txt = m_textview->text() + IRCTab::appendTimestamp( text );
+
+
+
if (m_maxLines > 0 && m_lines >= m_maxLines) {
int firstBreak = txt.find('\n');
if (firstBreak != -1) {
txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
}
} else {
@@ -231,17 +238,17 @@ void IRCServerTab::remove() {
m_close = TRUE;
m_session->endSession();
} else {
/* Session has previously been closed */
m_channelTabs.first();
while (m_channelTabs.current() != 0) {
- m_mainWindow->killTab(m_channelTabs.current());
+ m_mainWindow->killTab(m_channelTabs.current(), true);
}
m_queryTabs.first();
while (m_queryTabs.current() != 0) {
- m_mainWindow->killTab(m_queryTabs.current());
+ m_mainWindow->killTab(m_queryTabs.current(), true);
}
m_mainWindow->killTab(this);
}
}
IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) {
@@ -269,17 +276,17 @@ void IRCServerTab::display(IRCOutput output) {
/* All messages to be displayed inside the GUI get here */
switch (output.type()) {
case OUTPUT_CONNCLOSE:
if (m_close) {
m_channelTabs.first();
while (m_channelTabs.current() != 0) {
- m_mainWindow->killTab(m_channelTabs.current());
+ m_mainWindow->killTab(m_channelTabs.current(), true);
}
m_queryTabs.first();
while (m_queryTabs.current() != 0) {
- m_mainWindow->killTab(m_queryTabs.current());
+ m_mainWindow->killTab(m_queryTabs.current(), true);
}
m_mainWindow->killTab(this);
} else {
appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() +"</font><br>");
QListIterator<IRCChannelTab> it(m_channelTabs);
for (; it.current(); ++it) {
@@ -309,20 +316,20 @@ void IRCServerTab::display(IRCOutput output) {
queryTab->display(output);
}
break;
case OUTPUT_SELFPART: {
IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
if (channelTab)
- m_mainWindow->killTab(channelTab);
+ m_mainWindow->killTab(channelTab, true);
}
break;
case OUTPUT_SELFKICK: {
appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>");
IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
if (channelTab)
- m_mainWindow->killTab(channelTab);
+ m_mainWindow->killTab(channelTab, true);
}
break;
case OUTPUT_CHANACTION: {
IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>");
}