cvar_t irc_current_nick = {CVAR_READONLY, "irc_current_nick", "", "Holds your current IRC nick"};
cvar_t irc_hilights = {CVAR_SAVE, "irc_hilights", "", "Space separated list of words to hilight"};
cvar_t irc_autochangetarget = {CVAR_SAVE, "irc_autochangetarget", "0", "if 1, will automatically change target for irc_messagemode when a hilight or a private message is recieved, so you can reply instantly. Requires irc_save_target"};
+cvar_t irc_watched_channels = {CVAR_SAVE, "irc_watched_channels", "", "Space separated list of watched channels. PRIVMSGs from those channels will be always printed to the chat area, regardless of irc_chatwindow setting"};
irc_session_t *irc_session_global = NULL;
int irc_msgmode;
Cvar_RegisterVariable(&irc_current_nick);
Cvar_RegisterVariable(&irc_hilights);
Cvar_RegisterVariable(&irc_autochangetarget);
+ Cvar_RegisterVariable(&irc_watched_channels);
Cmd_AddCommand ("irc_connect", CL_Irc_Connect_f, "Connects you to the IRC server");
Cmd_AddCommand ("irc_disconnect", CL_Irc_Disconnect_f, "Disconnects you from the IRC server");
int cmdlen, i, j, space;
const char *cmd, *dest;
char message[MAX_INPUTLINE];
+ qboolean watched;
if(Cmd_Argc() < 3) switch(irc_msgmode)
{
{
case MSGMODE_PRIVMSG:
irc_cmd_msg(irc_session_global, dest, message);
+ watched = Irc_IsWatchedChannel(dest);
if(ISCHANNEL(dest)) Con_Printf("%s%s^3%s^0|^7<^2%s^7> %s\n",
- CHATWINDOW,
+ watched? "\001" : CHATWINDOW,
irc_msgprefix.string,
dest,
irc_current_nick.string,
void Irc_SendMessage(const char *message)
{
const char* dest = Irc_GetLastChannel();
+ qboolean watched = Irc_IsWatchedChannel(dest);
MUSTCONNECT
irc_cmd_msg(irc_session_global, dest, message);
if(ISCHANNEL(dest)) Con_Printf("%s%s^3%s^0|^7<^2%s^7> %s\n",
- CHATWINDOW,
+ watched? "\001" : CHATWINDOW,
irc_msgprefix.string,
dest,
irc_current_nick.string,
IRCEVENT(event_channel)
{
char* msgstr = "";
+ qboolean watched;
//weird shit
if(!ISCHANNEL(params[0]))
if(count > 1)
msgstr = irc_color_strip_from_mirc(params[1]);
+ watched = Irc_IsWatchedChannel(params[0]);
+
if(Irc_CheckHilight(msgstr))
{
UPDATETARGET(params[0])
Con_Printf("%s%s^3%s^0|^7<^2%s^7> ^1%s\n",
- CHATWINDOW_URGENT,
+ watched? "\001" : CHATWINDOW_URGENT,
irc_msgprefix.string,
params[0],
origin,
);
}
else Con_Printf("%s%s^3%s^0|^7<^2%s^7> %s\n",
- CHATWINDOW,
+ watched? "\001" : CHATWINDOW,
irc_msgprefix.string,
params[0],
origin,
return FALSE;
}
+//
+// Checks if channel is watched
+//
+
+qboolean Irc_IsWatchedChannel(const char* chan)
+{
+ int start, idx, len;
+ char buffer[512];
+
+ len = strlen(irc_watched_channels.string);
+ start = 0;
+
+ for(idx = 0; idx < len; ++idx)
+ {
+ if(irc_watched_channels.string[idx] == ' ')
+ {
+ strlcpy(buffer, irc_watched_channels.string+start, idx+1);
+ if(strcasestr(chan, buffer))
+ return TRUE;
+
+ start = idx+1;
+ }
+ }
+
+ //Catch the final channel
+ strlcpy(buffer, irc_watched_channels.string+start, idx+1);
+ if(strcasestr(chan, buffer))
+ return TRUE;
+
+ return FALSE;
+}
+
//
// Functions that should have been in libircclient
//
void Irc_SendMessage(const char *msg);
int irc_cmd_nick(irc_session_t * session, const char *nick);
qboolean Irc_CheckHilight(const char* msg);
+qboolean Irc_IsWatchedChannel(const char* chan);
#define IRCEVENT(funcname) void funcname(irc_session_t *session, const char *event, const char *origin, const char **params, unsigned int count)
#define IRCNUMEVENT(funcname) void funcname (irc_session_t *session, unsigned int event, const char *origin, const char **params, unsigned int count)