Implementation of bot.h.
More...
#include "bot.h"
#include "connection/connection.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
|
#define | OK 1 |
|
#define | ERROR 0 |
|
#define | RECV_ERROR -1 |
|
Implementation of bot.h.
- Author
- Mateusz Makowski
- Date
- 16.09.2018
◆ bot_add_command()
int bot_add_command |
( |
IRC_Bot * |
bot, |
|
|
const char |
name[], |
|
|
fp_cmd_t |
callback |
|
) |
| |
Add Bot_Command to the IRC_Bot.
- Parameters
-
bot | pointer to IRC_Bot object |
name | command name |
callback | function pointer to be called when executing this command |
- Returns
- 0 on failure, 1 on success
◆ bot_call()
int bot_call |
( |
IRC_Bot * |
bot, |
|
|
const char |
cmd[] |
|
) |
| |
Call (execute) a Bot_Command.
- Parameters
-
bot | pointer to IRC_Bot object |
cmd | command name to be called |
- Returns
- 0 on failure, 1 on success
◆ bot_connect()
int bot_connect |
( |
IRC_Bot * |
bot, |
|
|
const char |
address[], |
|
|
const char |
port[] |
|
) |
| |
Connect IRC_Bot to the server.
- Parameters
-
bot | pointer to IRC_Bot object |
address | IRC server address to connect to |
port | IRC port number (as a string) |
- Returns
- 0 on failure, 1 on success
◆ bot_create()
IRC_Bot* bot_create |
( |
const char |
nick[] | ) |
|
Create and populate a new IRC_Bot structure.
- Parameters
-
nick | visible nickname on the IRC server |
- Returns
- pointer to the newly created IRC_Bot object or null pointer on failure
◆ bot_disconnect()
int bot_disconnect |
( |
IRC_Bot * |
bot | ) |
|
Disconnect IRC_Bot from the server.
- Parameters
-
- Returns
- 0 on failure, 1 on success
◆ bot_join()
int bot_join |
( |
IRC_Bot * |
bot, |
|
|
const char |
channel[] |
|
) |
| |
Join an IRC channel.
- Parameters
-
bot | pointer to IRC_Bot object |
channel | channel to join |
- Returns
- 0 on failure, 1 on success
◆ bot_leave()
int bot_leave |
( |
IRC_Bot * |
bot, |
|
|
const char |
channel[] |
|
) |
| |
Leave an IRC channel.
- Parameters
-
bot | pointer to IRC_Bot object |
channel | channel to leave |
- Returns
- 0 on failure, 1 on success
◆ bot_read()
Read incoming messages from server, one message at a time.
- Parameters
-
- Returns
- negative numbers on socket errors, 0 - connection closed, positive numbers denote bytes read
- See also
- last_msg
◆ bot_send()
int bot_send |
( |
IRC_Bot * |
bot, |
|
|
const char |
msg[] |
|
) |
| |
Send a text message to connected server.
- Parameters
-
bot | pointer to IRC_Bot object |
msg | message string to be sent (doesn't have to include trailing newline) |
- Returns
- 0 on failure, 1 on success