summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp8
-rw-r--r--noncore/net/opieirc/ircchanneltab.h1
-rw-r--r--noncore/net/opieirc/ircquerytab.cpp6
-rw-r--r--noncore/net/opieirc/ircquerytab.h1
-rw-r--r--noncore/net/opieirc/ircservertab.cpp111
-rw-r--r--noncore/net/opieirc/ircservertab.h6
-rw-r--r--noncore/net/opieirc/ircsession.cpp37
-rw-r--r--noncore/net/opieirc/ircsession.h10
-rw-r--r--noncore/net/opieirc/mainwindow.cpp5
-rw-r--r--noncore/net/opieirc/mainwindow.h4
10 files changed, 172 insertions, 17 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index c1964c8..beb8bce 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -32,5 +32,4 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &)));
-
/* Construct the popup menu */
QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
@@ -40,5 +39,5 @@ 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();
@@ -49,4 +48,8 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
}
+void IRCChannelTab::scrolling(){
+ m_textview->ensureVisible(0, m_textview->contentsHeight());
+}
+
void IRCChannelTab::appendText(QString text) {
/* not using append because it creates layout problems */
@@ -130,4 +133,5 @@ void IRCChannelTab::popupQuery() {
void IRCChannelTab::popupPing() {
+ //HAHA, no wonder these don't work
}
diff --git a/noncore/net/opieirc/ircchanneltab.h b/noncore/net/opieirc/ircchanneltab.h
index a03ee3e..001c96d 100644
--- a/noncore/net/opieirc/ircchanneltab.h
+++ b/noncore/net/opieirc/ircchanneltab.h
@@ -48,4 +48,5 @@ public slots:
void remove();
void settingsChanged();
+ void scrolling();
protected slots:
void processCommand();
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp
index 21a53dc..a113b04 100644
--- a/noncore/net/opieirc/ircquerytab.cpp
+++ b/noncore/net/opieirc/ircquerytab.cpp
@@ -23,7 +23,13 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
m_field->setFocus();
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
+ connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
settingsChanged();
}
+void IRCQueryTab::scrolling(){
+ m_textview->ensureVisible(0, m_textview->contentsHeight());
+}
+
+
void IRCQueryTab::appendText(QString text) {
/* not using append because it creates layout problems */
diff --git a/noncore/net/opieirc/ircquerytab.h b/noncore/net/opieirc/ircquerytab.h
index f9cc8e1..b3b04fb 100644
--- a/noncore/net/opieirc/ircquerytab.h
+++ b/noncore/net/opieirc/ircquerytab.h
@@ -38,4 +38,5 @@ public:
void appendText(QString text);
public slots:
+ void scrolling();
void remove();
void processCommand();
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 5aa447f..1d9520a 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -23,7 +23,13 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
m_field->setFocus();
connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
+ connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
settingsChanged();
}
+void IRCServerTab::scrolling(){
+ m_textview->ensureVisible(0, m_textview->contentsHeight());
+}
+
+
void IRCServerTab::appendText(QString text) {
/* not using append because it creates layout problems */
@@ -65,4 +71,8 @@ IRCSession *IRCServerTab::session() {
return m_session;
}
+/*
+QString *IRCServerTab::mynick() {
+ return (*m_server->nick());
+} */
IRCServer *IRCServerTab::server() {
@@ -80,6 +90,7 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
stream >> command;
command = command.upper().right(command.length()-1);
-
- if (command == "JOIN") {
+
+ //JOIN
+ if (command == "JOIN" || command == "J") {
QString channel;
stream >> channel;
@@ -87,7 +98,82 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
m_session->join(channel);
} else {
- tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
+ tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
}
- } else if (command == "ME") {
+ }
+
+ //KICK
+ else if (command == "KICK"){
+ QString nickname;
+ stream >> nickname;
+ if (nickname.length() > 0) {
+ if (line.length() > 7 + nickname.length()) {
+ QString text = line.right(line.length()-nickname.length()-7);
+ IRCPerson person;
+ person.setNick(nickname);
+ m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
+ } else {
+ IRCPerson person;
+ person.setNick(nickname);
+ m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
+ }
+ }
+ }
+
+ else if (command == "OP"){
+ QString nickname;
+ stream >> nickname;
+ if (nickname.length() > 0) {
+ if (line.length() > 7 + nickname.length()) {
+ QString text = line.right(line.length()-nickname.length()-7);
+ IRCPerson person;
+ person.setNick(nickname);
+ m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
+ } else {
+ IRCPerson person;
+ person.setNick(nickname);
+ m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
+ }
+ }
+ }
+
+ //SEND MODES
+ else if (command == "MODE"){
+ QString text = line.right(line.length()-6);
+ if (text.length() > 0) {
+ m_session->mode(text);
+ } else {
+ 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>");
+ }
+ }
+ //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want
+ else if (command == "RAW"){
+ QString text = line.right(line.length()-5);
+ if (text.length() > 0) {
+ m_session->raw(text);
+ }
+ }
+ else if (command == "SUSPEND"){
+ QString text = line.right(line.length()-9);
+ if (text.upper() == "ON") {
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+ }
+ else if (text.upper() == "OFF"){
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
+ } else {
+ tab->appendText("<font color=\"" + m_errorColor + "\">Line: "+ line +"</font><br>Text: "+text);
+ }
+ }
+
+ else if (command == "QUIT"){
+ QString text = line.right(line.length()-6);
+ if (text.length() > 0) {
+ m_session->quit(text);
+ } else {
+ m_session->quit();
+ }
+ }
+
+ //SEND ACTION
+ else if (command == "ME") {
QString text = line.right(line.length()-4);
if (text.length() > 0) {
@@ -99,8 +185,10 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
} else {
- tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
+ tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
}
}
- } else if (command == "MSG") {
+ }
+ //SEND PRIVMSG
+ else if (command == "MSG") {
QString nickname;
stream >> nickname;
@@ -113,7 +201,8 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
m_session->sendMessage(&person, text);
}
- }
- } else {
- tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
+ }
+ }
+ else {
+ tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
}
}
@@ -154,5 +243,5 @@ void IRCServerTab::remove() {
IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) {
QListIterator<IRCChannelTab> it(m_channelTabs);
-
+
for (; it.current(); ++it) {
if (it.current()->channel() == channel)
@@ -164,5 +253,5 @@ 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())
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h
index 8d24cba..48200d7 100644
--- a/noncore/net/opieirc/ircservertab.h
+++ b/noncore/net/opieirc/ircservertab.h
@@ -21,5 +21,6 @@
#ifndef __IRCSERVERTAB_H
#define __IRCSERVERTAB_H
-
+#include <qpe/qpeapplication.h>
+#include <qpe/qcopenvelope_qws.h>
#include "irctab.h"
#include "ircsession.h"
@@ -29,4 +30,5 @@
#include "ircmisc.h"
+
class IRCServerTab : public IRCTab {
Q_OBJECT
@@ -41,4 +43,5 @@ public:
/* Start the server session */
void doConnect();
+// QString *mynick();
/* Remove tabs from the internal tab lists */
void removeChannelTab(IRCChannelTab *tab);
@@ -54,4 +57,5 @@ protected:
void appendText(QString text);
public slots:
+ void scrolling();
void remove();
void processCommand();
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp
index 122a943..1cc1ee2 100644
--- a/noncore/net/opieirc/ircsession.cpp
+++ b/noncore/net/opieirc/ircsession.cpp
@@ -29,4 +29,40 @@ void IRCSession::join(QString channelname) {
}
+void IRCSession::quit(){
+ m_connection->sendLine("QUIT :[OI] I'm too good to need a reason");
+}
+
+void IRCSession::quit(QString message){
+ m_connection->sendLine("QUIT :" + message);
+}
+
+void IRCSession::topic(IRCChannel *channel, QString message){
+ m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message);
+}
+
+void IRCSession::mode(IRCChannel *channel, QString message){
+ m_connection->sendLine("MODE " + channel->channelname() + " " + message);
+}
+
+void IRCSession::mode(IRCPerson *person, QString message){
+ m_connection->sendLine("MODE " + person->nick() + " " + message);
+}
+
+void IRCSession::mode(QString message){
+ m_connection->sendLine("MODE " + message);
+}
+
+void IRCSession::raw(QString message){
+ m_connection->sendLine(message);
+}
+
+void IRCSession::kick(IRCChannel *channel, IRCPerson *person) {
+ m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason");
+}
+
+void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) {
+ m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message);
+}
+
void IRCSession::sendMessage(IRCPerson *person, QString message) {
m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message);
@@ -109,3 +145,2 @@ void IRCSession::handleMessage(IRCMessage *message) {
m_parser->parse(message);
}
-
diff --git a/noncore/net/opieirc/ircsession.h b/noncore/net/opieirc/ircsession.h
index aa4bed3..a6a3e50 100644
--- a/noncore/net/opieirc/ircsession.h
+++ b/noncore/net/opieirc/ircsession.h
@@ -44,9 +44,17 @@ public:
void join(QString channel);
+ void quit(QString message);
+ void quit();
+ void raw(QString message);
+ void topic(IRCChannel *channel, QString message);
+ void mode(IRCChannel *channel, QString message);
+ void mode(IRCPerson *person, QString message);
+ void mode(QString message);
void part(IRCChannel *channel);
+ void kick(IRCChannel *channel, IRCPerson *person);
+ void kick(IRCChannel *channel, IRCPerson *person, QString message);
void beginSession();
bool isSessionActive();
void endSession();
-
void sendMessage(IRCPerson *person, QString message);
void sendMessage(IRCChannel *channel, QString message);
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 3ed29e3..8f76cdd 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -31,4 +31,8 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
}
+/*IRCTabWidget MainWindow::getTabWidget(){
+ return m_tabWidget;
+} */
+
void MainWindow::loadSettings() {
Config config("OpieIRC");
@@ -46,4 +50,5 @@ void MainWindow::loadSettings() {
void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
+ emit updateScroll();
}
diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h
index 9946f10..bd1a9ce 100644
--- a/noncore/net/opieirc/mainwindow.h
+++ b/noncore/net/opieirc/mainwindow.h
@@ -33,7 +33,9 @@ class MainWindow : public QMainWindow {
public:
MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
-
+// IRCTabWidget getTabWidget();
void addTab(IRCTab *tab);
void killTab(IRCTab *tab);
+signals:
+ void updateScroll();
protected slots:
void newConnection();