IRC library


Functions

int lp_resolve (char *server, struct hostent *host)
int lp_create_sock ()
int lp_send (lp_server *server, char *fmt,...)
void lp_dump_msg (lp_msg *msg)
lp_msglp_parse (char *str)
void lp_msg_free (lp_msg *msg)
int lp_ping (gpointer data)
int lp_check_rss (gpointer data)
char * lp_to (lp_server *server, lp_msg *msg)
int lp_identified (char *who)
lp_userlp_find_user (char *who)
int lp_handle_command (lp_server *server, lp_msg *msg, GList *params)
int lp_handler (GIOChannel *source, GIOCondition condition, gpointer data)
int lp_connect (lp_server *server)
int lp_disconnect (lp_server *server, char *msg)
int lp_reconnect (lp_server *server, char *msg)
int lp_listen (GIOChannel *source, GIOCondition condition, gpointer data)
int lp_serve ()

Function Documentation

int lp_check_rss ( gpointer  data  ) 

Checks each RSS feed for new entries

Parameters:
data not used
Returns:
TRUE on success, FALSE on error

Definition at line 191 of file lib.c.

References check_rss(), and __lp_config::rsslist.

Referenced by main().

int lp_connect ( lp_server server  ) 

Definition at line 549 of file lib.c.

References __lp_server::address, __lp_server::chan, lp_create_sock(), lp_handler(), lp_resolve(), lp_send(), __lp_server::nick, __lp_server::port, and __lp_server::sock.

Referenced by lp_handle_command(), lp_reconnect(), and main().

int lp_create_sock (  ) 

Creates an IPV4 socket.

Returns:
-1 on error, 0 on success

Definition at line 42 of file lib.c.

Referenced by lp_connect(), lp_serve(), and remind().

int lp_disconnect ( lp_server server,
char *  msg 
)

Disconnects from a server

Parameters:
server the server
msg quit message
Returns:
0 on success, -1 on error

Definition at line 581 of file lib.c.

References lp_send(), and __lp_server::sock.

Referenced by lp_handle_command(), and lp_reconnect().

void lp_dump_msg ( lp_msg msg  ) 

Dumps an IRC message for debugging purposes

Parameters:
msg the message

Definition at line 93 of file lib.c.

References __lp_msg::cmd, __lp_msg::from, __lp_msg::params, and __lp_msg::to.

Referenced by lp_parse().

lp_user* lp_find_user ( char *  who  ) 

Searches for a user

Parameters:
who the user login
Returns:
the lp_user pointer

Definition at line 238 of file lib.c.

References __lp_user::login, and __lp_config::users.

Referenced by lp_handle_command(), and lp_identified().

int lp_handle_command ( lp_server server,
lp_msg msg,
GList *  params 
)

Handles a bot command. It can be a highlight or a private message.

Parameters:
server the server of the message
msg message
params the message parameters

Definition at line 256 of file lib.c.

References __lp_record_ver::author, __lp_record_ver::content, __lp_record_ver::date, __lp_msg::from, __lp_config::ident_method, __lp_config::ident_to, __lp_user::identified, __lp_server::is_console, __lp_user::login, lp_connect(), lp_disconnect(), lp_find_user(), LP_IDENT_PASS, LP_IDENT_SERVICES, lp_identified(), LP_RIGHT_DB, LP_RIGHT_OP, lp_send(), lp_to(), __lp_record::name, __lp_user::pass, __lp_config::records, remind(), __lp_user::rights, saveRecords(), __lp_config::servers, __lp_config::users, and __lp_record::versions.

Referenced by lp_handler().

int lp_handler ( GIOChannel *  source,
GIOCondition  condition,
gpointer  data 
)

Input handler for IRC messages

Parameters:
source not used
condition not used
data the server pointer
Returns:
TRUE on success, FALSE on error

Definition at line 464 of file lib.c.

