Diffstat (limited to 'noncore/net/opieirc/ircservertab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index e031d4d..90353f2 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -17,7 +17,7 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
17 | m_mainWindow = mainWindow; | 17 | m_mainWindow = mainWindow; |
18 | m_close = FALSE; | 18 | m_close = FALSE; |
19 | m_lines = 0; | 19 | m_lines = 0; |
20 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); | 20 | m_description->setText(tr("Connecting to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); |
21 | m_textview = new QTextView(this); | 21 | m_textview = new QTextView(this); |
22 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 22 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
23 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 23 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
@@ -35,6 +35,7 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
35 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 35 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
36 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); | 36 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); |
37 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 37 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
38 | connect(m_session, SIGNAL(updateChannels()), this, SLOT(slotUpdateChannels())); | ||
38 | settingsChanged(); | 39 | settingsChanged(); |
39 | 40 | ||
40 | m_field->setFocus(); | 41 | m_field->setFocus(); |
@@ -113,7 +114,13 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
113 | if (command == "JOIN" || command == "J") { | 114 | if (command == "JOIN" || command == "J") { |
114 | QString channel; | 115 | QString channel; |
115 | stream >> channel; | 116 | stream >> channel; |
116 | if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { | 117 | /* According to RFC 1459 */ |
118 | if (channel.length() > 0 && channel.length() < 200 && | ||
119 | channel.find(",") == -1 && channel.find("") == -1) { | ||
120 | |||
121 | if (!channel.startsWith("#") && !channel.startsWith("&")) { | ||
122 | channel = channel.prepend("#"); | ||
123 | } | ||
117 | m_session->join(channel); | 124 | m_session->join(channel); |
118 | } else { | 125 | } else { |
119 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); | 126 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); |
@@ -345,7 +352,7 @@ void IRCServerTab::display(IRCOutput output) { | |||
345 | return; | 352 | return; |
346 | } | 353 | } |
347 | } | 354 | } |
348 | appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); | 355 | IRCChannelTab::enqueue(channel->channelname(), "<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); |
349 | } | 356 | } |
350 | break; | 357 | break; |
351 | case OUTPUT_QUIT: { | 358 | case OUTPUT_QUIT: { |
@@ -359,19 +366,22 @@ void IRCServerTab::display(IRCOutput output) { | |||
359 | } | 366 | } |
360 | } | 367 | } |
361 | break; | 368 | break; |
362 | /* case OUTPUT_NICKCHANGE: { | 369 | case OUTPUT_NICKCHANGE: { |
363 | //WAS HERE | 370 | QString *nick = static_cast<QString*>(output.getParam(0)); |
364 | QString nick = ((IRCPerson *)output.getParam(0))->nick(); | 371 | if(!nick) { |
372 | appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); | ||
373 | break; | ||
374 | } | ||
365 | QListIterator<IRCChannelTab> it(m_channelTabs); | 375 | QListIterator<IRCChannelTab> it(m_channelTabs); |
366 | for (; it.current(); ++it) { | 376 | for (; it.current(); ++it) { |
367 | if (it.current()->list()->hasPerson(nick)) { | 377 | if (it.current()->list()->hasPerson(*nick)) { |
368 | it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); | 378 | it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>"); |
369 | it.current()->list()->update(); | ||
370 | } | 379 | } |
371 | } | 380 | } |
381 | delete nick; | ||
372 | } | 382 | } |
373 | break; | 383 | break; |
374 | */ case OUTPUT_OTHERJOIN: | 384 | case OUTPUT_OTHERJOIN: |
375 | case OUTPUT_OTHERKICK: | 385 | case OUTPUT_OTHERKICK: |
376 | case OUTPUT_CHANPERSONMODE: | 386 | case OUTPUT_CHANPERSONMODE: |
377 | case OUTPUT_OTHERPART: { | 387 | case OUTPUT_OTHERPART: { |
@@ -386,8 +396,19 @@ void IRCServerTab::display(IRCOutput output) { | |||
386 | case OUTPUT_ERROR: | 396 | case OUTPUT_ERROR: |
387 | appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>"); | 397 | appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>"); |
388 | break; | 398 | break; |
399 | case OUTPUT_TITLE: | ||
400 | m_description->setText(output.message()); | ||
401 | break; | ||
389 | default: | 402 | default: |
390 | appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() + "</font><br>"); | 403 | appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() + "</font><br>"); |
391 | break; | 404 | break; |
392 | } | 405 | } |
393 | } | 406 | } |
407 | |||
408 | void IRCServerTab::slotUpdateChannels() { | ||
409 | QListIterator<IRCChannelTab> it(m_channelTabs); | ||
410 | for (; it.current(); ++it) { | ||
411 | it.current()->list()->update(); | ||
412 | } | ||
413 | } | ||
414 | |||