cl_irc.c File Reference

IRC client implementation for UFO:AI. More...

#include "client.h"
#include "cl_irc.h"
#include "ui/ui_main.h"
#include "ui/ui_nodes.h"
#include "ui/ui_popup.h"
#include "multiplayer/mp_chatmessages.h"
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
Include dependency graph for cl_irc.c:

Go to the source code of this file.

Data Structures

struct  irc_user_s
struct  irc_channel_s
struct  irc_command_s
struct  irc_server_msg_s
struct  irc_bucket_message_s
struct  irc_bucket_s

Defines

#define IRC_SEND_BUF_SIZE   512
#define IRC_RECV_BUF_SIZE   1024
#define IRC_CTCP_MARKER_CHR   '\001'
#define IRC_CTCP_MARKER_STR   "\001"
#define IRC_MAX_USERLIST   512

Typedefs

typedef struct irc_user_s irc_user_t
typedef struct irc_channel_s irc_channel_t
typedef enum irc_numeric_e irc_numeric_t
typedef enum irc_command_type_e irc_command_type_t
typedef enum irc_nick_prefix_e irc_nick_prefix_t
typedef struct irc_command_s irc_command_t
typedef struct irc_server_msg_s irc_server_msg_t
typedef struct irc_bucket_message_s irc_bucket_message_t
typedef struct irc_bucket_s irc_bucket_t

Enumerations

enum  irc_numeric_e {
  RPL_WELCOME = 1, RPL_YOURHOST = 2, RPL_CREATED = 3, RPL_MYINFO = 4,
  RPL_ISUPPORT = 5, RPL_HELLO = 20, RPL_NONE = 300, RPL_USERHOST = 302,
  RPL_ISON = 303, RPL_AWAY = 301, RPL_UNAWAY = 305, RPL_NOWAWAY = 306,
  RPL_WHOISUSER = 311, RPL_WHOISSERVER = 312, RPL_WHOISOPERATOR = 313, RPL_WHOISIDLE = 317,
  RPL_ENDOFWHOIS = 318, RPL_WHOISCHANNELS = 319, RPL_WHOWASUSER = 314, RPL_ENDOFWHOWAS = 369,
  RPL_WHOISACCOUNT = 330, RPL_LISTSTART = 321, RPL_LIST = 322, RPL_LISTEND = 323,
  RPL_CHANNELMODEIS = 324, RPL_NOTOPIC = 331, RPL_TOPIC = 332, RPL_TOPICWHOTIME = 333,
  RPL_INVITING = 341, RPL_SUMMONING = 342, RPL_VERSION = 351, RPL_WHOREPLY = 352,
  RPL_ENDOFWHO = 315, RPL_NAMREPLY = 353, RPL_ENDOFNAMES = 366, RPL_LINKS = 364,
  RPL_ENDOFLINKS = 365, RPL_BANLIST = 367, RPL_ENDOFBANLIST = 368, RPL_INFO = 371,
  RPL_ENDOFINFO = 374, RPL_MOTDSTART = 375, RPL_MOTD = 372, RPL_ENDOFMOTD = 376,
  RPL_YOUREOPER = 381, RPL_REHASHING = 382, RPL_TIME = 391, RPL_USERSSTART = 392,
  RPL_USERS = 393, RPL_ENDOFUSERS = 394, RPL_NOUSERS = 395, RPL_TRACELINK = 200,
  RPL_TRACECONNECTING = 201, RPL_TRACEHANDSHAKE = 202, RPL_TRACEUNKNOWN = 203, RPL_TRACEOPERATOR = 204,
  RPL_TRACEUSER = 205, RPL_TRACESERVER = 206, RPL_TRACENEWTYPE = 208, RPL_TRACELOG = 261,
  RPL_STATSLINKINFO = 211, RPL_STATSCOMMANDS = 212, RPL_STATSCLINE = 213, RPL_STATSNLINE = 214,
  RPL_STATSILINE = 215, RPL_STATSKLINE = 216, RPL_STATSYLINE = 218, RPL_ENDOFSTATS = 219,
  RPL_STATSLLINE = 241, RPL_STATSUPTIME = 242, RPL_STATSOLINE = 243, RPL_STATSHLINE = 244,
  RPL_UMODEIS = 221, RPL_LUSERCLIENT = 251, RPL_LUSEROP = 252, RPL_LUSERUNKNOWN = 253,
  RPL_LUSERCHANNELS = 254, RPL_LUSERME = 255, RPL_ADMINME = 256, RPL_ADMINLOC1 = 257,
  RPL_ADMINLOC2 = 258, RPL_ADMINEMAIL = 259, RPL_LOCALUSERS = 265, RPL_GLOBALUSERS = 266,
  ERR_NOSUCHNICK = 401, ERR_NOSUCHSERVER = 402, ERR_NOSUCHCHANNEL = 403, ERR_CANNOTSENDTOCHAN = 404,
  ERR_TOOMANYCHANNELS = 405, ERR_WASNOSUCHNICK = 406, ERR_TOOMANYTARGETS = 407, ERR_NOORIGIN = 409,
  ERR_NORECIPIENT = 411, ERR_NOTEXTTOSEND = 412, ERR_NOTOPLEVEL = 413, ERR_WILDTOPLEVEL = 414,
  ERR_UNKNOWNCOMMAND = 421, ERR_NOMOTD = 422, ERR_NOADMININFO = 423, ERR_FILEERROR = 424,
  ERR_NONICKNAMEGIVEN = 431, ERR_ERRONEUSNICKNAME = 432, ERR_NICKNAMEINUSE = 433, ERR_NICKCOLLISION = 436,
  ERR_BANNICKCHANGE = 437, ERR_NCHANGETOOFAST = 438, ERR_USERNOTINCHANNEL = 441, ERR_NOTONCHANNEL = 442,
  ERR_USERONCHANNEL = 443, ERR_NOLOGIN = 444, ERR_SUMMONDISABLED = 445, ERR_USERSDISABLED = 446,
  ERR_NOTREGISTERED = 451, ERR_NEEDMOREPARAMS = 461, ERR_ALREADYREGISTRED = 462, ERR_NOPERMFORHOST = 463,
  ERR_PASSWDMISMATCH = 464, ERR_YOUREBANNEDCREEP = 465, ERR_BADNAME = 468, ERR_KEYSET = 467,
  ERR_CHANNELISFULL = 471, ERR_UNKNOWNMODE = 472, ERR_INVITEONLYCHAN = 473, ERR_BANNEDFROMCHAN = 474,
  ERR_BADCHANNELKEY = 475, ERR_NOPRIVILEGES = 481, ERR_CHANOPRIVSNEEDED = 482, ERR_CANTKILLSERVER = 483,
  ERR_NOOPERHOST = 491, ERR_UMODEUNKNOWNFLAG = 501, ERR_USERSDONTMATCH = 502, ERR_GHOSTEDCLIENT = 503,
  ERR_LAST_ERR_MSG = 504, ERR_SILELISTFULL = 511, ERR_NOSUCHGLINE = 512, ERR_BADPING = 513,
  ERR_TOOMANYDCC = 514, ERR_LISTSYNTAX = 521, ERR_WHOSYNTAX = 522, ERR_WHOLIMEXCEED = 523
}
enum  irc_command_type_e { IRC_COMMAND_NUMERIC, IRC_COMMAND_STRING }
enum  irc_nick_prefix_e { IRC_NICK_PREFIX_NONE = ' ', IRC_NICK_PREFIX_OP = '@', IRC_NICK_PREFIX_VOICE = '+' }