References __lp_server::channels, __lp_msg::cmd, __lp_msg::from, __lp_config::ident_method, __lp_config::ident_to, __lp_user::identified, IRC_LINE_LENGHT, __lp_server::lastpong, __lp_user::login, lp_handle_command(), LP_IDENT_SERVICES, lp_msg_free(), lp_parse(), lp_ping(), lp_reconnect(), lp_send(), __lp_server::nick, __lp_msg::params, server, __lp_server::sock, sockerr_again, __lp_msg::to, and __lp_config::users.

Referenced by lp_connect(), and lp_listen().

int lp_identified ( char *  who  ) 

Checks if a user has been identified.

Parameters:
who the login of the user
Returns:
1 if yes, 0 if no

Definition at line 226 of file lib.c.

References __lp_user::identified, and lp_find_user().

Referenced by lp_handle_command().

int lp_listen ( GIOChannel *  source,
GIOCondition  condition,
gpointer  data 
)

Listens for new clients to accept them.

Parameters:
source not used
condition not used
data server socket
Returns:
TRUE on success, FALSE on error

Definition at line 608 of file lib.c.

References __lp_server::chan, __lp_server::is_console, lp_handler(), __lp_server::nick, server, and __lp_server::sock.

Referenced by lp_serve().

void lp_msg_free ( lp_msg msg  ) 

Frees a message.

Parameters:
msg the message

Definition at line 163 of file lib.c.

References __lp_msg::raw.

Referenced by lp_handler().

lp_msg* lp_parse ( char *  str  ) 

Parses an IRC message

Parameters:
str message to parse
Returns:
NULL on error, the message on success

Definition at line 111 of file lib.c.

References __lp_msg::cmd, __lp_msg::from, lp_dump_msg(), __lp_msg::params, __lp_msg::raw, and __lp_msg::to.

Referenced by lp_handler().

int lp_ping ( gpointer  data  ) 

Pings the server and reconnets on timeout.

Parameters:
data not used
Returns:
TRUE on success, FALSE on error

Definition at line 173 of file lib.c.

References __lp_server::lastpong, lp_reconnect(), lp_send(), __lp_server::nick, and server.

Referenced by lp_handler().

int lp_reconnect ( lp_server server,
char *  msg 
)

Reconnects to a server

Parameters:
server the server
msg the quit message
Returns:
0 on success, -1 on error

Definition at line 595 of file lib.c.

References lp_connect(), and lp_disconnect().

Referenced by lp_handler(), lp_ping(), and lp_send().

int lp_resolve ( char *  server,
struct hostent *  host 
)

Resolves a hostname.

Parameters:
server the hostname to resolve
host pointer to the return value
Returns:
-1 on error, 0 on success

Definition at line 25 of file lib.c.

Referenced by lp_connect(), and remind().

int lp_send ( lp_server server,
char *  fmt,
  ... 
)

Sends data to a server.

Parameters:
server the server pointer
fmt format string
Returns:
0 on success, -1 on error

Definition at line 56 of file lib.c.

References IRC_LINE_LENGHT, lp_reconnect(), and __lp_server::sock.

Referenced by check_rss(), kbd_handler(), lp_connect(), lp_disconnect(), lp_handle_command(), lp_handler(), lp_ping(), and remind().

int lp_serve (  ) 

Start the bot control daemon

Returns:
0 on success, -1 on error

Definition at line 623 of file lib.c.

References lp_create_sock(), and lp_listen().

Referenced by main().

char* lp_to ( lp_server server,
lp_msg msg 
)

Returns the user name in case of a query, and the channel name in case the message was public.

Parameters:
server the server of the message
msg message
Returns:
the user or channel name

Definition at line 209 of file lib.c.

References __lp_msg::from, __lp_server::nick, and __lp_msg::to.

Referenced by lp_handle_command().


Generated on Mon May 19 15:36:55 2008 for lpbot by  doxygen 1.5.4