summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 939cdae..32e1011 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -55,48 +55,49 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
{ 253, QT_TR_NOOP("There are %1 unknown connection(s)"), "1", 0 }, // RPL_LUSERUNKNOWN
{ 254, QT_TR_NOOP("There are %1 channels formed"), "1", 0 }, // RPL_LUSERCHANNELS
{ 255, "%1", "1", 0 }, // RPL_LUSERME
{ 263, QT_TR_NOOP("Please wait a while and try again"), 0, 0 }, // RPL_TRYAGAIN
{ 265, "%1", "1", 0 }, // RPL_LOCALUSERS
{ 266, "%1", "1", 0 }, // RPL_GLOBALUSERS
{ 311, QT_TR_NOOP("Whois %1 (%2@%3)\nReal name: %4"), "1:3,5", 0 }, // RPL_WHOISUSER
{ 312, QT_TR_NOOP("%1 is using server %2"), "1,2", 0 }, // RPL_WHOISSERVER
{ 317, 0, 0, FUNC(parseNumericalWhoisIdle) }, // RPL_WHOISIDLE
{ 318, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOIS
{ 319, QT_TR_NOOP("%1 is on channels: %2"), "1,2", 0 }, // RPL_WHOISCHANNELS
{ 320, "%1 %2", "1,2", 0}, // RPL_WHOISVIRT
{ 332, 0, 0, FUNC(parseNumericalTopic) }, // RPL_TOPIC
{ 333, 0, 0, FUNC(parseNumericalTopicWhoTime) }, // RPL_TOPICWHOTIME*/
{ 353, QT_TR_NOOP("Names for %1: %2"), "2,3", FUNC(parseNumericalNames) }, // RPL_NAMREPLY
{ 366, "%1 :%2", "1,2", FUNC(parseNumericalEndOfNames) }, // RPL_ENDOFNAMES
{ 369, "%1 :%2", "1,2", 0 }, // RPL_ENDOFWHOWAS
{ 372, "%1", "1", 0 }, // RPL_MOTD
{ 375, "%1", "1", 0 }, // RPL_MOTDSTART
{ 376, "%1", "1", 0 }, // RPL_ENDOFMOTD
{ 377, "%1", "1", 0 }, // RPL_MOTD2
{ 378, "%1", "1", 0 }, // RPL_MOTD3
{ 391, QT_TR_NOOP("Time on server %1 is %2"), "1,2", 0 }, // RPL_TIME
{ 401, QT_TR_NOOP("Channel or nick %1 doesn't exists"), "1", 0 }, // ERR_NOSUCHNICK
+ { 403, QT_TR_NOOP("Channel %1 doesn't exists"), "1", 0 }, // ERR_ERR_NOSUCHCHANNEL
{ 406, QT_TR_NOOP("There is no history information for %1"), "1", 0 }, // ERR_WASNOSUCHNICK
{ 409, "%1", "1", 0 }, // ERR_NOORIGIN
{ 411, "%1", "1", 0 }, // ERR_NORECIPIENT
{ 412, "%1", "1", 0 }, // ERR_NOTEXTTOSEND
{ 421, QT_TR_NOOP("Unknown command: %1"), "1", 0 }, // ERR_ERR_UNKNOWNCOMMAND
{ 422, "%1", "1", 0 }, // ERR_NOMOTD
{ 433, QT_TR_NOOP("Can't change nick to %1: %2"), "1,2", FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE
{ 442, QT_TR_NOOP("You're not on channel %1"), "1", 0}, // ERR_NOTONCHANNEL
{ 477, "%1", "1", 0 }, // ERR_NOCHANMODES || ERR_NEEDREGGEDNICK
{ 482, QT_TR_NOOP("[%1] Operation not permitted, you don't have enough channel privileges"), "1", 0 }, //ERR_CHANOPRIVSNEEDED
{ 0, 0, 0, 0 }
};
IRCMessageParser::IRCMessageParser(IRCSession *session) {
m_session = session;
}
void IRCMessageParser::parse(IRCMessage *message) {
/* Find out what kind of message we have here and call the appropriate handler using
the parser tables. If no handler can be found, print out an error message */
if (message->isNumerical()) {
for (int i=0; i<numericalParserProcTable[i].commandNumber; i++) {
if (message->commandNumber() == numericalParserProcTable[i].commandNumber) {
@@ -248,49 +249,49 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) {
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Parting person not found - desynchronized?")));
}
}
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel for part not found - desynchronized?")));
}
}
void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
if (m_session->m_server->nick().lower() == message->param(0).lower() ) {
/* IRC Query message detected, verify sender and display it */
IRCPerson mask(message->prefix());
IRCPerson *person = m_session->getPerson(mask.nick());
if (!person) {
/* Person not yet known, create and add to the current session */
person = new IRCPerson(message->prefix());
m_session->addPerson(person);
}
IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1));
output.addParam(person);
emit outputReady(output);
}
else
- if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') {
+ if (IRCChannel::isValid(message->param(0))) {
/* IRC Channel message detected, verify sender, channel and display it */
IRCChannel *channel = m_session->getChannel(message->param(0).lower());
if (channel) {
IRCPerson mask(message->prefix());
IRCChannelPerson *person = channel->getPerson(mask.nick());
if (person) {
IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1));
output.addParam(channel);
output.addParam(person);
emit outputReady(output);
}
else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender")));
}
}
else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) ));
}
}
else {emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
}
}
void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
@@ -469,49 +470,49 @@ void IRCMessageParser::parseCTCPDCC(IRCMessage *message) {
if(params[0] == "SEND") {
QString nickname = IRCPerson(message->prefix()).nick();
if( params.count() != 5) {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Malformed DCC request from %1").arg(nickname)));
return;
}
bool accepted = DCCTransferTab::confirm(static_cast<QWidget*>(m_session->parent()), nickname, params[1], params[4].toUInt());
if(!accepted)
return;
QString filename = Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED_ALL,
QString::null, params[1], MimeTypes(), 0, tr("Save As"));
if(filename.isEmpty())
return;
odebug << "Receiving file " << filename << " from " << nickname << oendl;
static_cast<IRCServerTab*>(m_session->parent())->mainwindow()->addDCC(DCCTransfer::Recv, params[2].toUInt(), params[3].toUInt(),
filename, nickname, params[4].toUInt());
}
}
void IRCMessageParser::parseLiteralMode(IRCMessage *message) {
IRCPerson mask(message->prefix());
- if (message->param(0).startsWith("#")) {
+ if (IRCChannel::isValid(message->param(0))) {
IRCChannel *channel = m_session->getChannel(message->param(0).lower());
if (channel) {
QString temp, parameters = message->allParameters().right(message->allParameters().length() - channel->channelname().length() - 1);
QTextIStream stream(&parameters);
bool set = FALSE;
while (!stream.atEnd()) {
stream >> temp;
if (temp.startsWith("+")) {
set = TRUE;
temp = temp.right(1);
}
else
if (temp.startsWith("-")) {
set = FALSE;
temp = temp.right(1);
}
else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Mode change has unknown type")));
return;
}
if (temp == "o") {
stream >> temp;
IRCChannelPerson *person = channel->getPerson(temp);
if (person) {