author | wazlaf <wazlaf> | 2002-09-21 23:59:08 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-21 23:59:08 (UTC) |
commit | d60625b5551f26cdc35f7b2497ab538de859537d (patch) (side-by-side diff) | |
tree | 998c8d2e1f12a9c7ab9b55fa578f93d1a178ade6 /noncore/net/opieirc/ircservertab.cpp | |
parent | 54238c669808ceccaa6fb0ab0dcbf4565b370196 (diff) | |
download | opie-d60625b5551f26cdc35f7b2497ab538de859537d.zip opie-d60625b5551f26cdc35f7b2497ab538de859537d.tar.gz opie-d60625b5551f26cdc35f7b2497ab538de859537d.tar.bz2 |
query windows and basic commands such as /me, /msg
Diffstat (limited to 'noncore/net/opieirc/ircservertab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 503a758..8b8771f 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -13,2 +13,3 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa m_textview->setVScrollBarMode(QScrollView::AlwaysOn); + m_textview->setTextFormat(RichText); m_layout->add(m_textview); @@ -35,2 +36,6 @@ void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { +void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { + m_queryTabs.remove(tab); +} + QString IRCServerTab::title() { @@ -62,8 +67,10 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { } else if (command == "ME") { - QString text = IRCOutput::toHTML(line.right(line.length()-4)); + QString text = line.right(line.length()-4); if (text.length() > 0) { if (tab->isA("IRCChannelTab")) { - tab->appendText("<font color=\"#cc0000\">*" + m_server.nick() + " " + text + "</font><br>"); + tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); } else if (tab->isA("IRCQueryTab")) { + tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); + m_session->sendAction(((IRCQueryTab *)tab)->person(), text); } else { @@ -72,2 +79,14 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { } + } else if (command == "MSG") { + QString nickname; + stream >> nickname; + if (nickname.length() > 0) { + if (line.length() > 6 + nickname.length()) { + QString text = line.right(line.length()-nickname.length()-6); + IRCPerson person; + person.setNick(nickname); + tab->appendText("><font color=\"#0000dd\">"+IRCOutput::toHTML(nickname)+"</font>< "+IRCOutput::toHTML(text)+"<br>"); + m_session->sendMessage(&person, text); + } + } } else { @@ -102,2 +121,6 @@ void IRCServerTab::remove() { } + m_queryTabs.first(); + while (m_queryTabs.current() != 0) { + m_mainWindow->killTab(m_queryTabs.current()); + } m_mainWindow->killTab(this); @@ -116,2 +139,12 @@ IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { +IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) { + QListIterator<IRCQueryTab> it(m_queryTabs); + + for (; it.current(); ++it) { + if (it.current()->person()->nick() == person->nick()) + return it.current(); + } + return 0; +} + void IRCServerTab::display(IRCOutput output) { @@ -126,2 +159,6 @@ void IRCServerTab::display(IRCOutput output) { } + m_queryTabs.first(); + while (m_queryTabs.current() != 0) { + m_mainWindow->killTab(m_queryTabs.current()); + } m_mainWindow->killTab(this); @@ -143,3 +180,14 @@ void IRCServerTab::display(IRCOutput output) { IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); - channelTab->appendText("<<font color=\"#0000dd\">"+((IRCChannelPerson *)output.getParam(1))->person->nick()+"</font>> "+output.htmlMessage()+"<br>"); + channelTab->appendText("<<font color=\"#0000dd\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font>> "+output.htmlMessage()+"<br>"); + } + break; + case OUTPUT_QUERYACTION: + case OUTPUT_QUERYPRIVMSG: { + IRCQueryTab *queryTab = getTabForQuery((IRCPerson *)output.getParam(0)); + if (!queryTab) { + queryTab = new IRCQueryTab((IRCPerson *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); + m_queryTabs.append(queryTab); + m_mainWindow->addTab(queryTab); + } + queryTab->display(output); } |