summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchanneltab.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index 581f9a5..4a35929 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,20 +1,23 @@
#include <qpe/resource.h>
#include <qwhatsthis.h>
#include <qhbox.h>
+#include <qdict.h>
#include "ircchanneltab.h"
#include "ircservertab.h"
#include "ircmessageparser.h"
+QDict<QString> IRCChannelTab::m_queuedMessages (17);
+
IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
m_mainWindow = mainWindow;
m_parentTab = parentTab;
m_channel = channel;
m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>");
QHBox *hbox = new QHBox(this);
m_textview = new QTextView(hbox);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_listVisible = TRUE;
m_listButton = new QPushButton(">", m_textview);
m_listButton->setFlat( true );
@@ -44,24 +47,30 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
m_layout->add(hbox);
hbox->show();
m_layout->add(m_field);
m_field->setFocus();
m_field->setActiveWindow();
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) ));
settingsChanged();
+
+ if(m_queuedMessages[m_channel->channelname()]) {
+ appendText(*m_queuedMessages[m_channel->channelname()]);
+ delete m_queuedMessages[m_channel->channelname()];
+ m_queuedMessages.remove(m_channel->channelname());
+ }
}
void IRCChannelTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
}
void IRCChannelTab::appendText(QString text) {
/* not using append because it creates layout problems */
QString txt = m_textview->text() + IRCTab::appendTimestamp( text );
if (m_maxLines > 0 && m_lines >= m_maxLines) {
int firstBreak = txt.find('\n');
if (firstBreak != -1) {
@@ -173,19 +182,27 @@ QString IRCChannelTab::title() {
IRCSession *IRCChannelTab::session() {
return m_parentTab->session();
}
void IRCChannelTab::remove() {
if (session()->isSessionActive()) {
session()->part(m_channel);
} else {
m_mainWindow->killTab(this);
}
}
+void IRCChannelTab::enqueue(const QString &channel, const QString &message) {
+ if (m_queuedMessages.count() == (m_queuedMessages.size() - 1) )
+ /* 17 messages max */
+ return;
+ m_queuedMessages.insert(channel, new QString(message));
+}
+
IRCChannel *IRCChannelTab::channel() {
return m_channel;
}
IRCChannelList *IRCChannelTab::list() {
return m_list;
}
+