Functions

static void Irc_Logic_RemoveChannelName (irc_channel_t *channel, const char *nick)
 Removes a username from the channel username list.
static void Irc_Logic_AddChannelName (irc_channel_t *channel, irc_nick_prefix_t prefix, const char *nick)
 Adds a new username to the channel username list.
static void Irc_Client_Names_f (void)
static qboolean Irc_Client_Join (const char *channel, const char *password)
static void Irc_Logic_Disconnect (const char *reason)
static qboolean Irc_AppendToBuffer (const char *const msg,...)
 Append the irc message to the buffer.
static qboolean static qboolean Irc_Proto_ParseServerMsg (const char *txt, size_t txt_len, irc_server_msg_t *msg)
static qboolean Irc_Proto_Enqueue (const char *msg, size_t msg_len)
static qboolean Irc_Net_Connect (const char *host, const char *port)
static qboolean Irc_Net_Disconnect (void)
static void Irc_Net_Send (const char *msg, size_t msg_len)
static void Irc_Connect_f (void)
static void Irc_Disconnect_f (void)
static void Irc_Input_Deactivate_f (void)
static qboolean Irc_IsChannel (const char *target)
static void Irc_ParseName (const char *mask, char *nick, size_t size, irc_nick_prefix_t *prefix)
static qboolean Irc_Proto_Connect (const char *host, const char *port)
static qboolean Irc_Proto_Disconnect (void)
static qboolean Irc_Proto_Quit (const char *quitmsg)
static qboolean Irc_Proto_Nick (const char *nick)
static qboolean Irc_Proto_User (const char *user, qboolean invisible, const char *name)
static qboolean Irc_Proto_Password (const char *password)
static qboolean Irc_Proto_Join (const char *channel, const char *password)
static qboolean Irc_Proto_Part (const char *channel)
static qboolean Irc_Proto_Mode (const char *target, const char *modes, const char *params)
static qboolean Irc_Proto_Topic (const char *channel, const char *topic)
static qboolean Irc_Proto_Msg (const char *target, const char *text)
static qboolean Irc_Proto_Notice (const char *target, const char *text)
static void Irc_Proto_Pong (const char *nick, const char *server, const char *cookie)
static qboolean Irc_Proto_Kick (const char *channel, const char *nick, const char *reason)
static qboolean Irc_Proto_Who (const char *nick)
static qboolean Irc_Proto_Whois (const char *nick)
static qboolean Irc_Proto_Whowas (const char *nick)
static qboolean Irc_Proto_PollServerMsg (irc_server_msg_t *msg, qboolean *msg_complete)
static void Irc_Client_CmdRplWhowasuser (const char *params, const char *trailing)
static void Irc_Client_CmdTopic (const char *prefix, const char *trailing)
static void Irc_Client_CmdRplTopic (const char *params, const char *trailing)
static void Irc_Client_CmdRplWhoisuser (const char *params, const char *trailing)
static void Irc_Client_CmdRplWhoisserver (const char *params, const char *trailing)
static void Irc_Client_CmdRplWhoisaccount (const char *params, const char *trailing)
static void Irc_Client_CmdRplWhoisidle (const char *params, const char *trailing)
static void Irc_Client_CmdRplWhoreply (const char *params, const char *trailing)
static void Irc_Client_CmdMode (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdJoin (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdPart (const char *prefix, const char *trailing)
static void Irc_Client_CmdQuit (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdKill (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdKick (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdNick (const char *prefix, const char *params, const char *trailing)
 Changes the cvar 'name' with the new name you set.
static void Irc_Client_CmdPrivmsg (const char *prefix, const char *params, const char *trailing)
static void Irc_Client_CmdRplNamreply (const char *params, const char *trailing)
static void Irc_Client_CmdRplEndofnames (const char *params, const char *trailing)
static qboolean Irc_Proto_ProcessServerMsg (const irc_server_msg_t *msg)
static void Irc_Proto_RefillBucket (void)
static void Irc_Proto_DrainBucket (void)
 Send all enqueued packets.
static void Irc_Logic_SendMessages (void)
static void Irc_Logic_ReadMessages (void)
static void Irc_Logic_Connect (const char *server, const char *port)
void Irc_Logic_Frame (void)
static const char * Irc_Logic_GetChannelTopic (const irc_channel_t *channel)
static void Irc_Client_Join_f (void)
static void Irc_Client_Part_f (void)
static void Irc_Client_Msg_f (void)
 Send a message from menu or commandline.
static void Irc_Client_PrivMsg_f (void)
static void Irc_Client_Mode_f (void)
static void Irc_Client_Topic_f (void)
static void Irc_Client_Kick_f (void)
static void Irc_Client_Invite_f (void)
static void Irc_Client_Who_f (void)
static void Irc_Client_Whois_f (void)
static void Irc_Client_Whowas_f (void)
static void Irc_UserClick_f (void)
 Adds the username you clicked to your input buffer.
static void Irc_UserRightClick_f (void)
 Performs a whois query for the username you clicked.
static void Irc_Input_Activate_f (void)
void Irc_Init (void)
void Irc_Shutdown (void)

Variables

static cvar_tirc_server
static cvar_tirc_port
static cvar_tirc_channel
static cvar_tirc_nick
static cvar_tirc_user
static cvar_tirc_password
static cvar_tirc_topic
static cvar_tirc_defaultChannel
static cvar_tirc_logConsole
static cvar_tirc_showIfNotInMenu
static cvar_tirc_send_buffer
static qboolean irc_connected
static struct net_streamirc_stream
static const char IRC_QUIT_MSG [] = "ufoai.sf.net"
static const char IRC_INVITE_FOR_A_GAME [] = "UFOAIINVITE;"
static irc_channel_t ircChan
static irc_channel_tchan
static char irc_buffer [4096]
static cvar_tirc_messageBucketSize
static cvar_tirc_messageBucketBurst
static cvar_tirc_characterBucketSize
static cvar_tirc_characterBucketBurst
static cvar_tirc_characterBucketRate
static irc_bucket_t irc_bucket
static char irc_userListOrdered [IRC_MAX_USERLIST][MAX_VAR]

Detailed Description

IRC client implementation for UFO:AI.

Definition in file cl_irc.c.


Define Documentation

#define IRC_CTCP_MARKER_CHR   '\001'

Definition at line 907 of file cl_irc.c.

Referenced by Irc_Client_CmdPrivmsg().

#define IRC_CTCP_MARKER_STR   "\001"

Definition at line 908 of file cl_irc.c.

Referenced by Irc_Client_CmdPrivmsg().

#define IRC_MAX_USERLIST   512

Definition at line 1769 of file cl_irc.c.

Referenced by Irc_Client_Names_f(), Irc_UserClick_f(), and Irc_UserRightClick_f().

#define IRC_RECV_BUF_SIZE   1024

Definition at line 60 of file cl_irc.c.

Referenced by Irc_AppendToBuffer(), and Irc_Proto_PollServerMsg().

#define IRC_SEND_BUF_SIZE   512

Typedef Documentation

typedef struct irc_bucket_s irc_bucket_t
typedef struct irc_channel_s irc_channel_t
typedef struct irc_command_s irc_command_t
typedef struct irc_user_s irc_user_t

Enumeration Type Documentation

Enumerator:
IRC_COMMAND_NUMERIC 
IRC_COMMAND_STRING 

Definition at line 223 of file cl_irc.c.

Enumerator:
IRC_NICK_PREFIX_NONE 
IRC_NICK_PREFIX_OP 
IRC_NICK_PREFIX_VOICE 

Definition at line 228 of file cl_irc.c.

Enumerator:
RPL_WELCOME 
RPL_YOURHOST 
RPL_CREATED 
RPL_MYINFO 
RPL_ISUPPORT 
RPL_HELLO 
RPL_NONE 
RPL_USERHOST 
RPL_ISON 
RPL_AWAY 
RPL_UNAWAY 
RPL_NOWAWAY 
RPL_WHOISUSER 
RPL_WHOISSERVER 
RPL_WHOISOPERATOR 
RPL_WHOISIDLE 
RPL_ENDOFWHOIS 
RPL_WHOISCHANNELS 
RPL_WHOWASUSER 
RPL_ENDOFWHOWAS 
RPL_WHOISACCOUNT 
RPL_LISTSTART 
RPL_LIST 
RPL_LISTEND 
RPL_CHANNELMODEIS 
RPL_NOTOPIC 
RPL_TOPIC 
RPL_TOPICWHOTIME 
RPL_INVITING 
RPL_SUMMONING 
RPL_VERSION 
RPL_WHOREPLY 
RPL_ENDOFWHO 
RPL_NAMREPLY 
RPL_ENDOFNAMES 
RPL_LINKS 
RPL_ENDOFLINKS 
RPL_BANLIST 
RPL_ENDOFBANLIST 
RPL_INFO 
RPL_ENDOFINFO 
RPL_MOTDSTART 
RPL_MOTD 
RPL_ENDOFMOTD 
RPL_YOUREOPER 
RPL_REHASHING 
RPL_TIME 
RPL_USERSSTART 
RPL_USERS 
RPL_ENDOFUSERS 
RPL_NOUSERS 
RPL_TRACELINK 
RPL_TRACECONNECTING 
RPL_TRACEHANDSHAKE 
RPL_TRACEUNKNOWN 
RPL_TRACEOPERATOR 
RPL_TRACEUSER 
RPL_TRACESERVER 
RPL_TRACENEWTYPE 
RPL_TRACELOG 
RPL_STATSLINKINFO 
RPL_STATSCOMMANDS 
RPL_STATSCLINE 
RPL_STATSNLINE 
RPL_STATSILINE 
RPL_STATSKLINE 
RPL_STATSYLINE 
RPL_ENDOFSTATS 
RPL_STATSLLINE 
RPL_STATSUPTIME 
RPL_STATSOLINE 
RPL_STATSHLINE 
RPL_UMODEIS 
RPL_LUSERCLIENT 
RPL_LUSEROP 
RPL_LUSERUNKNOWN 
RPL_LUSERCHANNELS 
RPL_LUSERME 
RPL_ADMINME 
RPL_ADMINLOC1 
RPL_ADMINLOC2 
RPL_ADMINEMAIL 
RPL_LOCALUSERS 
RPL_GLOBALUSERS 
ERR_NOSUCHNICK 
ERR_NOSUCHSERVER 
ERR_NOSUCHCHANNEL 
ERR_CANNOTSENDTOCHAN 
ERR_TOOMANYCHANNELS 
ERR_WASNOSUCHNICK 
ERR_TOOMANYTARGETS 
ERR_NOORIGIN 
ERR_NORECIPIENT 
ERR_NOTEXTTOSEND 
ERR_NOTOPLEVEL 
ERR_WILDTOPLEVEL 
ERR_UNKNOWNCOMMAND 
ERR_NOMOTD 
ERR_NOADMININFO 
ERR_FILEERROR 
ERR_NONICKNAMEGIVEN 
ERR_ERRONEUSNICKNAME 
ERR_NICKNAMEINUSE 
ERR_NICKCOLLISION 
ERR_BANNICKCHANGE 
ERR_NCHANGETOOFAST 
ERR_USERNOTINCHANNEL 
ERR_NOTONCHANNEL 
ERR_USERONCHANNEL 
ERR_NOLOGIN 
ERR_SUMMONDISABLED 
ERR_USERSDISABLED 
ERR_NOTREGISTERED 
ERR_NEEDMOREPARAMS 
ERR_ALREADYREGISTRED 
ERR_NOPERMFORHOST 
ERR_PASSWDMISMATCH 
ERR_YOUREBANNEDCREEP 
ERR_BADNAME 
ERR_KEYSET 
ERR_CHANNELISFULL 
ERR_UNKNOWNMODE 
ERR_INVITEONLYCHAN 
ERR_BANNEDFROMCHAN 
ERR_BADCHANNELKEY 
ERR_NOPRIVILEGES 
ERR_CHANOPRIVSNEEDED 
ERR_CANTKILLSERVER 
ERR_NOOPERHOST 
ERR_UMODEUNKNOWNFLAG 
ERR_USERSDONTMATCH 
ERR_GHOSTEDCLIENT 
ERR_LAST_ERR_MSG 
ERR_SILELISTFULL 
ERR_NOSUCHGLINE 
ERR_BADPING 
ERR_TOOMANYDCC 
ERR_LISTSYNTAX 
ERR_WHOSYNTAX 
ERR_WHOLIMEXCEED 

Definition at line 75 of file cl_irc.c.


Function Documentation

static qboolean Irc_AppendToBuffer ( const char *const   msg,
  ... 
) [static]
static void Irc_Client_CmdJoin ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdKick ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdKill ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdMode ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]

Definition at line 823 of file cl_irc.c.

References Irc_AppendToBuffer(), Irc_ParseName(), and MAX_VAR.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdNick ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]

Changes the cvar 'name' with the new name you set.

Definition at line 890 of file cl_irc.c.

References Cvar_ForceSet(), Irc_AppendToBuffer(), Irc_Logic_AddChannelName(), Irc_Logic_RemoveChannelName(), Irc_ParseName(), MAX_VAR, and cvar_s::string.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdPart ( const char *  prefix,
const char *  trailing 
) [static]
static void Irc_Client_CmdPrivmsg ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdQuit ( const char *  prefix,
const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdRplEndofnames ( const char *  params,
const char *  trailing 
) [static]
Todo:
Implement me

Definition at line 1020 of file cl_irc.c.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplNamreply ( const char *  params,
const char *  trailing 
) [static]
static void Irc_Client_CmdRplTopic ( const char *  params,
const char *  trailing 
) [static]

Definition at line 689 of file cl_irc.c.

References Irc_Client_CmdTopic().

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhoisaccount ( const char *  params,
const char *  trailing 
) [static]

Definition at line 745 of file cl_irc.c.

References i, Irc_AppendToBuffer(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhoisidle ( const char *  params,
const char *  trailing 
) [static]

Definition at line 767 of file cl_irc.c.

References i, Irc_AppendToBuffer(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhoisserver ( const char *  params,
const char *  trailing 
) [static]

Definition at line 723 of file cl_irc.c.

References i, Irc_AppendToBuffer(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhoisuser ( const char *  params,
const char *  trailing 
) [static]

Definition at line 698 of file cl_irc.c.

References i, Irc_AppendToBuffer(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhoreply ( const char *  params,
const char *  trailing 
) [static]

Definition at line 789 of file cl_irc.c.

References i, Irc_AppendToBuffer(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdRplWhowasuser ( const char *  params,
const char *  trailing 
) [static]

Definition at line 659 of file cl_irc.c.

References i, Irc_AppendToBuffer(), IRC_SEND_BUF_SIZE, and Q_strncpyz().

Referenced by Irc_Proto_ProcessServerMsg().

static void Irc_Client_CmdTopic ( const char *  prefix,
const char *  trailing 
) [inline, static]

Definition at line 684 of file cl_irc.c.

References Cvar_ForceSet().

Referenced by Irc_Client_CmdRplTopic(), and Irc_Proto_ProcessServerMsg().

static void Irc_Client_Invite_f ( void   )  [static]
See also:
Irc_Client_CmdPrivmsg

Todo:
get own external ip and remove the 127.0.0.1 nonsense (maybe ask the masterserver for this info?)
Todo:
Maybe somehow check the version of the client with ctcp VERSION and only send to those, that are connected with ufoai and have a correct version

Definition at line 1817 of file cl_irc.c.

References CL_OnBattlescape(), Com_Printf(), Com_sprintf(), IRC_INVITE_FOR_A_GAME, Irc_Proto_Msg(), irc_user_s::key, name, irc_user_s::next, port, cvar_s::string, UI_PushWindow(), and irc_channel_s::user.

Referenced by Irc_Init().

static qboolean Irc_Client_Join ( const char *  channel,
const char *  password 
) [static]
static void Irc_Client_Join_f ( void   )  [static]

Definition at line 1651 of file cl_irc.c.

References argc, Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Irc_Client_Join().

Referenced by Irc_Init().

static void Irc_Client_Kick_f ( void   )  [static]

Definition at line 1795 of file cl_irc.c.

References argc, Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Kick().

Referenced by Irc_Init().

static void Irc_Client_Mode_f ( void   )  [static]

Definition at line 1725 of file cl_irc.c.

References argc, Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Mode().

Referenced by Irc_Init().

static void Irc_Client_Msg_f ( void   )  [static]

Send a message from menu or commandline.

Note:
This function uses the irc_send_buffer cvar to handle the menu input for irc messages See menu_irc.ufo for more information

Definition at line 1678 of file cl_irc.c.

References Cmd_Argc(), Cmd_Args(), Com_Printf(), Cvar_ForceSet(), Irc_AppendToBuffer(), Irc_Proto_Msg(), IRC_SEND_BUF_SIZE, and cvar_s::string.

Referenced by Irc_Init().

static void Irc_Client_Names_f ( void   )  [static]
static void Irc_Client_Part_f ( void   )  [static]

Definition at line 1663 of file cl_irc.c.

References argc, Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Part().

Referenced by Irc_Init().

static void Irc_Client_PrivMsg_f ( void   )  [static]

Definition at line 1708 of file cl_irc.c.

References Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_Printf(), Irc_Proto_Msg(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Init().

static void Irc_Client_Topic_f ( void   )  [static]
static void Irc_Client_Who_f ( void   )  [static]

Definition at line 1849 of file cl_irc.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Who().

Referenced by Irc_Init().

static void Irc_Client_Whois_f ( void   )  [static]

Definition at line 1857 of file cl_irc.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Whois().

Referenced by Irc_Init().

static void Irc_Client_Whowas_f ( void   )  [static]

Definition at line 1865 of file cl_irc.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Irc_Proto_Whowas().

Referenced by Irc_Init().

static void Irc_Connect_f ( void   )  [static]
static void Irc_Disconnect_f ( void   )  [static]

Definition at line 1629 of file cl_irc.c.

References Irc_Logic_Disconnect().

Referenced by Irc_Init().

void Irc_Init ( void   ) 
static void Irc_Input_Activate_f ( void   )  [static]
See also:
Irc_Input_Deactivate

Definition at line 1934 of file cl_irc.c.

References Com_DPrintf(), DEBUG_CLIENT, irc_buffer, irc_connected, qfalse, cvar_s::string, TEXT_IRCCONTENT, UI_PopWindow(), UI_PushWindow(), and UI_RegisterText().

Referenced by Irc_Init().

static void Irc_Input_Deactivate_f ( void   )  [static]
See also:
Irc_Input_Activate

Definition at line 1951 of file cl_irc.c.

References cvar_s::modified, qfalse, TEXT_IRCCONTENT, and UI_ResetData().

Referenced by Irc_Init(), and Irc_Logic_Disconnect().

static qboolean Irc_IsChannel ( const char *  target  )  [inline, static]

Definition at line 290 of file cl_irc.c.

Referenced by Irc_Client_Join().

static void Irc_Logic_AddChannelName ( irc_channel_t channel,
irc_nick_prefix_t  prefix,
const char *  nick 
) [static]
static void Irc_Logic_Connect ( const char *  server,
const char *  port 
) [static]
static void Irc_Logic_Disconnect ( const char *  reason  )  [static]
void Irc_Logic_Frame ( void   ) 
static const char* Irc_Logic_GetChannelTopic ( const irc_channel_t channel  )  [static]

Definition at line 1501 of file cl_irc.c.

References irc_channel_s::topic.

Referenced by Irc_Client_Topic_f().

static void Irc_Logic_ReadMessages ( void   )  [static]
static void Irc_Logic_RemoveChannelName ( irc_channel_t channel,
const char *  nick 
) [static]

Removes a username from the channel username list.

See also:
Irc_Logic_AddChannelName

Definition at line 1534 of file cl_irc.c.

References i, Irc_Client_Names_f(), Mem_Free, irc_user_s::next, irc_channel_s::user, and irc_channel_s::users.

Referenced by Irc_Client_CmdKick(), Irc_Client_CmdKill(), Irc_Client_CmdNick(), Irc_Client_CmdPart(), and Irc_Client_CmdQuit().

static void Irc_Logic_SendMessages ( void   )  [static]
See also:
Irc_Logic_Frame

Definition at line 1417 of file cl_irc.c.

References Irc_Proto_DrainBucket(), and Irc_Proto_RefillBucket().

Referenced by Irc_Logic_Frame().

static qboolean Irc_Net_Connect ( const char *  host,
const char *  port 
) [static]
Returns:
qtrue if successful - qfalse otherwise
See also:
Irc_Net_Disconnect

Definition at line 1567 of file cl_irc.c.

References NET_Connect(), NET_StreamFree(), qfalse, and qtrue.

Referenced by Irc_Proto_Connect().

static qboolean Irc_Net_Disconnect ( void   )  [static]
See also:
Irc_Net_Connect

Definition at line 1578 of file cl_irc.c.

References NET_StreamFree(), and qtrue.

Referenced by Irc_Proto_Disconnect().

static void Irc_Net_Send ( const char *  msg,
size_t  msg_len 
) [static]

Definition at line 1585 of file cl_irc.c.

References NET_StreamEnqueue().

Referenced by Irc_Proto_DrainBucket(), Irc_Proto_Pong(), and Irc_Proto_Quit().

static void Irc_ParseName ( const char *  mask,
char *  nick,
size_t  size,
irc_nick_prefix_t prefix 
) [static]
static qboolean Irc_Proto_Connect ( const char *  host,
const char *  port 
) [static]
static qboolean Irc_Proto_Disconnect ( void   )  [static]
static void Irc_Proto_DrainBucket ( void   )  [static]
static qboolean Irc_Proto_Enqueue ( const char *  msg,
size_t  msg_len 
) [static]
static qboolean Irc_Proto_Join ( const char *  channel,
const char *  password 
) [static]
static qboolean Irc_Proto_Kick ( const char *  channel,
const char *  nick,
const char *  reason 
) [static]
See also:
Irc_Proto_Enqueue

Definition at line 534 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Kick_f().

static qboolean Irc_Proto_Mode ( const char *  target,
const char *  modes,
const char *  params 
) [static]
See also:
Irc_Proto_Enqueue

Definition at line 465 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Mode_f().

static qboolean Irc_Proto_Msg ( const char *  target,
const char *  text 
) [static]
static qboolean Irc_Proto_Nick ( const char *  nick  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 398 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Logic_Connect().

static qboolean Irc_Proto_Notice ( const char *  target,
const char *  text 
) [static]
See also:
Irc_Proto_Enqueue

Definition at line 510 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_CmdPrivmsg().

static qboolean Irc_Proto_ParseServerMsg ( const char *  txt,
size_t  txt_len,
irc_server_msg_t msg 
) [static]
static qboolean Irc_Proto_Part ( const char *  channel  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 454 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Part_f().

static qboolean Irc_Proto_Password ( const char *  password  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 420 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Logic_Connect().

static qboolean Irc_Proto_PollServerMsg ( irc_server_msg_t msg,
qboolean msg_complete 
) [static]
static void Irc_Proto_Pong ( const char *  nick,
const char *  server,
const char *  cookie 
) [static]
See also:
Irc_Net_Send

Definition at line 521 of file cl_irc.c.

References Irc_Net_Send(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Proto_ProcessServerMsg().

static qboolean Irc_Proto_ProcessServerMsg ( const irc_server_msg_t msg  )  [static]
See also:
Irc_Logic_ReadMessages

Todo:
Skip non printable chars here

Definition at line 1027 of file cl_irc.c.

References _, byte, Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, ERR_ALREADYREGISTRED, ERR_BADCHANNELKEY, ERR_BADNAME, ERR_BADPING, ERR_BANNEDFROMCHAN, ERR_BANNICKCHANGE, ERR_CANNOTSENDTOCHAN, ERR_CANTKILLSERVER, ERR_CHANNELISFULL, ERR_CHANOPRIVSNEEDED, ERR_ERRONEUSNICKNAME, ERR_FILEERROR, ERR_GHOSTEDCLIENT, ERR_INVITEONLYCHAN, ERR_KEYSET, ERR_LAST_ERR_MSG, ERR_LISTSYNTAX, ERR_NCHANGETOOFAST, ERR_NEEDMOREPARAMS, ERR_NICKCOLLISION, ERR_NICKNAMEINUSE, ERR_NOADMININFO, ERR_NOLOGIN, ERR_NOMOTD, ERR_NONICKNAMEGIVEN, ERR_NOOPERHOST, ERR_NOORIGIN, ERR_NOPERMFORHOST, ERR_NOPRIVILEGES, ERR_NORECIPIENT, ERR_NOSUCHCHANNEL, ERR_NOSUCHGLINE, ERR_NOSUCHNICK, ERR_NOSUCHSERVER, ERR_NOTEXTTOSEND, ERR_NOTONCHANNEL, ERR_NOTOPLEVEL, ERR_NOTREGISTERED, ERR_PASSWDMISMATCH, ERR_SILELISTFULL, ERR_SUMMONDISABLED, ERR_TOOMANYCHANNELS, ERR_TOOMANYDCC, ERR_TOOMANYTARGETS, ERR_UMODEUNKNOWNFLAG, ERR_UNKNOWNCOMMAND, ERR_UNKNOWNMODE, ERR_USERNOTINCHANNEL, ERR_USERONCHANNEL, ERR_USERSDISABLED, ERR_USERSDONTMATCH, ERR_WASNOSUCHNICK, ERR_WHOLIMEXCEED, ERR_WHOSYNTAX, ERR_WILDTOPLEVEL, ERR_YOUREBANNEDCREEP, FS_FreeFile(), FS_LoadFile(), irc_server_msg_s::id, irc_command_s::id, cvar_s::integer, Irc_AppendToBuffer(), Irc_Client_CmdJoin(), Irc_Client_CmdKick(), Irc_Client_CmdKill(), Irc_Client_CmdMode(), Irc_Client_CmdNick(), Irc_Client_CmdPart(), Irc_Client_CmdPrivmsg(), Irc_Client_CmdQuit(), Irc_Client_CmdRplEndofnames(), Irc_Client_CmdRplNamreply(), Irc_Client_CmdRplTopic(), Irc_Client_CmdRplWhoisaccount(), Irc_Client_CmdRplWhoisidle(), Irc_Client_CmdRplWhoisserver(), Irc_Client_CmdRplWhoisuser(), Irc_Client_CmdRplWhoreply(), Irc_Client_CmdRplWhowasuser(), Irc_Client_CmdTopic(), IRC_COMMAND_NUMERIC, IRC_COMMAND_STRING, Irc_Logic_Disconnect(), Irc_Proto_Pong(), irc_server_msg_s::numeric, irc_command_s::numeric, irc_server_msg_s::params, popupText, irc_server_msg_s::prefix, Q_strncpyz(), qfalse, qtrue, RPL_CREATED, RPL_ENDOFMOTD, RPL_ENDOFNAMES, RPL_ENDOFWHO, RPL_ENDOFWHOIS, RPL_ENDOFWHOWAS, RPL_GLOBALUSERS, RPL_HELLO, RPL_ISUPPORT, RPL_LOCALUSERS, RPL_LUSERCHANNELS, RPL_LUSERCLIENT, RPL_LUSERME, RPL_LUSEROP, RPL_LUSERUNKNOWN, RPL_MOTD, RPL_MOTDSTART, RPL_MYINFO, RPL_NAMREPLY, RPL_NOTOPIC, RPL_TOPIC, RPL_WELCOME, RPL_WHOISACCOUNT, RPL_WHOISCHANNELS, RPL_WHOISIDLE, RPL_WHOISOPERATOR, RPL_WHOISSERVER, RPL_WHOISUSER, RPL_WHOREPLY, RPL_WHOWASUSER, RPL_YOURHOST, cvar_s::string, irc_server_msg_s::string, irc_command_s::string, irc_server_msg_s::trailing, irc_server_msg_s::type, irc_command_s::type, UI_Popup(), and UI_PushWindow().

Referenced by Irc_Logic_ReadMessages().

static qboolean Irc_Proto_Quit ( const char *  quitmsg  )  [static]
See also:
Irc_Net_Send

Definition at line 386 of file cl_irc.c.

References Irc_Net_Send(), IRC_SEND_BUF_SIZE, and qfalse.

Referenced by Irc_Logic_Disconnect().

static void Irc_Proto_RefillBucket ( void   )  [static]
static qboolean Irc_Proto_Topic ( const char *  channel,
const char *  topic 
) [static]
See also:
Irc_Proto_Enqueue

Definition at line 478 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Topic_f().

static qboolean Irc_Proto_User ( const char *  user,
qboolean  invisible,
const char *  name 
) [static]
See also:
Irc_Proto_Enqueue

Definition at line 409 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Logic_Connect().

static qboolean Irc_Proto_Who ( const char *  nick  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 547 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Who_f().

static qboolean Irc_Proto_Whois ( const char *  nick  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 558 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Whois_f(), and Irc_UserRightClick_f().

static qboolean Irc_Proto_Whowas ( const char *  nick  )  [static]
See also:
Irc_Proto_Enqueue

Definition at line 569 of file cl_irc.c.

References Irc_Proto_Enqueue(), and IRC_SEND_BUF_SIZE.

Referenced by Irc_Client_Whowas_f().

void Irc_Shutdown ( void   ) 

Definition at line 2009 of file cl_irc.c.

References irc_connected, and Irc_Logic_Disconnect().

Referenced by CL_Shutdown().

static void Irc_UserClick_f ( void   )  [static]

Adds the username you clicked to your input buffer.

See also:
Irc_UserRightClick_f

Definition at line 1883 of file cl_irc.c.

References Cmd_Argc(), Cmd_Argv(), Cvar_Set(), IRC_MAX_USERLIST, irc_userListOrdered, name, cvar_s::string, irc_channel_s::users, and va().

Referenced by Irc_Init().

static void Irc_UserRightClick_f ( void   )  [static]

Performs a whois query for the username you clicked.

See also:
Irc_UserClick_f

Definition at line 1909 of file cl_irc.c.

References Cmd_Argc(), Cmd_Argv(), IRC_MAX_USERLIST, Irc_Proto_Whois(), irc_userListOrdered, name, and irc_channel_s::users.

Referenced by Irc_Init().


Variable Documentation

irc_channel_t* chan [static]

Definition at line 262 of file cl_irc.c.

Definition at line 343 of file cl_irc.c.

char irc_buffer[4096] [static]

Definition at line 264 of file cl_irc.c.

Referenced by Irc_AppendToBuffer(), and Irc_Input_Activate_f().

cvar_t* irc_channel [static]

Definition at line 46 of file cl_irc.c.

Definition at line 326 of file cl_irc.c.

Definition at line 327 of file cl_irc.c.

Definition at line 325 of file cl_irc.c.

Definition at line 51 of file cl_irc.c.

const char IRC_INVITE_FOR_A_GAME[] = "UFOAIINVITE;" [static]

Definition at line 259 of file cl_irc.c.

Referenced by Irc_Client_CmdPrivmsg(), and Irc_Client_Invite_f().

Definition at line 52 of file cl_irc.c.

Definition at line 324 of file cl_irc.c.

Definition at line 323 of file cl_irc.c.

cvar_t* irc_nick [static]

Definition at line 47 of file cl_irc.c.

cvar_t* irc_password [static]

Definition at line 49 of file cl_irc.c.

cvar_t* irc_port [static]

Definition at line 45 of file cl_irc.c.

const char IRC_QUIT_MSG[] = "ufoai.sf.net" [static]

Definition at line 258 of file cl_irc.c.

Definition at line 55 of file cl_irc.c.

cvar_t* irc_server [static]

Definition at line 44 of file cl_irc.c.

Definition at line 53 of file cl_irc.c.

struct net_stream* irc_stream [static]

Definition at line 256 of file cl_irc.c.

cvar_t* irc_topic [static]

Definition at line 50 of file cl_irc.c.

cvar_t* irc_user [static]

Definition at line 48 of file cl_irc.c.

char irc_userListOrdered[IRC_MAX_USERLIST][MAX_VAR] [static]

Definition at line 1770 of file cl_irc.c.

Referenced by Irc_Client_Names_f(), Irc_UserClick_f(), and Irc_UserRightClick_f().

Definition at line 261 of file cl_irc.c.


Generated by  doxygen 1.6.2