author | wazlaf <wazlaf> | 2002-09-20 23:28:14 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-20 23:28:14 (UTC) |
commit | 912092425248f7fc5155b4c7c46b7d00ec2676bc (patch) (side-by-side diff) | |
tree | 5bbf746e83b2dffad89542c42031a573c34da751 /noncore/net/opieirc/ircmessage.cpp | |
parent | cd3df897c1b0ed93c2be3ab411011a0bdfe88bf9 (diff) | |
download | opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.zip opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.tar.gz opie-912092425248f7fc5155b4c7c46b7d00ec2676bc.tar.bz2 |
support for client commands (only /join implemented so far), crash bugfix, fixed 2 leaks, server browser now includes a channel list
Diffstat (limited to 'noncore/net/opieirc/ircmessage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircmessage.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircmessage.cpp b/noncore/net/opieirc/ircmessage.cpp index 74e9c6f..9c2869c 100644 --- a/noncore/net/opieirc/ircmessage.cpp +++ b/noncore/net/opieirc/ircmessage.cpp @@ -3,60 +3,63 @@ /* * Create a new IRCMessage by evaluating * a received string */ IRCMessage::IRCMessage(QString line) { /* Remove CRs from the message */ while((line.right(1) == "\n") || (line.right(1) == "\r")) line = line.left(line.length() - 1); QTextIStream stream(&line); QString temp; stream >> temp; if (temp.startsWith(":")) { /* extract the prefix */ m_prefix = temp.right(temp.length()-1); stream >> temp; m_command = temp.upper(); m_allParameters = line.right(line.length() - m_prefix.length() - m_command.length() - 3); } else { m_command = temp.upper(); m_allParameters = line.right(line.length() - m_command.length() - 1); } + /* Create a list of all parameters */ while(!(stream.atEnd())) { stream >> temp; if (temp.startsWith(":")) { /* last parameter */ m_trailing = line.right(line.length() - line.find(QChar(':'), 1) - 1); m_parameters << m_trailing; break; } else { m_parameters << temp; } } + + m_commandNumber = m_command.toInt(&m_isNumerical); /* Is this a CTCP command */ if ((m_command == "PRIVMSG" || m_command == "NOTICE") && m_trailing.length()>0 && m_trailing.left(1) == QChar(1)) { m_ctcp = TRUE; /* Strip CTCP \001 characters */ m_allParameters = m_allParameters.replace(QRegExp(QChar(1)), ""); QTextIStream ctcpStream(&m_allParameters); if (m_command == "PRIVMSG") ctcpStream >> m_ctcpDestination; ctcpStream >> temp; m_ctcpCommand = temp.upper().right(temp.length()-1); m_parameters.clear(); int length = m_allParameters.length() - m_ctcpCommand.length() - 1; if (m_command == "PRIVMSG") length -= m_ctcpDestination.length() + 1; if (length <= 0) { m_allParameters = ""; } else { m_allParameters = m_allParameters.right(length); m_parameters << m_allParameters; } } else { m_ctcp = FALSE; } |