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 __IRCOUTPUT_H 00022 #define __IRCOUTPUT_H 00023 00024 #include <qstring.h> 00025 #include <qlist.h> 00026 #include "ircchannel.h" 00027 00028 /* Types of possible IRC output */ 00029 enum IRCOutputType { 00030 OUTPUT_ERROR = -1, /* parameters : none */ 00031 OUTPUT_SERVERMESSAGE = 0, /* parameters : none */ 00032 OUTPUT_CLIENTMESSAGE = 1, /* parameters : none */ 00033 OUTPUT_CHANPRIVMSG = 2, /* parameters : channel (IRCChannel), person (IRCChannelPerson) */ 00034 OUTPUT_QUERYPRIVMSG = 3, /* parameters : person (IRCPerson) */ 00035 OUTPUT_NICKCHANGE = 4, /* parameters : person (IRCPerson) */ 00036 OUTPUT_SELFJOIN = 5, /* parameters : channel (IRCChannel) */ 00037 OUTPUT_OTHERJOIN = 6, /* parameters : channel (IRCChannel), person (IRCChannelPerson) */ 00038 OUTPUT_SELFPART = 7, /* parameters : channel (IRCChannel) */ 00039 OUTPUT_OTHERPART = 8, /* parameters : channel (IRCChannel), person (IRCChannelPerson) */ 00040 OUTPUT_QUIT = 9, /* parameters : person (IRCPerson) */ 00041 OUTPUT_CONNCLOSE = 10, /* parameters : none */ 00042 OUTPUT_CTCP = 11, /* parameters : none */ 00043 OUTPUT_SELFKICK = 12, /* parameters : channel (IRCChannel) */ 00044 OUTPUT_OTHERKICK = 13, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */ 00045 OUTPUT_CHANACTION = 14, /* parameters : channel (IRCChannel) person (IRCChannelPerson) */ 00046 OUTPUT_QUERYACTION = 15, /* parameters : person (IRCPerson) */ 00047 OUTPUT_CHANPERSONMODE = 16, /* parameters : channel (IRCCHannel) person (IRCChannelPerson) */ 00048 OUTPUT_TOPIC = 17, /* parameters : channel (IRCChannel) */ 00049 OUTPUT_TITLE = 18 /* parameters : channel (IRCChannel) */ 00050 }; 00051 00052 typedef struct IRCOutputEscapeSecuences { 00053 char escape; 00054 char *open; 00055 char *close; 00056 }; 00057 00058 /* The IRCOutput class is used as a kind of message which is sent by the 00059 IRC parser to inform the GUI of changes. This could for example be a 00060 channel message or a nickname change */ 00061 00062 class IRCOutput { 00063 public: 00064 IRCOutput(IRCOutputType type = OUTPUT_SERVERMESSAGE, QString message = QString::null); 00065 /* Used to add a parameter to this IRCOutput. Parameters are dependent 00066 on which IRCOutputType we are using (see above) */ 00067 void addParam(void *data); 00068 00069 IRCOutputType type(); 00070 QString message(); 00071 /* Return the message with all HTML code escaped (for example < instead of '<') */ 00072 QString htmlMessage(); 00073 00074 void setType(IRCOutputType); 00075 void setMessage(const QString &message); 00076 00077 static QString toHTML(const QString &message); 00078 void *getParam(int index); 00079 protected: 00080 IRCOutputType m_type; 00081 QString m_message; 00082 QList<void> m_parameters; 00083 static IRCOutputEscapeSecuences m_escapeSecuences[]; 00084 }; 00085 00086 #endif
1.4.2