1
#ifndef _KVI_SPARSER_H_INCLUDED_
2
#define _KVI_SPARSER_H_INCLUDED_
5
// File : kvi_sparser.h (/usr/build/NEW_kvirc/kvirc/src/kvirc/kvi_sparser.h)
6
// Last major modification : Wed Feb 10 1999 19:13:55 by Szymon Stefanek
8
// This file is part of the KVirc irc client distribution
9
// Copyright (C) 1999-2000 Szymon Stefanek (stefanek@tin.it)
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
16
// This program is distributed in the HOPE that it will be USEFUL,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
// See the GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program. If not, write to the Free Software Foundation,
23
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
#include "kvi_string.h"
42
typedef struct KviRawEventStruct KviRawEvent;
44
typedef struct KviIrcMessage
48
unsigned int uCommand;
50
bool bHasBeenHandled; // Has been handled by a script
53
class KviServerParser;
55
typedef void (KviServerParser::*ircCmdParseProc) (KviIrcMessage *);
57
typedef struct KviIrcCommandEntry
61
ircCmdParseProc cmdProc;
64
typedef void (KviServerParser::*ctcpRequestParseProc) (KviIrcUser &,const char *,const char *);
66
typedef struct KviCtcpCommandEntry
68
const char * ctcpName;
71
ctcpRequestParseProc ctcpProc;
72
ctcpRequestParseProc ctcpReplyProc;
75
class KviServerParser : public QObject
77
friend class KviIrcSocket;
78
friend class KviFrame;
81
KviServerParser(KviFrame *pFrm);
85
KviIrcSocket *m_pSocket;
86
KviConsole *m_pConsole;
87
KviStatusBar *m_pStatus;
88
KviUserParser *m_pUserParser;
89
static KviIrcCommandEntry cmdTable[];
90
static KviCtcpCommandEntry ctcpCmdTable[];
95
KviStr m_szLastNetsplit;
96
int m_iNetsplitTimerId;
98
void setup(KviIrcSocket *pSock,KviConsole *pConsole,KviUserParser *pUParser);
100
bool isMe(const KviIrcUser &user);
101
bool isMe(const char *nick);
103
const char * skipToTrailing(const char *str);
104
const char * skipWord(const char *str);
105
const char * skipToUsername(const char *str);
107
void getDateTimeStringFromCharTimeT(KviStr &buffer,const char *time_t_string);
109
void parseMessage(char *msg_buffer); //Called directly from KviIrcSocket
110
bool triggerRawEvent(KviIrcMessage *msg,QList<KviRawEvent> * lp);
112
void parseNumericMessage(KviIrcMessage *msg);
113
void parseLiteralMessage(KviIrcMessage *msg);
115
void parseNumeric000_199(KviIrcMessage *msg);
116
void parseNumeric200_399(KviIrcMessage *msg);
117
void parseNumeric400_999(KviIrcMessage *msg);
119
void parseNumericTopic(KviIrcMessage *msg);
120
void parseNumericCreationTime(KviIrcMessage *msg);
121
void parseNumericEndOfNames(KviIrcMessage *msg);
122
void parseNumericNamesReply(KviIrcMessage *msg);
123
void parseNumericChannelMode(KviIrcMessage *msg);
124
void parseNumericBanList(KviIrcMessage *msg);
125
void parseNumericExceptionList(KviIrcMessage *msg);
126
void parseNumericInviteList(KviIrcMessage *msg);
127
void parseNumericWhoReply(KviIrcMessage *msg);
128
void parseNumericUserhost(KviIrcMessage *msg);
129
void parseNumericWhoisReply(KviIrcMessage *msg);
130
void parseNumericWatchList(KviIrcMessage *msg);
131
void parseNumericIsonReply(KviIrcMessage *msg);
132
void parseNumericLinks(KviIrcMessage *msg);
133
void parseNumericList(KviIrcMessage *msg);
134
void parseNumericVersion(KviIrcMessage *msg);
135
void parseNumericMyInfo(KviIrcMessage *msg);
137
void parseNumericErrorUnknownModeChar(KviIrcMessage *msg);
138
void parseNumericErrorUnknownCommand(KviIrcMessage *msg);
140
void parseUnhandledNumeric(KviIrcMessage *msg);
141
void parseUnhandledNumericError(KviIrcMessage *msg);
143
void parseJoin(KviIrcMessage *msg);
144
void parsePing(KviIrcMessage *msg);
145
void parsePart(KviIrcMessage *msg);
146
void parseKick(KviIrcMessage *msg);
147
void parseQuit(KviIrcMessage *msg);
148
void parseMode(KviIrcMessage *msg);
149
void parsePrivmsg(KviIrcMessage *msg);
150
void parseNick(KviIrcMessage *msg);
151
void parseTopic(KviIrcMessage *msg);
152
void parseNotice(KviIrcMessage *msg);
153
void parseInvite(KviIrcMessage *msg);
154
void parseLocops(KviIrcMessage *msg);
155
void parseGlobops(KviIrcMessage *msg);
156
void parseWallops(KviIrcMessage *msg);
157
void parseError(KviIrcMessage *msg);
159
void handleChanUserMode(KviIrcMessage *msg,KviChannel *chan,bool bAdd,char mode,const char *src_nick,
160
const char *src_mask,const char *dst_nick);
161
bool callChanUserModeEvent(KviChannel *chan,int event,const char *src_nick,
162
const char *src_mask,const char *dst_nick,bool isme=false,char mode=0,bool bAdd=false,const char *param=0);
163
void handleChanMode(KviIrcMessage *msg,KviChannel *chan,bool bAdd,char mode,const char *src_nick,
164
const char *src_mask,const char *param);
166
void parseUnhandledLiteral(KviIrcMessage *msg);
168
// kvi_sparser.ctcp.cpp
169
void parseCTCPPrivmsg(KviIrcUser &source,const char *target,const char *data);
170
void parseCTCPNotice(KviIrcUser &source,const char *target,const char *data);
172
void replyCTCP(const char *to,const char *type,const char *msg);
174
void handleCTCPPingRequest(KviIrcUser &source,const char *target,const char *data);
175
void handleCTCPVersionRequest(KviIrcUser &source,const char *target,const char *data);
176
void handleCTCPTimeRequest(KviIrcUser &source,const char *target,const char *data);
177
void handleCTCPUserinfoRequest(KviIrcUser &source,const char *target,const char *data);
178
void handleCTCPClientinfoRequest(KviIrcUser &source,const char *target,const char *data);
179
void handleCTCPSourceRequest(KviIrcUser &source,const char *target,const char *data);
180
void handleCTCPDccRequest(KviIrcUser &source,const char *target,const char *data);
181
void handleCTCPFingerRequest(KviIrcUser &source,const char *target,const char *data);
182
void handleCTCPActionRequest(KviIrcUser &source,const char *target,const char *data);
183
void handleCTCPPageRequest(KviIrcUser &source,const char *target,const char *data);
184
// void handleCTCPSoundRequest(KviIrcUser &source,const char *target,const char *data);
185
void handleCTCPErrmsgRequest(KviIrcUser &source,const char *target,const char *data);
186
void handleCTCPMultimediaRequest(KviIrcUser &source,const char *target,const char *data);
188
void handleCTCPPingReply(KviIrcUser &source,const char *target,const char *data);
189
void handleCTCPVersionReply(KviIrcUser &source,const char *target,const char *data);
190
void handleCTCPTimeReply(KviIrcUser &source,const char *target,const char *data);
191
void handleCTCPUserinfoReply(KviIrcUser &source,const char *target,const char *data);
192
void handleCTCPClientinfoReply(KviIrcUser &source,const char *target,const char *data);
193
void handleCTCPSourceReply(KviIrcUser &source,const char *target,const char *data);
194
void handleCTCPDccReply(KviIrcUser &source,const char *target,const char *data);
195
void handleCTCPFingerReply(KviIrcUser &source,const char *target,const char *data);
196
void handleCTCPActionReply(KviIrcUser &source,const char *target,const char *data);
197
void handleCTCPPageReply(KviIrcUser &source,const char *target,const char *data);
198
// void handleCTCPSoundReply(KviIrcUser &source,const char *target,const char *data);
199
void handleCTCPErrmsgReply(KviIrcUser &source,const char *target,const char *data);
200
void handleCTCPMultimediaReply(KviIrcUser &source,const char *target,const char *data);
202
bool doActionEvent(KviIrcUser &source,const char *target,KviWindow *pOut,char create_query='0',const char *data=NULL);
203
bool doMultimediaEvent(KviIrcUser &source,const char *target,KviWindow *pOut,int create_query,const char *filename);
204
bool doCTCPEvent(const char *ctcpName,KviIrcUser &source,const char *target,bool bIgnore,KviWindow *pOut,const char *parms=NULL);
205
bool doCTCPReplyEvent(const char *ctcpName,KviIrcUser &source,const char *target,KviWindow *pOut,const char *data=NULL);
206
bool doCTCPFloodEvent(const char *ctcpName,KviIrcUser &source,const char *target,KviWindow *pOut,const char *parms=NULL);
208
bool showCTCPRequest(const char *ctcpName,KviIrcUser &source,const char *target,bool bIgnore);
209
void showCTCPReply(const char *ctcpName,KviIrcUser &source,const char *target,const char *data);
212
virtual void timerEvent(QTimerEvent *e);
215
#endif //!_KVI_SPARSER_H_INCLUDED_