Diffstat (limited to 'noncore/net/opieirc/ircservertab.cpp') (more/less context) (ignore 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 | |||
13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
14 | m_textview->setTextFormat(RichText); | ||
14 | m_layout->add(m_textview); | 15 | m_layout->add(m_textview); |
@@ -35,2 +36,6 @@ void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | |||
35 | 36 | ||
37 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | ||
38 | m_queryTabs.remove(tab); | ||
39 | } | ||
40 | |||
36 | QString IRCServerTab::title() { | 41 | QString IRCServerTab::title() { |
@@ -62,8 +67,10 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
62 | } else if (command == "ME") { | 67 | } else if (command == "ME") { |
63 | QString text = IRCOutput::toHTML(line.right(line.length()-4)); | 68 | QString text = line.right(line.length()-4); |
64 | if (text.length() > 0) { | 69 | if (text.length() > 0) { |
65 | if (tab->isA("IRCChannelTab")) { | 70 | if (tab->isA("IRCChannelTab")) { |
66 | tab->appendText("<font color=\"#cc0000\">*" + m_server.nick() + " " + text + "</font><br>"); | 71 | tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); |
67 | m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); | 72 | m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); |
68 | } else if (tab->isA("IRCQueryTab")) { | 73 | } else if (tab->isA("IRCQueryTab")) { |
74 | tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); | ||
75 | m_session->sendAction(((IRCQueryTab *)tab)->person(), text); | ||
69 | } else { | 76 | } else { |
@@ -72,2 +79,14 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
72 | } | 79 | } |
80 | } else if (command == "MSG") { | ||
81 | QString nickname; | ||
82 | stream >> nickname; | ||
83 | if (nickname.length() > 0) { | ||
84 | if (line.length() > 6 + nickname.length()) { | ||
85 | QString text = line.right(line.length()-nickname.length()-6); | ||
86 | IRCPerson person; | ||
87 | person.setNick(nickname); | ||
88 | tab->appendText("><font color=\"#0000dd\">"+IRCOutput::toHTML(nickname)+"</font>< "+IRCOutput::toHTML(text)+"<br>"); | ||
89 | m_session->sendMessage(&person, text); | ||
90 | } | ||
91 | } | ||
73 | } else { | 92 | } else { |
@@ -102,2 +121,6 @@ void IRCServerTab::remove() { | |||
102 | } | 121 | } |
122 | m_queryTabs.first(); | ||
123 | while (m_queryTabs.current() != 0) { | ||
124 | m_mainWindow->killTab(m_queryTabs.current()); | ||
125 | } | ||
103 | m_mainWindow->killTab(this); | 126 | m_mainWindow->killTab(this); |
@@ -116,2 +139,12 @@ IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { | |||
116 | 139 | ||
140 | IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) { | ||
141 | QListIterator<IRCQueryTab> it(m_queryTabs); | ||
142 | |||
143 | for (; it.current(); ++it) { | ||
144 | if (it.current()->person()->nick() == person->nick()) | ||
145 | return it.current(); | ||
146 | } | ||
147 | return 0; | ||
148 | } | ||
149 | |||
117 | void IRCServerTab::display(IRCOutput output) { | 150 | void IRCServerTab::display(IRCOutput output) { |
@@ -126,2 +159,6 @@ void IRCServerTab::display(IRCOutput output) { | |||
126 | } | 159 | } |
160 | m_queryTabs.first(); | ||
161 | while (m_queryTabs.current() != 0) { | ||
162 | m_mainWindow->killTab(m_queryTabs.current()); | ||
163 | } | ||
127 | m_mainWindow->killTab(this); | 164 | m_mainWindow->killTab(this); |
@@ -143,3 +180,14 @@ void IRCServerTab::display(IRCOutput output) { | |||
143 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); | 180 | IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); |
144 | channelTab->appendText("<<font color=\"#0000dd\">"+((IRCChannelPerson *)output.getParam(1))->person->nick()+"</font>> "+output.htmlMessage()+"<br>"); | 181 | channelTab->appendText("<<font color=\"#0000dd\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font>> "+output.htmlMessage()+"<br>"); |
182 | } | ||
183 | break; | ||
184 | case OUTPUT_QUERYACTION: | ||
185 | case OUTPUT_QUERYPRIVMSG: { | ||
186 | IRCQueryTab *queryTab = getTabForQuery((IRCPerson *)output.getParam(0)); | ||
187 | if (!queryTab) { | ||
188 | queryTab = new IRCQueryTab((IRCPerson *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); | ||
189 | m_queryTabs.append(queryTab); | ||
190 | m_mainWindow->addTab(queryTab); | ||
191 | } | ||
192 | queryTab->display(output); | ||
145 | } | 193 | } |