summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (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
@@ -31,7 +31,6 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
/* Required so that embedded-style "right" clicks work */
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);
m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
@@ -39,7 +38,7 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
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();
m_layout->add(m_field);
@@ -48,6 +47,10 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
settingsChanged();
}
+void IRCChannelTab::scrolling(){
+ m_textview->ensureVisible(0, m_textview->contentsHeight());
+}
+
void IRCChannelTab::appendText(QString text) {
/* not using append because it creates layout problems */
QString txt = m_textview->text() + text + "\n";
@@ -129,6 +132,7 @@ void IRCChannelTab::popupQuery() {
}
void IRCChannelTab::popupPing() {
+ //HAHA, no wonder these don't work
}
void IRCChannelTab::popupVersion() {
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
@@ -47,6 +47,7 @@ public:
public slots:
void remove();
void settingsChanged();
+ void scrolling();
protected slots:
void processCommand();
void toggleList();
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
@@ -22,9 +22,15 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
m_layout->add(m_field);
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 */
QString txt = m_textview->text() + text + "\n";
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
@@ -37,6 +37,7 @@ public:
IRCPerson *person();
void appendText(QString text);
public slots:
+ void scrolling();
void remove();
void processCommand();
void display(IRCOutput output);
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
@@ -22,9 +22,15 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
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 */
QString txt = m_textview->text() + text + "\n";
@@ -64,6 +70,10 @@ QString IRCServerTab::title() {
IRCSession *IRCServerTab::session() {
return m_session;
}
+/*
+QString *IRCServerTab::mynick() {
+ return (*m_server->nick());
+} */
IRCServer *IRCServerTab::server() {
return &m_server;
@@ -79,16 +89,92 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
QString command;
stream >> command;
command = command.upper().right(command.length()-1);
-
- if (command == "JOIN") {
+
+ //JOIN
+ if (command == "JOIN" || command == "J") {
QString channel;
stream >> channel;
if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) {
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) {
if (tab->isA("IRCChannelTab")) {
@@ -98,10 +184,12 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
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;
if (nickname.length() > 0) {
@@ -112,9 +200,10 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
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>");
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>");
}
}
@@ -153,7 +242,7 @@ void IRCServerTab::remove() {
IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) {
QListIterator<IRCChannelTab> it(m_channelTabs);
-
+
for (; it.current(); ++it) {
if (it.current()->channel() == channel)
return it.current();
@@ -163,7 +252,7 @@ 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();
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
@@ -20,7 +20,8 @@
#ifndef __IRCSERVERTAB_H
#define __IRCSERVERTAB_H
-
+#include <qpe/qpeapplication.h>
+#include <qpe/qcopenvelope_qws.h>
#include "irctab.h"
#include "ircsession.h"
#include "mainwindow.h"
@@ -28,6 +29,7 @@
#include "ircquerytab.h"
#include "ircmisc.h"
+
class IRCServerTab : public IRCTab {
Q_OBJECT
public:
@@ -40,6 +42,7 @@ public:
/* Start the server session */
void doConnect();
+// QString *mynick();
/* Remove tabs from the internal tab lists */
void removeChannelTab(IRCChannelTab *tab);
void removeQueryTab(IRCQueryTab *tab);
@@ -53,6 +56,7 @@ public:
protected:
void appendText(QString text);
public slots:
+ void scrolling();
void remove();
void processCommand();
void settingsChanged();
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
@@ -28,6 +28,42 @@ void IRCSession::join(QString channelname) {
m_connection->sendLine("JOIN "+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);
}
@@ -108,4 +144,3 @@ void IRCSession::removePerson(IRCPerson *person) {
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
@@ -43,11 +43,19 @@ public:
~IRCSession();
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);
void sendAction(IRCPerson *person, 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
@@ -30,6 +30,10 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
loadSettings();
}
+/*IRCTabWidget MainWindow::getTabWidget(){
+ return m_tabWidget;
+} */
+
void MainWindow::loadSettings() {
Config config("OpieIRC");
config.setGroup("OpieIRC");
@@ -45,6 +49,7 @@ void MainWindow::loadSettings() {
void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
+ emit updateScroll();
}
void MainWindow::addTab(IRCTab *tab) {
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
@@ -32,9 +32,11 @@ class MainWindow : public QMainWindow {
Q_OBJECT
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();
void settings();