summaryrefslogtreecommitdiff
Unidiff
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
@@ -28,29 +28,32 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
28 QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); 28 QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion"));
29 m_popup = new QPopupMenu(m_list); 29 m_popup = new QPopupMenu(m_list);
30 m_lines = 0; 30 m_lines = 0;
31 /* Required so that embedded-style "right" clicks work */ 31 /* Required so that embedded-style "right" clicks work */
32 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); 32 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
33 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); 33 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &)));
34
35 /* Construct the popup menu */ 34 /* Construct the popup menu */
36 QPopupMenu *ctcpMenu = new QPopupMenu(m_list); 35 QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
37 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); 36 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
38 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); 37 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
39 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); 38 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
40 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); 39 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
41 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); 40 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
42 41 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
43 m_layout->add(hbox); 42 m_layout->add(hbox);
44 hbox->show(); 43 hbox->show();
45 m_layout->add(m_field); 44 m_layout->add(m_field);
46 m_field->setFocus(); 45 m_field->setFocus();
47 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 46 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
48 settingsChanged(); 47 settingsChanged();
49} 48}
50 49
50void IRCChannelTab::scrolling(){
51 m_textview->ensureVisible(0, m_textview->contentsHeight());
52}
53
51void IRCChannelTab::appendText(QString text) { 54void IRCChannelTab::appendText(QString text) {
52 /* not using append because it creates layout problems */ 55 /* not using append because it creates layout problems */
53 QString txt = m_textview->text() + text + "\n"; 56 QString txt = m_textview->text() + text + "\n";
54 if (m_maxLines > 0 && m_lines >= m_maxLines) { 57 if (m_maxLines > 0 && m_lines >= m_maxLines) {
55 int firstBreak = txt.find('\n'); 58 int firstBreak = txt.find('\n');
56 if (firstBreak != -1) { 59 if (firstBreak != -1) {
@@ -126,12 +129,13 @@ void IRCChannelTab::popupQuery() {
126 } 129 }
127 } 130 }
128 } 131 }
129} 132}
130 133
131void IRCChannelTab::popupPing() { 134void IRCChannelTab::popupPing() {
135 //HAHA, no wonder these don't work
132} 136}
133 137
134void IRCChannelTab::popupVersion() { 138void IRCChannelTab::popupVersion() {
135} 139}
136 140
137void IRCChannelTab::popupWhois() { 141void IRCChannelTab::popupWhois() {
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
@@ -44,12 +44,13 @@ public:
44 IRCChannelList *list(); 44 IRCChannelList *list();
45public: 45public:
46 void appendText(QString text); 46 void appendText(QString text);
47public slots: 47public slots:
48 void remove(); 48 void remove();
49 void settingsChanged(); 49 void settingsChanged();
50 void scrolling();
50protected slots: 51protected slots:
51 void processCommand(); 52 void processCommand();
52 void toggleList(); 53 void toggleList();
53 void mouseButtonPressed(int mouse, QListBoxItem *item, const QPoint &point); 54 void mouseButtonPressed(int mouse, QListBoxItem *item, const QPoint &point);
54 /* Popup slots */ 55 /* Popup slots */
55 void popupQuery(); 56 void popupQuery();
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
@@ -19,15 +19,21 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
19 QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person")); 19 QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person"));
20 m_layout->add(hbox); 20 m_layout->add(hbox);
21 hbox->show(); 21 hbox->show();
22 m_layout->add(m_field); 22 m_layout->add(m_field);
23 m_field->setFocus(); 23 m_field->setFocus();
24 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 24 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
25 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
25 settingsChanged(); 26 settingsChanged();
26} 27}
27 28
29void IRCQueryTab::scrolling(){
30 m_textview->ensureVisible(0, m_textview->contentsHeight());
31}
32
33
28void IRCQueryTab::appendText(QString text) { 34void IRCQueryTab::appendText(QString text) {
29 /* not using append because it creates layout problems */ 35 /* not using append because it creates layout problems */
30 QString txt = m_textview->text() + text + "\n"; 36 QString txt = m_textview->text() + text + "\n";
31 if (m_maxLines > 0 && m_lines >= m_maxLines) { 37 if (m_maxLines > 0 && m_lines >= m_maxLines) {
32 int firstBreak = txt.find('\n'); 38 int firstBreak = txt.find('\n');
33 if (firstBreak != -1) { 39 if (firstBreak != -1) {
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
@@ -34,12 +34,13 @@ public:
34 ~IRCQueryTab(); 34 ~IRCQueryTab();
35 QString title(); 35 QString title();
36 IRCSession *session(); 36 IRCSession *session();
37 IRCPerson *person(); 37 IRCPerson *person();
38 void appendText(QString text); 38 void appendText(QString text);
39public slots: 39public slots:
40 void scrolling();
40 void remove(); 41 void remove();
41 void processCommand(); 42 void processCommand();
42 void display(IRCOutput output); 43 void display(IRCOutput output);
43 void settingsChanged(); 44 void settingsChanged();
44protected: 45protected:
45 bool m_close; 46 bool m_close;
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
@@ -19,15 +19,21 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
19 m_field = new IRCHistoryLineEdit(this); 19 m_field = new IRCHistoryLineEdit(this);
20 QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); 20 QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
21 m_layout->add(m_field); 21 m_layout->add(m_field);
22 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 22 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
23 m_field->setFocus(); 23 m_field->setFocus();
24 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); 24 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
25 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
25 settingsChanged(); 26 settingsChanged();
26} 27}
27 28
29void IRCServerTab::scrolling(){
30 m_textview->ensureVisible(0, m_textview->contentsHeight());
31}
32
33
28void IRCServerTab::appendText(QString text) { 34void IRCServerTab::appendText(QString text) {
29 /* not using append because it creates layout problems */ 35 /* not using append because it creates layout problems */
30 QString txt = m_textview->text() + text + "\n"; 36 QString txt = m_textview->text() + text + "\n";
31 if (m_maxLines > 0 && m_lines >= m_maxLines) { 37 if (m_maxLines > 0 && m_lines >= m_maxLines) {
32 int firstBreak = txt.find('\n'); 38 int firstBreak = txt.find('\n');
33 if (firstBreak != -1) { 39 if (firstBreak != -1) {
@@ -61,12 +67,16 @@ QString IRCServerTab::title() {
61 return "Server"; 67 return "Server";
62} 68}
63 69
64IRCSession *IRCServerTab::session() { 70IRCSession *IRCServerTab::session() {
65 return m_session; 71 return m_session;
66} 72}
73/*
74QString *IRCServerTab::mynick() {
75 return (*m_server->nick());
76} */
67 77
68IRCServer *IRCServerTab::server() { 78IRCServer *IRCServerTab::server() {
69 return &m_server; 79 return &m_server;
70} 80}
71 81
72void IRCServerTab::settingsChanged() { 82void IRCServerTab::settingsChanged() {
@@ -76,48 +86,127 @@ void IRCServerTab::settingsChanged() {
76 86
77void IRCServerTab::executeCommand(IRCTab *tab, QString line) { 87void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
78 QTextIStream stream(&line); 88 QTextIStream stream(&line);
79 QString command; 89 QString command;
80 stream >> command; 90 stream >> command;
81 command = command.upper().right(command.length()-1); 91 command = command.upper().right(command.length()-1);
82 92
83 if (command == "JOIN") { 93 //JOIN
94 if (command == "JOIN" || command == "J") {
84 QString channel; 95 QString channel;
85 stream >> channel; 96 stream >> channel;
86 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { 97 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) {
87 m_session->join(channel); 98 m_session->join(channel);
88 } else { 99 } else {
89 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); 100 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
90 } 101 }
91 } else if (command == "ME") { 102 }
103
104 //KICK
105 else if (command == "KICK"){
106 QString nickname;
107 stream >> nickname;
108 if (nickname.length() > 0) {
109 if (line.length() > 7 + nickname.length()) {
110 QString text = line.right(line.length()-nickname.length()-7);
111 IRCPerson person;
112 person.setNick(nickname);
113 m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
114 } else {
115 IRCPerson person;
116 person.setNick(nickname);
117 m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
118 }
119 }
120 }
121
122 else if (command == "OP"){
123 QString nickname;
124 stream >> nickname;
125 if (nickname.length() > 0) {
126 if (line.length() > 7 + nickname.length()) {
127 QString text = line.right(line.length()-nickname.length()-7);
128 IRCPerson person;
129 person.setNick(nickname);
130 m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text);
131 } else {
132 IRCPerson person;
133 person.setNick(nickname);
134 m_session->kick(((IRCChannelTab *)tab)->channel(), &person);
135 }
136 }
137 }
138
139 //SEND MODES
140 else if (command == "MODE"){
141 QString text = line.right(line.length()-6);
142 if (text.length() > 0) {
143 m_session->mode(text);
144 } else {
145 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>");
146 }
147 }
148 //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want
149 else if (command == "RAW"){
150 QString text = line.right(line.length()-5);
151 if (text.length() > 0) {
152 m_session->raw(text);
153 }
154 }
155 else if (command == "SUSPEND"){
156 QString text = line.right(line.length()-9);
157 if (text.upper() == "ON") {
158 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
159 }
160 else if (text.upper() == "OFF"){
161 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
162 } else {
163 tab->appendText("<font color=\"" + m_errorColor + "\">Line: "+ line +"</font><br>Text: "+text);
164 }
165 }
166
167 else if (command == "QUIT"){
168 QString text = line.right(line.length()-6);
169 if (text.length() > 0) {
170 m_session->quit(text);
171 } else {
172 m_session->quit();
173 }
174 }
175
176 //SEND ACTION
177 else if (command == "ME") {
92 QString text = line.right(line.length()-4); 178 QString text = line.right(line.length()-4);
93 if (text.length() > 0) { 179 if (text.length() > 0) {
94 if (tab->isA("IRCChannelTab")) { 180 if (tab->isA("IRCChannelTab")) {
95 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 181 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
96 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); 182 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text);
97 } else if (tab->isA("IRCQueryTab")) { 183 } else if (tab->isA("IRCQueryTab")) {
98 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 184 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
99 m_session->sendAction(((IRCQueryTab *)tab)->person(), text); 185 m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
100 } else { 186 } else {
101 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); 187 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
102 } 188 }
103 } 189 }
104 } else if (command == "MSG") { 190 }
191 //SEND PRIVMSG
192 else if (command == "MSG") {
105 QString nickname; 193 QString nickname;
106 stream >> nickname; 194 stream >> nickname;
107 if (nickname.length() > 0) { 195 if (nickname.length() > 0) {
108 if (line.length() > 6 + nickname.length()) { 196 if (line.length() > 6 + nickname.length()) {
109 QString text = line.right(line.length()-nickname.length()-6); 197 QString text = line.right(line.length()-nickname.length()-6);
110 IRCPerson person; 198 IRCPerson person;
111 person.setNick(nickname); 199 person.setNick(nickname);
112 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>"); 200 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>");
113 m_session->sendMessage(&person, text); 201 m_session->sendMessage(&person, text);
114 } 202 }
115 } 203 }
116 } else { 204 }
117 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>"); 205 else {
206 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
118 } 207 }
119} 208}
120 209
121void IRCServerTab::processCommand() { 210void IRCServerTab::processCommand() {
122 QString text = m_field->text(); 211 QString text = m_field->text();
123 if (text.startsWith("/") && !text.startsWith("//")) { 212 if (text.startsWith("/") && !text.startsWith("//")) {
@@ -150,23 +239,23 @@ void IRCServerTab::remove() {
150 m_mainWindow->killTab(this); 239 m_mainWindow->killTab(this);
151 } 240 }
152} 241}
153 242
154IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { 243IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) {
155 QListIterator<IRCChannelTab> it(m_channelTabs); 244 QListIterator<IRCChannelTab> it(m_channelTabs);
156 245
157 for (; it.current(); ++it) { 246 for (; it.current(); ++it) {
158 if (it.current()->channel() == channel) 247 if (it.current()->channel() == channel)
159 return it.current(); 248 return it.current();
160 } 249 }
161 return 0; 250 return 0;
162} 251}
163 252
164IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) { 253IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) {
165 QListIterator<IRCQueryTab> it(m_queryTabs); 254 QListIterator<IRCQueryTab> it(m_queryTabs);
166 255
167 for (; it.current(); ++it) { 256 for (; it.current(); ++it) {
168 if (it.current()->person()->nick() == person->nick()) 257 if (it.current()->person()->nick() == person->nick())
169 return it.current(); 258 return it.current();
170 } 259 }
171 return 0; 260 return 0;
172} 261}
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
@@ -17,32 +17,35 @@
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18
19*/ 19*/
20 20
21#ifndef __IRCSERVERTAB_H 21#ifndef __IRCSERVERTAB_H
22#define __IRCSERVERTAB_H 22#define __IRCSERVERTAB_H
23 23#include <qpe/qpeapplication.h>
24#include <qpe/qcopenvelope_qws.h>
24#include "irctab.h" 25#include "irctab.h"
25#include "ircsession.h" 26#include "ircsession.h"
26#include "mainwindow.h" 27#include "mainwindow.h"
27#include "ircchanneltab.h" 28#include "ircchanneltab.h"
28#include "ircquerytab.h" 29#include "ircquerytab.h"
29#include "ircmisc.h" 30#include "ircmisc.h"
30 31
32
31class IRCServerTab : public IRCTab { 33class IRCServerTab : public IRCTab {
32 Q_OBJECT 34 Q_OBJECT
33public: 35public:
34 /* IRCTab implementation */ 36 /* IRCTab implementation */
35 IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); 37 IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
36 ~IRCServerTab(); 38 ~IRCServerTab();
37 QString title(); 39 QString title();
38 IRCSession *session(); 40 IRCSession *session();
39 IRCServer *server(); 41 IRCServer *server();
40 42
41 /* Start the server session */ 43 /* Start the server session */
42 void doConnect(); 44 void doConnect();
45// QString *mynick();
43 /* Remove tabs from the internal tab lists */ 46 /* Remove tabs from the internal tab lists */
44 void removeChannelTab(IRCChannelTab *tab); 47 void removeChannelTab(IRCChannelTab *tab);
45 void removeQueryTab(IRCQueryTab *tab); 48 void removeQueryTab(IRCQueryTab *tab);
46 /* Return tabs from the internal tab lists */ 49 /* Return tabs from the internal tab lists */
47 IRCChannelTab *getTabForChannel(IRCChannel *channel); 50 IRCChannelTab *getTabForChannel(IRCChannel *channel);
48 IRCQueryTab *getTabForQuery(IRCPerson *person); 51 IRCQueryTab *getTabForQuery(IRCPerson *person);
@@ -50,12 +53,13 @@ public:
50 void addQueryTab(IRCQueryTab *tab); 53 void addQueryTab(IRCQueryTab *tab);
51 /* Execute a user command such as /join, /msg etc */ 54 /* Execute a user command such as /join, /msg etc */
52 void executeCommand(IRCTab *tab, QString line); 55 void executeCommand(IRCTab *tab, QString line);
53protected: 56protected:
54 void appendText(QString text); 57 void appendText(QString text);
55public slots: 58public slots:
59 void scrolling();
56 void remove(); 60 void remove();
57 void processCommand(); 61 void processCommand();
58 void settingsChanged(); 62 void settingsChanged();
59protected slots: 63protected slots:
60 void display(IRCOutput output); 64 void display(IRCOutput output);
61protected: 65protected:
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
@@ -25,12 +25,48 @@ void IRCSession::beginSession() {
25} 25}
26 26
27void IRCSession::join(QString channelname) { 27void IRCSession::join(QString channelname) {
28 m_connection->sendLine("JOIN "+channelname); 28 m_connection->sendLine("JOIN "+channelname);
29} 29}
30 30
31void IRCSession::quit(){
32 m_connection->sendLine("QUIT :[OI] I'm too good to need a reason");
33}
34
35void IRCSession::quit(QString message){
36 m_connection->sendLine("QUIT :" + message);
37}
38
39void IRCSession::topic(IRCChannel *channel, QString message){
40 m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message);
41}
42
43void IRCSession::mode(IRCChannel *channel, QString message){
44 m_connection->sendLine("MODE " + channel->channelname() + " " + message);
45}
46
47void IRCSession::mode(IRCPerson *person, QString message){
48 m_connection->sendLine("MODE " + person->nick() + " " + message);
49}
50
51void IRCSession::mode(QString message){
52 m_connection->sendLine("MODE " + message);
53}
54
55void IRCSession::raw(QString message){
56 m_connection->sendLine(message);
57}
58
59void IRCSession::kick(IRCChannel *channel, IRCPerson *person) {
60 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason");
61}
62
63void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) {
64 m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message);
65}
66
31void IRCSession::sendMessage(IRCPerson *person, QString message) { 67void IRCSession::sendMessage(IRCPerson *person, QString message) {
32 m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message); 68 m_connection->sendLine("PRIVMSG " + person->nick() + " :" + message);
33} 69}
34 70
35void IRCSession::sendMessage(IRCChannel *channel, QString message) { 71void IRCSession::sendMessage(IRCChannel *channel, QString message) {
36 m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + message); 72 m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + message);
@@ -105,7 +141,6 @@ void IRCSession::removePerson(IRCPerson *person) {
105 m_people.remove(person); 141 m_people.remove(person);
106} 142}
107 143
108void IRCSession::handleMessage(IRCMessage *message) { 144void IRCSession::handleMessage(IRCMessage *message) {
109 m_parser->parse(message); 145 m_parser->parse(message);
110} 146}
111
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
@@ -40,17 +40,25 @@ friend class IRCMessageParser;
40 Q_OBJECT 40 Q_OBJECT
41public: 41public:
42 IRCSession(IRCServer *server); 42 IRCSession(IRCServer *server);
43 ~IRCSession(); 43 ~IRCSession();
44 44
45 void join(QString channel); 45 void join(QString channel);
46 void quit(QString message);
47 void quit();
48 void raw(QString message);
49 void topic(IRCChannel *channel, QString message);
50 void mode(IRCChannel *channel, QString message);
51 void mode(IRCPerson *person, QString message);
52 void mode(QString message);
46 void part(IRCChannel *channel); 53 void part(IRCChannel *channel);
54 void kick(IRCChannel *channel, IRCPerson *person);
55 void kick(IRCChannel *channel, IRCPerson *person, QString message);
47 void beginSession(); 56 void beginSession();
48 bool isSessionActive(); 57 bool isSessionActive();
49 void endSession(); 58 void endSession();
50
51 void sendMessage(IRCPerson *person, QString message); 59 void sendMessage(IRCPerson *person, QString message);
52 void sendMessage(IRCChannel *channel, QString message); 60 void sendMessage(IRCChannel *channel, QString message);
53 void sendAction(IRCPerson *person, QString message); 61 void sendAction(IRCPerson *person, QString message);
54 void sendAction(IRCChannel *channel, QString message); 62 void sendAction(IRCChannel *channel, QString message);
55 IRCChannel *getChannel(QString channelname); 63 IRCChannel *getChannel(QString channelname);
56 IRCPerson *getPerson(QString nickname); 64 IRCPerson *getPerson(QString nickname);
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
@@ -27,12 +27,16 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
27 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance")); 27 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
28 connect(a, SIGNAL(activated()), this, SLOT(settings())); 28 connect(a, SIGNAL(activated()), this, SLOT(settings()));
29 a->addTo(irc); 29 a->addTo(irc);
30 loadSettings(); 30 loadSettings();
31} 31}
32 32
33/*IRCTabWidget MainWindow::getTabWidget(){
34 return m_tabWidget;
35} */
36
33void MainWindow::loadSettings() { 37void MainWindow::loadSettings() {
34 Config config("OpieIRC"); 38 Config config("OpieIRC");
35 config.setGroup("OpieIRC"); 39 config.setGroup("OpieIRC");
36 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); 40 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
37 IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); 41 IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
38 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); 42 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
@@ -42,12 +46,13 @@ void MainWindow::loadSettings() {
42 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); 46 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
43 IRCTab::m_maxLines = config.readNumEntry("Lines", 100); 47 IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
44} 48}
45 49
46void MainWindow::selected(QWidget *) { 50void MainWindow::selected(QWidget *) {
47 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); 51 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
52 emit updateScroll();
48} 53}
49 54
50void MainWindow::addTab(IRCTab *tab) { 55void MainWindow::addTab(IRCTab *tab) {
51 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); 56 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *)));
52 m_tabWidget->addTab(tab, tab->title()); 57 m_tabWidget->addTab(tab, tab->title());
53 m_tabWidget->showPage(tab); 58 m_tabWidget->showPage(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
@@ -29,15 +29,17 @@
29#include "irctab.h" 29#include "irctab.h"
30 30
31class MainWindow : public QMainWindow { 31class MainWindow : public QMainWindow {
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0); 34 MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
35 35// IRCTabWidget getTabWidget();
36 void addTab(IRCTab *tab); 36 void addTab(IRCTab *tab);
37 void killTab(IRCTab *tab); 37 void killTab(IRCTab *tab);
38signals:
39 void updateScroll();
38protected slots: 40protected slots:
39 void newConnection(); 41 void newConnection();
40 void settings(); 42 void settings();
41 void selected(QWidget *); 43 void selected(QWidget *);
42 void changeEvent(IRCTab *); 44 void changeEvent(IRCTab *);
43protected: 45protected: