summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index d3c0448..5eb1758 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,419 +1,420 @@
1#include <qtextstream.h> 1#include <qtextstream.h>
2#include <qwhatsthis.h> 2#include <qwhatsthis.h>
3 3
4#include "ircservertab.h" 4#include "ircservertab.h"
5#include "ircmessageparser.h" 5#include "ircmessageparser.h"
6#include "ircchannelperson.h" 6#include "ircchannelperson.h"
7 7
8 8
9bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) { 9bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) {
10 return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) || 10 return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) ||
11 (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); 11 (text.find("ping") != -1 && text.find( tab->server()->nick() != -1));
12} 12}
13 13
14 14
15IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 15IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
16 m_server = server; 16 m_server = server;
17 m_session = new IRCSession(this, &m_server); 17 m_session = new IRCSession(this, &m_server);
18 m_mainWindow = mainWindow; 18 m_mainWindow = mainWindow;
19 m_close = FALSE; 19 m_close = FALSE;
20 m_lines = 0; 20 m_lines = 0;
21 m_description->setText(tr("Connecting to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); 21 m_description->setText(tr("Connecting to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>");
22 m_textview = new QTextView(this); 22 m_textview = new QTextView(this);
23 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 23 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
24 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 24 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
25 m_textview->setTextFormat(RichText); 25 m_textview->setTextFormat(RichText);
26 QWhatsThis::add(m_textview, tr("Server messages")); 26 QWhatsThis::add(m_textview, tr("Server messages"));
27 m_layout->add(m_textview); 27 m_layout->add(m_textview);
28 m_field = new IRCHistoryLineEdit(this); 28 m_field = new IRCHistoryLineEdit(this);
29 connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); 29 connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab()));
30 connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); 30 connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab()));
31 connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); 31 connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab()));
32 connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); 32 connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus()));
33 33
34 QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); 34 QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
35 m_layout->add(m_field); 35 m_layout->add(m_field);
36 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 36 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
37 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); 37 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
38 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); 38 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
39 connect(m_session, SIGNAL(updateChannels()), this, SLOT(slotUpdateChannels())); 39 connect(m_session, SIGNAL(updateChannels()), this, SLOT(slotUpdateChannels()));
40 settingsChanged(); 40 settingsChanged();
41 41
42 m_field->setFocus(); 42 m_field->setFocus();
43 m_field->setActiveWindow(); 43 m_field->setActiveWindow();
44 44
45} 45}
46 46
47void IRCServerTab::scrolling(){ 47void IRCServerTab::scrolling(){
48 m_textview->ensureVisible(0, m_textview->contentsHeight()); 48 m_textview->ensureVisible(0, m_textview->contentsHeight());
49} 49}
50 50
51 51
52void IRCServerTab::appendText(QString text) { 52void IRCServerTab::appendText(QString text) {
53 /* not using append because it creates layout problems */ 53 /* not using append because it creates layout problems */
54 QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); 54 QString txt = m_textview->text() + IRCTab::appendTimestamp( text );
55 55
56 56
57 57
58 if (m_maxLines > 0 && m_lines >= m_maxLines) { 58 if (m_maxLines > 0 && m_lines >= m_maxLines) {
59 int firstBreak = txt.find('\n'); 59 int firstBreak = txt.find('\n');
60 if (firstBreak != -1) { 60 if (firstBreak != -1) {
61 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 61 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
62 } 62 }
63 } else { 63 } else {
64 m_lines++; 64 m_lines++;
65 } 65 }
66 m_textview->setText(txt); 66 m_textview->setText(txt);
67 m_textview->ensureVisible(0, m_textview->contentsHeight()); 67 m_textview->ensureVisible(0, m_textview->contentsHeight());
68 emit changed(this); 68 emit changed(this);
69} 69}
70 70
71IRCServerTab::~IRCServerTab() { 71IRCServerTab::~IRCServerTab() {
72 delete m_session; 72 delete m_session;
73} 73}
74 74
75void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { 75void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
76 m_channelTabs.remove(tab); 76 m_channelTabs.remove(tab);
77} 77}
78 78
79void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { 79void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
80 m_queryTabs.remove(tab); 80 m_queryTabs.remove(tab);
81} 81}
82 82
83void IRCServerTab::addQueryTab(IRCQueryTab *tab) { 83void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
84 m_queryTabs.append(tab); 84 m_queryTabs.append(tab);
85} 85}
86 86
87QString IRCServerTab::title() { 87QString IRCServerTab::title() {
88 return "Server"; 88 return "Server";
89} 89}
90 90
91IRCSession *IRCServerTab::session() { 91IRCSession *IRCServerTab::session() {
92 return m_session; 92 return m_session;
93} 93}
94/* 94/*
95QString *IRCServerTab::mynick() { 95QString *IRCServerTab::mynick() {
96 return (*m_server->nick()); 96 return (*m_server->nick());
97} */ 97} */
98 98
99IRCServer *IRCServerTab::server() { 99IRCServer *IRCServerTab::server() {
100 return &m_server; 100 return &m_server;
101} 101}
102 102
103void IRCServerTab::settingsChanged() { 103void IRCServerTab::settingsChanged() {
104 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 104 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
105 m_lines = 0; 105 m_lines = 0;
106} 106}
107 107
108void IRCServerTab::executeCommand(IRCTab *tab, QString line) { 108void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
109 QTextIStream stream(&line); 109 QTextIStream stream(&line);
110 QString command; 110 QString command;
111 stream >> command; 111 stream >> command;
112 command = command.upper().right(command.length()-1); 112 command = command.upper().right(command.length()-1);
113 113
114 //JOIN 114 //JOIN
115 if (command == "JOIN" || command == "J") { 115 if (command == "JOIN" || command == "J") {
116 QString channel; 116 QString channel;
117 stream >> channel; 117 stream >> channel;
118 /* According to RFC 1459 */ 118 /* According to RFC 1459 */
119 if (channel.length() > 0 && channel.length() < 200 && 119 if (channel.length() > 0 && channel.length() < 200 &&
120 channel.find(",") == -1 && channel.find("") == -1) { 120 channel.find(",") == -1 && channel.find('\007') == -1) {
121 121
122 if (!channel.startsWith("#") && !channel.startsWith("&")) { 122 if (!channel.startsWith("#") && !channel.startsWith("&")
123 && !channel.startsWith("+") && !channel.startsWith("!")) {
123 channel = channel.prepend("#"); 124 channel = channel.prepend("#");
124 } 125 }
125 m_session->join(channel); 126 m_session->join(channel);
126 } else { 127 } else {
127 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); 128 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
128 } 129 }
129 } 130 }
130 131
131 //KICK 132 //KICK
132 else if (command == "KICK"){ 133 else if (command == "KICK"){
133 QString nickname; 134 QString nickname;
134 stream >> nickname; 135 stream >> nickname;
135 if (nickname.length() > 0) { 136 if (nickname.length() > 0) {
136 if (line.length() > 7 + nickname.length()) { 137 if (line.length() > 7 + nickname.length()) {
137 QString text = line.right(line.length()-nickname.length()-7); 138 QString text = line.right(line.length()-nickname.length()-7);
138 IRCPerson person; 139 IRCPerson person;
139 person.setNick(nickname); 140 person.setNick(nickname);
140 m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); 141 m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
141 } else { 142 } else {
142 IRCPerson person; 143 IRCPerson person;
143 person.setNick(nickname); 144 person.setNick(nickname);
144 m_session->kick(((IRCChannelTab *)tab)->channel(), &person); 145 m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
145 } 146 }
146 } 147 }
147 } 148 }
148 149
149 else if (command == "OP"){ 150 else if (command == "OP"){
150 QString nickname; 151 QString nickname;
151 stream >> nickname; 152 stream >> nickname;
152 if (nickname.length() > 0) { 153 if (nickname.length() > 0) {
153 QString text = line.right(line.length()-nickname.length()-5); 154 QString text = line.right(line.length()-nickname.length()-5);
154 IRCPerson person; 155 IRCPerson person;
155 person.setNick(nickname); 156 person.setNick(nickname);
156 m_session->op(((IRCChannelTab *)tab)->channel(), &person); 157 m_session->op(((IRCChannelTab *)tab)->channel(), &person);
157 } 158 }
158 } 159 }
159 160
160 //SEND MODES 161 //SEND MODES
161 else if (command == "MODE"){ 162 else if (command == "MODE"){
162 QString text = line.right(line.length()-6); 163 QString text = line.right(line.length()-6);
163 if (text.length() > 0) { 164 if (text.length() > 0) {
164 m_session->mode(text); 165 m_session->mode(text);
165 } else { 166 } else {
166 tab->appendText("<font color=\"" + m_errorColor + "\">/mode channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask]<br>/mode nickname {[+|-]|i|w|s|o}</font><br>"); 167 tab->appendText("<font color=\"" + m_errorColor + "\">/mode channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask]<br>/mode nickname {[+|-]|i|w|s|o}</font><br>");
167 } 168 }
168 } 169 }
169 //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want 170 //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want
170 else if (command == "RAW"){ 171 else if (command == "RAW"){
171 QString text = line.right(line.length()-5); 172 QString text = line.right(line.length()-5);
172 if (text.length() > 0) { 173 if (text.length() > 0) {
173 m_session->raw(text); 174 m_session->raw(text);
174 } 175 }
175 } 176 }
176 else if (command == "SUSPEND"){ 177 else if (command == "SUSPEND"){
177 QString text = line.right(line.length()-9); 178 QString text = line.right(line.length()-9);
178 if (text.upper() == "ON") { 179 if (text.upper() == "ON") {
179 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 180 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
180 } 181 }
181 else if (text.upper() == "OFF"){ 182 else if (text.upper() == "OFF"){
182 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; 183 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
183 } else { 184 } else {
184 tab->appendText("<font color=\"" + m_errorColor + "\">Line: "+ line +"</font><br>Text: "+text); 185 tab->appendText("<font color=\"" + m_errorColor + "\">Line: "+ line +"</font><br>Text: "+text);
185 } 186 }
186 } 187 }
187 188
188 else if (command == "QUIT"){ 189 else if (command == "QUIT"){
189 QString text = line.right(line.length()-6); 190 QString text = line.right(line.length()-6);
190 if (text.length() > 0) { 191 if (text.length() > 0) {
191 m_session->quit(text); 192 m_session->quit(text);
192 } else { 193 } else {
193 m_session->quit(); 194 m_session->quit();
194 } 195 }
195 } 196 }
196 197
197 //SEND ACTION 198 //SEND ACTION
198 else if (command == "ME") { 199 else if (command == "ME") {
199 QString text = line.right(line.length()-4); 200 QString text = line.right(line.length()-4);
200 if (text.length() > 0) { 201 if (text.length() > 0) {
201 if (tab->isA("IRCChannelTab")) { 202 if (tab->isA("IRCChannelTab")) {
202 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 203 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
203 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); 204 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text);
204 } else if (tab->isA("IRCQueryTab")) { 205 } else if (tab->isA("IRCQueryTab")) {
205 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 206 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
206 m_session->sendAction(((IRCQueryTab *)tab)->person(), text); 207 m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
207 } else { 208 } else {
208 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); 209 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
209 } 210 }
210 } 211 }
211 } 212 }
212 //SEND PRIVMSG 213 //SEND PRIVMSG
213 else if (command == "MSG") { 214 else if (command == "MSG") {
214 QString nickname; 215 QString nickname;
215 stream >> nickname; 216 stream >> nickname;
216 if (nickname.length() > 0) { 217 if (nickname.length() > 0) {
217 if (line.length() > 6 + nickname.length()) { 218 if (line.length() > 6 + nickname.length()) {
218 QString text = line.right(line.length()-nickname.length()-6); 219 QString text = line.right(line.length()-nickname.length()-6);
219 IRCPerson person; 220 IRCPerson person;
220 person.setNick(nickname); 221 person.setNick(nickname);
221 tab->appendText("<font color=\"" + m_textColor + "\">&gt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">&lt; "+IRCOutput::toHTML(text)+"</font><br>"); 222 tab->appendText("<font color=\"" + m_textColor + "\">&gt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">&lt; "+IRCOutput::toHTML(text)+"</font><br>");
222 m_session->sendMessage(&person, text); 223 m_session->sendMessage(&person, text);
223 } 224 }
224 } 225 }
225 } 226 }
226 else { 227 else {
227 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>"); 228 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
228 } 229 }
229} 230}
230 231
231void IRCServerTab::processCommand() { 232void IRCServerTab::processCommand() {
232 QString text = m_field->text(); 233 QString text = m_field->text();
233 if (text.startsWith("/") && !text.startsWith("//")) { 234 if (text.startsWith("/") && !text.startsWith("//")) {
234 /* Command mode */ 235 /* Command mode */
235 executeCommand(this, text); 236 executeCommand(this, text);
236 } 237 }
237 m_field->clear(); 238 m_field->clear();
238} 239}
239 240
240void IRCServerTab::doConnect() { 241void IRCServerTab::doConnect() {
241 m_session->beginSession(); 242 m_session->beginSession();
242} 243}
243 244
244void IRCServerTab::remove() { 245void IRCServerTab::remove() {
245 /* Close requested */ 246 /* Close requested */
246 if (m_session->isSessionActive()) { 247 if (m_session->isSessionActive()) {
247 /* While there is a running session */ 248 /* While there is a running session */
248 m_close = TRUE; 249 m_close = TRUE;
249 m_session->endSession(); 250 m_session->endSession();
250 } else { 251 } else {
251 /* Session has previously been closed */ 252 /* Session has previously been closed */
252 m_channelTabs.first(); 253 m_channelTabs.first();
253 while (m_channelTabs.current() != 0) { 254 while (m_channelTabs.current() != 0) {
254 m_mainWindow->killTab(m_channelTabs.current(), true); 255 m_mainWindow->killTab(m_channelTabs.current(), true);
255 } 256 }
256 m_queryTabs.first(); 257 m_queryTabs.first();
257 while (m_queryTabs.current() != 0) { 258 while (m_queryTabs.current() != 0) {
258 m_mainWindow->killTab(m_queryTabs.current(), true); 259 m_mainWindow->killTab(m_queryTabs.current(), true);
259 } 260 }
260 m_mainWindow->killTab(this); 261 m_mainWindow->killTab(this);
261 } 262 }
262} 263}
263 264
264IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { 265IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) {
265 QListIterator<IRCChannelTab> it(m_channelTabs); 266 QListIterator<IRCChannelTab> it(m_channelTabs);
266 267
267 for (; it.current(); ++it) { 268 for (; it.current(); ++it) {
268 if (it.current()->channel() == channel) 269 if (it.current()->channel() == channel)
269 return it.current(); 270 return it.current();
270 } 271 }
271 return 0; 272 return 0;
272} 273}
273 274
274IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) { 275IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) {
275 QListIterator<IRCQueryTab> it(m_queryTabs); 276 QListIterator<IRCQueryTab> it(m_queryTabs);
276 277
277 for (; it.current(); ++it) { 278 for (; it.current(); ++it) {
278 if (it.current()->person()->nick() == person->nick()) 279 if (it.current()->person()->nick() == person->nick())
279 return it.current(); 280 return it.current();
280 } 281 }
281 return 0; 282 return 0;
282} 283}
283 284
284void IRCServerTab::display(IRCOutput output) { 285void IRCServerTab::display(IRCOutput output) {
285 286
286 /* All messages to be displayed inside the GUI get here */ 287 /* All messages to be displayed inside the GUI get here */
287 switch (output.type()) { 288 switch (output.type()) {
288 case OUTPUT_CONNCLOSE: 289 case OUTPUT_CONNCLOSE:
289 if (m_close) { 290 if (m_close) {
290 m_channelTabs.first(); 291 m_channelTabs.first();
291 while (m_channelTabs.current() != 0) { 292 while (m_channelTabs.current() != 0) {
292 m_mainWindow->killTab(m_channelTabs.current(), true); 293 m_mainWindow->killTab(m_channelTabs.current(), true);
293 } 294 }
294 m_queryTabs.first(); 295 m_queryTabs.first();
295 while (m_queryTabs.current() != 0) { 296 while (m_queryTabs.current() != 0) {
296 m_mainWindow->killTab(m_queryTabs.current(), true); 297 m_mainWindow->killTab(m_queryTabs.current(), true);
297 } 298 }
298 m_mainWindow->killTab(this); 299 m_mainWindow->killTab(this);
299 } else { 300 } else {
300 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() +"</font><br>"); 301 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() +"</font><br>");
301 QListIterator<IRCChannelTab> it(m_channelTabs); 302 QListIterator<IRCChannelTab> it(m_channelTabs);
302 for (; it.current(); ++it) { 303 for (; it.current(); ++it) {
303 it.current()->appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() +"</font><br>"); 304 it.current()->appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() +"</font><br>");
304 } 305 }
305 } 306 }
306 break; 307 break;
307 case OUTPUT_SELFJOIN: { 308 case OUTPUT_SELFJOIN: {
308 IRCChannelTab *channeltab = new IRCChannelTab((IRCChannel *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); 309 IRCChannelTab *channeltab = new IRCChannelTab((IRCChannel *)output.getParam(0), this, m_mainWindow, (QWidget *)parent());
309 m_channelTabs.append(channeltab); 310 m_channelTabs.append(channeltab);
310 m_mainWindow->addTab(channeltab); 311 m_mainWindow->addTab(channeltab);
311 } 312 }
312 break; 313 break;
313 case OUTPUT_CHANPRIVMSG: { 314 case OUTPUT_CHANPRIVMSG: {
314 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 315 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
315 channelTab->appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->nick())+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage()+"</font><br>"); 316 channelTab->appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->nick())+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage()+"</font><br>");
316 } 317 }
317 break; 318 break;
318 case OUTPUT_QUERYACTION: 319 case OUTPUT_QUERYACTION:
319 case OUTPUT_QUERYPRIVMSG: { 320 case OUTPUT_QUERYPRIVMSG: {
320 IRCQueryTab *queryTab = getTabForQuery((IRCPerson *)output.getParam(0)); 321 IRCQueryTab *queryTab = getTabForQuery((IRCPerson *)output.getParam(0));
321 if (!queryTab) { 322 if (!queryTab) {
322 queryTab = new IRCQueryTab((IRCPerson *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); 323 queryTab = new IRCQueryTab((IRCPerson *)output.getParam(0), this, m_mainWindow, (QWidget *)parent());
323 m_queryTabs.append(queryTab); 324 m_queryTabs.append(queryTab);
324 m_mainWindow->addTab(queryTab); 325 m_mainWindow->addTab(queryTab);
325 } 326 }
326 queryTab->display(output); 327 queryTab->display(output);
327 } 328 }
328 break; 329 break;
329 case OUTPUT_SELFPART: { 330 case OUTPUT_SELFPART: {
330 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 331 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
331 if (channelTab) 332 if (channelTab)
332 m_mainWindow->killTab(channelTab, true); 333 m_mainWindow->killTab(channelTab, true);
333 } 334 }
334 break; 335 break;
335 case OUTPUT_SELFKICK: { 336 case OUTPUT_SELFKICK: {
336 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>"); 337 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>");
337 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 338 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
338 if (channelTab) 339 if (channelTab)
339 m_mainWindow->killTab(channelTab, true); 340 m_mainWindow->killTab(channelTab, true);
340 } 341 }
341 break; 342 break;
342 case OUTPUT_CHANACTION: { 343 case OUTPUT_CHANACTION: {
343 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 344 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
344 channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>"); 345 channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>");
345 } 346 }
346 break; 347 break;
347 case OUTPUT_TOPIC: { 348 case OUTPUT_TOPIC: {
348 IRCChannel *channel = (IRCChannel *) output.getParam(0); 349 IRCChannel *channel = (IRCChannel *) output.getParam(0);
349 if (channel) { 350 if (channel) {
350 IRCChannelTab *channelTab = getTabForChannel(channel); 351 IRCChannelTab *channelTab = getTabForChannel(channel);
351 if (channelTab) { 352 if (channelTab) {
352 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 353 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
353 return; 354 return;
354 } 355 }
355 } 356 }
356 IRCChannelTab::enqueue(channel->channelname(), "<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 357 IRCChannelTab::enqueue(channel->channelname(), "<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
357 } 358 }
358 break; 359 break;
359 case OUTPUT_QUIT: { 360 case OUTPUT_QUIT: {
360 QString nick = ((IRCPerson *)output.getParam(0))->nick(); 361 QString nick = ((IRCPerson *)output.getParam(0))->nick();
361 QListIterator<IRCChannelTab> it(m_channelTabs); 362 QListIterator<IRCChannelTab> it(m_channelTabs);
362 for (; it.current(); ++it) { 363 for (; it.current(); ++it) {
363 if (it.current()->list()->hasPerson(nick)) { 364 if (it.current()->list()->hasPerson(nick)) {
364 it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 365 it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
365 it.current()->list()->update(); 366 it.current()->list()->update();
366 } 367 }
367 } 368 }
368 } 369 }
369 break; 370 break;
370 case OUTPUT_NICKCHANGE: { 371 case OUTPUT_NICKCHANGE: {
371 QString *nick = static_cast<QString*>(output.getParam(0)); 372 QString *nick = static_cast<QString*>(output.getParam(0));
372 if(!nick) { 373 if(!nick) {
373 appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 374 appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
374 break; 375 break;
375 } 376 }
376 QListIterator<IRCChannelTab> it(m_channelTabs); 377 QListIterator<IRCChannelTab> it(m_channelTabs);
377 for (; it.current(); ++it) { 378 for (; it.current(); ++it) {
378 if (it.current()->list()->hasPerson(*nick)) { 379 if (it.current()->list()->hasPerson(*nick)) {
379 it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 380 it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
380 } 381 }
381 } 382 }
382 delete nick; 383 delete nick;
383 } 384 }
384 break; 385 break;
385 case OUTPUT_OTHERJOIN: 386 case OUTPUT_OTHERJOIN:
386 case OUTPUT_OTHERKICK: 387 case OUTPUT_OTHERKICK:
387 case OUTPUT_CHANPERSONMODE: 388 case OUTPUT_CHANPERSONMODE:
388 case OUTPUT_OTHERPART: { 389 case OUTPUT_OTHERPART: {
389 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 390 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
390 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); 391 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
391 channelTab->list()->update(); 392 channelTab->list()->update();
392 } 393 }
393 break; 394 break;
394 case OUTPUT_CTCP: 395 case OUTPUT_CTCP:
395 appendText("<font color=\"" + m_notificationColor + "\">" + output.htmlMessage() + "</font><br>"); 396 appendText("<font color=\"" + m_notificationColor + "\">" + output.htmlMessage() + "</font><br>");
396 break; 397 break;
397 case OUTPUT_ERROR: 398 case OUTPUT_ERROR:
398 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>"); 399 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>");
399 break; 400 break;
400 case OUTPUT_TITLE: 401 case OUTPUT_TITLE:
401 m_description->setText(output.message()); 402 m_description->setText(output.message());
402 break; 403 break;
403 default: 404 default:
404 appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() + "</font><br>"); 405 appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() + "</font><br>");
405 break; 406 break;
406 } 407 }
407} 408}
408 409
409void IRCServerTab::slotUpdateChannels() { 410void IRCServerTab::slotUpdateChannels() {
410 QListIterator<IRCChannelTab> it(m_channelTabs); 411 QListIterator<IRCChannelTab> it(m_channelTabs);
411 for (; it.current(); ++it) { 412 for (; it.current(); ++it) {
412 it.current()->list()->update(); 413 it.current()->list()->update();
413 } 414 }
414} 415}
415 416
416MainWindow *IRCServerTab::mainwindow() { 417MainWindow *IRCServerTab::mainwindow() {
417 return m_mainWindow; 418 return m_mainWindow;
418} 419}
419 420