summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index fde156c..cfad2c1 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -71,10 +71,10 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
71 { 409, "%1", "1", 0 }, // ERR_NOORIGIN 71 { 409, "%1", "1", 0 }, // ERR_NOORIGIN
72 { 411, "%1", "1", 0 }, // ERR_NORECIPIENT 72 { 411, "%1", "1", 0 }, // ERR_NORECIPIENT
73 { 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND 73 { 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND
74 { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_NOMOTD 74 { 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_ERR_UNKNOWNCOMMAND
75 { 422, QT_TR_NOOP("You're not on channel %1"), "1", 0}, // ERR_NOTONCHANNEL
76 { 422, "%1", "1", 0 }, // ERR_NOMOTD 75 { 422, "%1", "1", 0 }, // ERR_NOMOTD
77 { 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE 76 { 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE
77 { 442, QT_TR_NOOP("You're not on channel %1"), "1", 0}, // ERR_NOTONCHANNEL
78 { 477, "%1", "1", 0 }, // ERR_NOCHANMODES || ERR_NEEDREGGEDNICK 78 { 477, "%1", "1", 0 }, // ERR_NOCHANMODES || ERR_NEEDREGGEDNICK
79 { 482, QT_TR_NOOP("[%1] Operation not permitted, you don't have enough channel privileges"), "1", 0 }, //ERR_CHANOPRIVSNEEDED 79 { 482, QT_TR_NOOP("[%1] Operation not permitted, you don't have enough channel privileges"), "1", 0 }, //ERR_CHANOPRIVSNEEDED
80 { 0, 0, 0, 0 } 80 { 0, 0, 0, 0 }
@@ -136,6 +136,10 @@ void IRCMessageParser::parseNumerical(IRCMessage *message, int position) {
136 136
137void IRCMessageParser::parseNumericalServerName(IRCMessage *message) { 137void IRCMessageParser::parseNumericalServerName(IRCMessage *message) {
138 emit outputReady(IRCOutput(OUTPUT_TITLE, tr("Connected to")+" <b>" + message->prefix() + "</b>")); 138 emit outputReady(IRCOutput(OUTPUT_TITLE, tr("Connected to")+" <b>" + message->prefix() + "</b>"));
139 /* Register EFFECTIVE nickname, some networks (as irc-hispano) uses nick:password
140 * for authentication and the parser gets confused */
141 m_session->m_server->setNick(message->param(0));
142
139} 143}
140 144
141void IRCMessageParser::parseNumericalServerFeatures(IRCMessage *message) { 145void IRCMessageParser::parseNumericalServerFeatures(IRCMessage *message) {
@@ -249,25 +253,29 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
249 IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1)); 253 IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1));
250 output.addParam(person); 254 output.addParam(person);
251 emit outputReady(output); 255 emit outputReady(output);
252 } else if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') { 256 }
253 /* IRC Channel message detected, verify sender, channel and display it */ 257 else
254 IRCChannel *channel = m_session->getChannel(message->param(0).lower()); 258 if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') {
255 if (channel) { 259 /* IRC Channel message detected, verify sender, channel and display it */
256 IRCPerson mask(message->prefix()); 260 IRCChannel *channel = m_session->getChannel(message->param(0).lower());
257 IRCChannelPerson *person = channel->getPerson(mask.nick()); 261 if (channel) {
258 if (person) { 262 IRCPerson mask(message->prefix());
259 IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1)); 263 IRCChannelPerson *person = channel->getPerson(mask.nick());
260 output.addParam(channel); 264 if (person) {
261 output.addParam(person); 265 IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1));
262 emit outputReady(output); 266 output.addParam(channel);
263 } else { 267 output.addParam(person);
264 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender"))); 268 emit outputReady(output);
269 }
270 else {
271 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender")));
272 }
273 }
274 else {
275 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) ));
265 } 276 }
266 } else { 277 }
267 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) )); 278 else {emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
268 }
269 } else {
270 emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
271 } 279 }
272} 280}
273 281