-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index d3c0448..5eb1758 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -72,99 +72,100 @@ IRCServerTab::~IRCServerTab() { | |||
72 | delete m_session; | 72 | delete m_session; |
73 | } | 73 | } |
74 | 74 | ||
75 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | 75 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { |
76 | m_channelTabs.remove(tab); | 76 | m_channelTabs.remove(tab); |
77 | } | 77 | } |
78 | 78 | ||
79 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | 79 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { |
80 | m_queryTabs.remove(tab); | 80 | m_queryTabs.remove(tab); |
81 | } | 81 | } |
82 | 82 | ||
83 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { | 83 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { |
84 | m_queryTabs.append(tab); | 84 | m_queryTabs.append(tab); |
85 | } | 85 | } |
86 | 86 | ||
87 | QString IRCServerTab::title() { | 87 | QString IRCServerTab::title() { |
88 | return "Server"; | 88 | return "Server"; |
89 | } | 89 | } |
90 | 90 | ||
91 | IRCSession *IRCServerTab::session() { | 91 | IRCSession *IRCServerTab::session() { |
92 | return m_session; | 92 | return m_session; |
93 | } | 93 | } |
94 | /* | 94 | /* |
95 | QString *IRCServerTab::mynick() { | 95 | QString *IRCServerTab::mynick() { |
96 | return (*m_server->nick()); | 96 | return (*m_server->nick()); |
97 | } */ | 97 | } */ |
98 | 98 | ||
99 | IRCServer *IRCServerTab::server() { | 99 | IRCServer *IRCServerTab::server() { |
100 | return &m_server; | 100 | return &m_server; |
101 | } | 101 | } |
102 | 102 | ||
103 | void IRCServerTab::settingsChanged() { | 103 | void IRCServerTab::settingsChanged() { |
104 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 104 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
105 | m_lines = 0; | 105 | m_lines = 0; |
106 | } | 106 | } |
107 | 107 | ||
108 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | 108 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { |
109 | QTextIStream stream(&line); | 109 | QTextIStream stream(&line); |
110 | QString command; | 110 | QString command; |
111 | stream >> command; | 111 | stream >> command; |
112 | command = command.upper().right(command.length()-1); | 112 | command = command.upper().right(command.length()-1); |
113 | 113 | ||
114 | //JOIN | 114 | //JOIN |
115 | if (command == "JOIN" || command == "J") { | 115 | if (command == "JOIN" || command == "J") { |
116 | QString channel; | 116 | QString channel; |
117 | stream >> channel; | 117 | stream >> channel; |
118 | /* According to RFC 1459 */ | 118 | /* According to RFC 1459 */ |
119 | if (channel.length() > 0 && channel.length() < 200 && | 119 | if (channel.length() > 0 && channel.length() < 200 && |
120 | channel.find(",") == -1 && channel.find("") == -1) { | 120 | channel.find(",") == -1 && channel.find('\007') == -1) { |
121 | 121 | ||
122 | if (!channel.startsWith("#") && !channel.startsWith("&")) { | 122 | if (!channel.startsWith("#") && !channel.startsWith("&") |
123 | && !channel.startsWith("+") && !channel.startsWith("!")) { | ||
123 | channel = channel.prepend("#"); | 124 | channel = channel.prepend("#"); |
124 | } | 125 | } |
125 | m_session->join(channel); | 126 | m_session->join(channel); |
126 | } else { | 127 | } else { |
127 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); | 128 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); |
128 | } | 129 | } |
129 | } | 130 | } |
130 | 131 | ||
131 | //KICK | 132 | //KICK |
132 | else if (command == "KICK"){ | 133 | else if (command == "KICK"){ |
133 | QString nickname; | 134 | QString nickname; |
134 | stream >> nickname; | 135 | stream >> nickname; |
135 | if (nickname.length() > 0) { | 136 | if (nickname.length() > 0) { |
136 | if (line.length() > 7 + nickname.length()) { | 137 | if (line.length() > 7 + nickname.length()) { |
137 | QString text = line.right(line.length()-nickname.length()-7); | 138 | QString text = line.right(line.length()-nickname.length()-7); |
138 | IRCPerson person; | 139 | IRCPerson person; |
139 | person.setNick(nickname); | 140 | person.setNick(nickname); |
140 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); | 141 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person, text); |
141 | } else { | 142 | } else { |
142 | IRCPerson person; | 143 | IRCPerson person; |
143 | person.setNick(nickname); | 144 | person.setNick(nickname); |
144 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person); | 145 | m_session->kick(((IRCChannelTab *)tab)->channel(), &person); |
145 | } | 146 | } |
146 | } | 147 | } |
147 | } | 148 | } |
148 | 149 | ||
149 | else if (command == "OP"){ | 150 | else if (command == "OP"){ |
150 | QString nickname; | 151 | QString nickname; |
151 | stream >> nickname; | 152 | stream >> nickname; |
152 | if (nickname.length() > 0) { | 153 | if (nickname.length() > 0) { |
153 | QString text = line.right(line.length()-nickname.length()-5); | 154 | QString text = line.right(line.length()-nickname.length()-5); |
154 | IRCPerson person; | 155 | IRCPerson person; |
155 | person.setNick(nickname); | 156 | person.setNick(nickname); |
156 | m_session->op(((IRCChannelTab *)tab)->channel(), &person); | 157 | m_session->op(((IRCChannelTab *)tab)->channel(), &person); |
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
160 | //SEND MODES | 161 | //SEND MODES |
161 | else if (command == "MODE"){ | 162 | else if (command == "MODE"){ |
162 | QString text = line.right(line.length()-6); | 163 | QString text = line.right(line.length()-6); |
163 | if (text.length() > 0) { | 164 | if (text.length() > 0) { |
164 | m_session->mode(text); | 165 | m_session->mode(text); |
165 | } else { | 166 | } else { |
166 | 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>"); | 167 | 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>"); |
167 | } | 168 | } |
168 | } | 169 | } |
169 | //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want | 170 | //SEND RAW MESSAGE TO SERVER, COMPLETELY UNCHECKED - anything in the RFC...or really anything you want |
170 | else if (command == "RAW"){ | 171 | else if (command == "RAW"){ |