3 // Copyright 2011 Akari <Akari` @ irc.quakenet.org>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 #include <libircclient/libircclient.h>
20 static void CL_Irc_Connect_f(void);
21 static void CL_Irc_Disconnect_f(void);
22 static void CL_Irc_Say_Universal_f(void);
23 static void CL_Irc_Notice_f(void);
24 static void CL_Irc_Me_f(void);
25 static void CL_Irc_Say_f(void);
26 static void CL_Irc_Join_f(void);
27 static void CL_Irc_Part_f(void);
28 static void CL_Irc_Names_f(void);
29 static void CL_Irc_MessageMode_f(void);
30 static void CL_Irc_ChNick_f(void);
31 static void CL_Irc_Raw_f(void);
32 void CL_Irc_Init (void);
33 static void IRC_Thread(void *p);
34 void Irc_SetLastChannel(const char *value);
35 const char* Irc_GetLastChannel(void);
36 void Irc_SendMessage(const char *msg);
37 int irc_cmd_nick(irc_session_t * session, const char *nick);
38 qboolean Irc_CheckHilight(const char* msg);
39 qboolean Irc_IsWatchedChannel(const char* chan);
41 #define IRCEVENT(funcname) void funcname(irc_session_t *session, const char *event, const char *origin, const char **params, unsigned int count)
42 #define IRCNUMEVENT(funcname) void funcname (irc_session_t *session, unsigned int event, const char *origin, const char **params, unsigned int count)
43 IRCEVENT(event_connect);
44 IRCNUMEVENT(event_numeric);
45 IRCEVENT(event_privmsg);
46 IRCEVENT(event_channel);
52 IRCEVENT(event_umode);
53 IRCEVENT(event_topic);
55 IRCEVENT(event_notice);
56 IRCEVENT(event_invite);
57 IRCEVENT(event_ctcp_action);
58 IRCEVENT(event_ctcp_action_priv);
60 #define MSGMODE_PRIVMSG 0
61 #define MSGMODE_NOTICE 1
62 #define MSGMODE_ACTION 2
64 #define ISCHANNEL(c) (c[0] == '#' || c[0] == '&')
65 #define CHATWINDOW (irc_chatwindow.integer == 1? "\001" : "")
66 #define CHATWINDOW_URGENT (irc_chatwindow.integer? "\001" : "")
67 #define MUSTCONNECT if(irc_connected.integer != 2) { Con_Printf("Not connected to an IRC server\n"); return; }
68 #define UPDATETARGET(c) if(irc_autochangetarget.integer) Irc_SetLastChannel(c);
69 #define NOTSET(cvar) (!strlen((cvar).string))
71 extern char *strcasestr (__const char*, __const char*);