00001 /* 00002 OpieIRC - An embedded IRC client 00003 Copyright (C) 2002 Wenzel Jakob 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 */ 00020 00021 #ifndef __IRCMESSAGE_H 00022 #define __IRCMESSAGE_H 00023 00024 class QString; 00025 class QStringList; 00026 00027 /* IRCMessage objects are used to encapsulate information 00028 which the IRC server sent to us. */ 00029 00030 class IRCMessage { 00031 public: 00032 /* Parse an IRC message and create the IRCMessage object */ 00033 IRCMessage(QString line); 00034 00035 /* Return the IRC message prefix (usually sender etc) */ 00036 QString prefix(); 00037 /* Check if this IRCMessage's command is literal or numerical */ 00038 bool isNumerical(); 00039 /* CHeck if this IRCMessage is a CTCP message */ 00040 bool isCTCP(); 00041 bool isCTCPRequest(); 00042 bool isCTCPReply(); 00043 /* Return the IRC command (literal commands) */ 00044 QString command(); 00045 /* Return the CTCP command */ 00046 QString ctcpCommand(); 00047 /* Return the CTCP destination if applicable (channel/person) */ 00048 QString ctcpDestination(); 00049 /* Return the IRC command (numerical commands) */ 00050 unsigned short commandNumber(); 00051 /* Return the trailing parameter string */ 00052 QString trailing(); 00053 /* Return the complete parameter string */ 00054 QString allParameters(); 00055 /* Return one parameter */ 00056 QString param(int param); 00057 /* Return some parameters */ 00058 QStringList params(const QString ¶mstring) const; 00059 protected: 00060 QString m_prefix; 00061 QString m_command; 00062 QString m_ctcpCommand; 00063 QString m_ctcpDestination; 00064 unsigned short m_commandNumber; 00065 QString m_allParameters; 00066 QString m_trailing; 00067 QStringList m_parameters; 00068 bool m_isNumerical; 00069 bool m_ctcp; 00070 bool m_ctcpRequest; 00071 }; 00072 00073 #endif
1.4.2