author | fliplap <fliplap> | 2003-07-22 05:36:18 (UTC) |
---|---|---|
committer | fliplap <fliplap> | 2003-07-22 05:36:18 (UTC) |
commit | d672a787dd122410063ac6cb721be8b5f8cd418e (patch) (unidiff) | |
tree | d29b21fc979c41a48b2d201c9b37647e729c521c | |
parent | 2fdb15d45c336bbe1540bd9de6b5bfaea13df163 (diff) | |
download | opie-d672a787dd122410063ac6cb721be8b5f8cd418e.zip opie-d672a787dd122410063ac6cb721be8b5f8cd418e.tar.gz opie-d672a787dd122410063ac6cb721be8b5f8cd418e.tar.bz2 |
fixed scroll issue, added many commands
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 8 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 111 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 37 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.h | 10 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.h | 4 |
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 | |||
@@ -33,3 +33,2 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
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 */ |
@@ -41,3 +40,3 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
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); |
@@ -50,2 +49,6 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
50 | 49 | ||
50 | void IRCChannelTab::scrolling(){ | ||
51 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | ||
52 | } | ||
53 | |||
51 | void IRCChannelTab::appendText(QString text) { | 54 | void IRCChannelTab::appendText(QString text) { |
@@ -131,2 +134,3 @@ void IRCChannelTab::popupQuery() { | |||
131 | void IRCChannelTab::popupPing() { | 134 | void IRCChannelTab::popupPing() { |
135 | //HAHA, no wonder these don't work | ||
132 | } | 136 | } |
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 | |||
@@ -49,2 +49,3 @@ public slots: | |||
49 | void settingsChanged(); | 49 | void settingsChanged(); |
50 | void scrolling(); | ||
50 | protected slots: | 51 | protected slots: |
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 | |||
@@ -24,2 +24,3 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
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(); |
@@ -27,2 +28,7 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
27 | 28 | ||
29 | void IRCQueryTab::scrolling(){ | ||
30 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | ||
31 | } | ||
32 | |||
33 | |||
28 | void IRCQueryTab::appendText(QString text) { | 34 | void IRCQueryTab::appendText(QString text) { |
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 | |||
@@ -39,2 +39,3 @@ public: | |||
39 | public slots: | 39 | public slots: |
40 | void scrolling(); | ||
40 | void remove(); | 41 | void remove(); |
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 | |||
@@ -24,2 +24,3 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
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(); |
@@ -27,2 +28,7 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
27 | 28 | ||
29 | void IRCServerTab::scrolling(){ | ||
30 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | ||
31 | } | ||
32 | |||
33 | |||
28 | void IRCServerTab::appendText(QString text) { | 34 | void IRCServerTab::appendText(QString text) { |
@@ -66,2 +72,6 @@ IRCSession *IRCServerTab::session() { | |||
66 | } | 72 | } |
73 | /* | ||
74 | QString *IRCServerTab::mynick() { | ||
75 | return (*m_server->nick()); | ||
76 | } */ | ||
67 | 77 | ||
@@ -81,4 +91,5 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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; |
@@ -88,5 +99,80 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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); |
@@ -100,6 +186,8 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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; |
@@ -114,5 +202,6 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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 | } |
@@ -155,3 +244,3 @@ IRCChannelTab *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) { |
@@ -165,3 +254,3 @@ IRCQueryTab *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) { |
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 | |||
@@ -22,3 +22,4 @@ | |||
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" |
@@ -30,2 +31,3 @@ | |||
30 | 31 | ||
32 | |||
31 | class IRCServerTab : public IRCTab { | 33 | class IRCServerTab : public IRCTab { |
@@ -42,2 +44,3 @@ public: | |||
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 */ |
@@ -55,2 +58,3 @@ protected: | |||
55 | public slots: | 58 | public slots: |
59 | void scrolling(); | ||
56 | void remove(); | 60 | void remove(); |
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 | |||
@@ -30,2 +30,38 @@ void IRCSession::join(QString channelname) { | |||
30 | 30 | ||
31 | void IRCSession::quit(){ | ||
32 | m_connection->sendLine("QUIT :[OI] I'm too good to need a reason"); | ||
33 | } | ||
34 | |||
35 | void IRCSession::quit(QString message){ | ||
36 | m_connection->sendLine("QUIT :" + message); | ||
37 | } | ||
38 | |||
39 | void IRCSession::topic(IRCChannel *channel, QString message){ | ||
40 | m_connection->sendLine("TOPIC :" + channel->channelname() + " " + message); | ||
41 | } | ||
42 | |||
43 | void IRCSession::mode(IRCChannel *channel, QString message){ | ||
44 | m_connection->sendLine("MODE " + channel->channelname() + " " + message); | ||
45 | } | ||
46 | |||
47 | void IRCSession::mode(IRCPerson *person, QString message){ | ||
48 | m_connection->sendLine("MODE " + person->nick() + " " + message); | ||
49 | } | ||
50 | |||
51 | void IRCSession::mode(QString message){ | ||
52 | m_connection->sendLine("MODE " + message); | ||
53 | } | ||
54 | |||
55 | void IRCSession::raw(QString message){ | ||
56 | m_connection->sendLine(message); | ||
57 | } | ||
58 | |||
59 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person) { | ||
60 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :0wn3d - no reason"); | ||
61 | } | ||
62 | |||
63 | void IRCSession::kick(IRCChannel *channel, IRCPerson *person, QString message) { | ||
64 | m_connection->sendLine("KICK "+ channel->channelname() + " " + person->nick() +" :" + message); | ||
65 | } | ||
66 | |||
31 | void IRCSession::sendMessage(IRCPerson *person, QString message) { | 67 | void IRCSession::sendMessage(IRCPerson *person, QString message) { |
@@ -110,2 +146 @@ void IRCSession::handleMessage(IRCMessage *message) { | |||
110 | } | } | |
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 | |||
@@ -45,3 +45,12 @@ public: | |||
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(); |
@@ -49,3 +58,2 @@ public: | |||
49 | void endSession(); | 58 | void endSession(); |
50 | |||
51 | void sendMessage(IRCPerson *person, QString message); | 59 | void sendMessage(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 | |||
@@ -32,2 +32,6 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow( | |||
32 | 32 | ||
33 | /*IRCTabWidget MainWindow::getTabWidget(){ | ||
34 | return m_tabWidget; | ||
35 | } */ | ||
36 | |||
33 | void MainWindow::loadSettings() { | 37 | void MainWindow::loadSettings() { |
@@ -47,2 +51,3 @@ void MainWindow::selected(QWidget *) { | |||
47 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); | 51 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
52 | emit updateScroll(); | ||
48 | } | 53 | } |
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 | |||
@@ -34,5 +34,7 @@ public: | |||
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); |
38 | signals: | ||
39 | void updateScroll(); | ||
38 | protected slots: | 40 | protected slots: |